| 1 |
#include <aws/common/hash_table.h> |
| 2 |
#include <aws/common/math.h> |
| 3 |
#include <aws/common/private/hash_table_impl.h> |
| 4 |
#include <aws/common/string.h> |
| 5 |
|
| 6 |
#include <limits.h> |
| 7 |
#include <proof_helpers/make_common_data_structures.h> |
| 8 |
#include <proof_helpers/utils.h> |
| 9 |
#include <stdio.h> |
| 10 |
#include <stdlib.h> |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
struct hash_table_entry *__CPROVER_file_local_hash_table_c_s_emplace_item( |
| 26 |
struct hash_table_state *state, |
| 27 |
struct hash_table_entry entry, |
| 28 |
size_t probe_idx) { |
| 29 |
AWS_PRECONDITION(hash_table_state_is_valid(state), "Input hash_table_state [state] must be valid."); |
| 30 |
|
| 31 |
if (entry.hash_code == 0) { |
| 32 |
AWS_POSTCONDITION(hash_table_state_is_valid(state), "Output hash_table_state [state] must be valid."); |
| 33 |
return NULL; |
| 34 |
} |
| 35 |
|
| 36 |
size_t index; |
| 37 |
__CPROVER_assume(index < state->size); |
| 38 |
__CPROVER_assume(state->slots[index].hash_code == 0); |
| 39 |
state->slots[index] = entry; |
| 40 |
size_t empty_slot_idx; |
| 41 |
__CPROVER_assume(hash_table_state_has_an_empty_slot(state, &empty_slot_idx)); |
| 42 |
AWS_POSTCONDITION(hash_table_state_is_valid(state), "Output hash_table_state [state] must be valid."); |
| 43 |
return &state->slots[index]; |
| 44 |
} |