#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct hasht {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ hasht_insert(struct hasht *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
size_t hasht_size(struct hasht *);
int /*<<< orphan*/ strdup(char *);
int /*<<< orphan*/ test_hasht_used(struct hasht *, int);
void test_hasht_resize(struct hasht *t, size_t size) {
  hasht_insert(t, strdup("one"), strdup("1"));
  hasht_insert(t, strdup("two"), strdup("2"));
  assert(hasht_size(t) == size * 2);
  test_hasht_used(t, 4);
}


x86 assembly (clang, -O0):
<test_hasht_resize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe91(%rip),%rdi
call   1070 <strdup@plt>
mov    %eax,-0x24(%rbp)
lea    0xe86(%rip),%rdi
call   1070 <strdup@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1060 <hasht_insert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe66(%rip),%rdi
call   1070 <strdup@plt>
mov    %eax,-0x14(%rbp)
lea    0xe5b(%rip),%rdi
call   1070 <strdup@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1060 <hasht_insert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <hasht_size@plt>
mov    -0x10(%rbp),%rcx
shl    $0x1,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1040 <test_hasht_used@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hasht_resize>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9f(%rip),%rdi
call   1070 <strdup@plt>
mov    %eax,%ebp
lea    0xe95(%rip),%rdi
call   1070 <strdup@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <hasht_insert@plt>
lea    0xe7f(%rip),%rdi
call   1070 <strdup@plt>
mov    %eax,%ebp
lea    0xe75(%rip),%rdi
call   1070 <strdup@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <hasht_insert@plt>
mov    %rbx,%rdi
call   1030 <hasht_size@plt>
add    %r14,%r14
xor    %edi,%edi
cmp    %r14,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <test_hasht_used@plt>

LLVM IR (-O0):
%struct.hasht = type { i32 }
@.str = [4 x i8] c"one\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [4 x i8] c"two\00"
@.str.3 = [2 x i8] c"2\00"
define void @test_hasht_resize(%struct.hasht* %0, i64 %1) {
%3 = alloca %struct.hasht*
%4 = alloca i64
store %struct.hasht* %0, %struct.hasht** %3
store i64 %1, i64* %4
%5 = load %struct.hasht*, %struct.hasht** %3
%6 = call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @hasht_insert(%struct.hasht* %5, i32 %6, i32 %7)
%9 = load %struct.hasht*, %struct.hasht** %3
%10 = call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @hasht_insert(%struct.hasht* %9, i32 %10, i32 %11)
%13 = load %struct.hasht*, %struct.hasht** %3
%14 = call i64 @hasht_size(%struct.hasht* %13)
%15 = load i64, i64* %4
%16 = mul i64 %15, 2
%17 = icmp eq i64 %14, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.hasht*, %struct.hasht** %3
%21 = call i32 @test_hasht_used(%struct.hasht* %20, i32 4)
ret void
}

LLVM IR (-O2):
%struct.hasht = type { i32 }
@.str = [4 x i8] c"one\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [4 x i8] c"two\00"
@.str.3 = [2 x i8] c"2\00"
define void @test_hasht_resize(%struct.hasht* %0, i64 %1) {
%3 = tail call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @hasht_insert(%struct.hasht* %0, i32 %3, i32 %4)
%6 = tail call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @hasht_insert(%struct.hasht* %0, i32 %6, i32 %7)
%9 = tail call i64 @hasht_size(%struct.hasht* %0)
%10 = shl i64 %1, 1
%11 = icmp eq i64 %9, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @test_hasht_used(%struct.hasht* %0, i32 4)
ret void
}