#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 */

/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, int);
int /*<<< orphan*/ free(char *);
scalar_t__ hash_str(char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ ht_assert(int, char *, char *, int);
void ht_test_test_hash_str(void *param) {
  char *buf1 = NULL;
  char *buf2 = NULL;
  int i;
  for (i = 0; i < 40; i++) {
    asprintf(&buf1, "key #%d", i);
    asprintf(&buf2, "key #%d", i);
    ht_assert(hash_str(&buf1, NULL) == hash_str(&buf2, NULL),
              "hash_str(&buf1, NULL) == hash_str(&buf2, NULL)",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/hwp/hwp_utils/refs/heads/master/tests/"
              "common_test.c",
              20);
  }
  free(buf1);
  free(buf2);
}


x86 assembly (clang, -O0):
<ht_test_test_hash_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x28,-0x1c(%rbp)
jge    11e9 <ht_test_test_hash_str+0xa9>
mov    -0x1c(%rbp),%edx
lea    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1050 <asprintf@plt>
mov    -0x1c(%rbp),%edx
lea    -0x18(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1050 <asprintf@plt>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <hash_str@plt>
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <hash_str@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe3e(%rip),%rsi
lea    0xe66(%rip),%rdx
mov    $0x14,%ecx
call   1060 <ht_assert@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <ht_test_test_hash_str+0x23>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht_test_test_hash_str>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
xor    %ebx,%ebx
lea    0xe97(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xebd(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <asprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <asprintf@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <hash_str@plt>
mov    %rax,%r13
mov    %r12,%rdi
xor    %esi,%esi
call   1040 <hash_str@plt>
xor    %edi,%edi
cmp    %rax,%r13
sete   %dil
lea    0xe47(%rip),%rsi
mov    %rbp,%rdx
mov    $0x14,%ecx
call   1060 <ht_assert@plt>
add    $0x1,%ebx
cmp    $0x28,%ebx
jne    1180 <ht_test_test_hash_str+0x40>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"key #%d\00"
@.str.1 = [47 x i8] c"hash_str(&buf1, NULL) == hash_str(&buf2, NULL)\00"
@.str.2 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hwp/hwp_utils/refs/heads/master/tests/common_test.c\00"
define void @ht_test_test_hash_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 40
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %5
%11 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %5
%13 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i64 @hash_str(i8** %3, i32* null)
%15 = call i64 @hash_str(i8** %4, i32* null)
%16 = icmp eq i64 %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @ht_assert(i32 %17, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0), i32 20)
br label %19
19: ; preds = %9
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = load i8*, i8** %3
%24 = call i32 @free(i8* %23)
%25 = load i8*, i8** %4
%26 = call i32 @free(i8* %25)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"key #%d\00"
@.str.1 = [47 x i8] c"hash_str(&buf1, NULL) == hash_str(&buf2, NULL)\00"
@.str.2 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hwp/hwp_utils/refs/heads/master/tests/common_test.c\00"
define void @ht_test_test_hash_str(i8* nocapture readnone %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
br label %6
6: ; preds = %1, %6
%7 = phi i32 [ 0, %1 ], [ %15, %6 ]
%8 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%10 = call i64 @hash_str(i8** %2, i32* null)
%11 = call i64 @hash_str(i8** %3, i32* null)
%12 = icmp eq i64 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @ht_assert(i32 %13, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0), i32 20)
%15 = add nuw nsw i32 %7, 1
%16 = icmp eq i32 %15, 40
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = load i8*, i8** %2
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %3
%21 = call i32 @free(i8* %20)
ret void
}