#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 HashTable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *getString(int);
void *getVal(int);
int /*<<< orphan*/ hashTableSet(struct HashTable *, char *, void *);
void fillHash(struct HashTable *hash, int no) {
  int i = 0;
  void *val;
  char *str;
  for (i = 0; i < no; i++) {
    val = getVal(i);
    str = getString(i);
    hashTableSet(hash, str, val);
    free(str);
  };
}


x86 assembly (clang, -O0):
<fillHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <fillHash+0x69>
mov    -0x10(%rbp),%edi
call   1060 <getVal@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <getString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <hashTableSet@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <fillHash+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillHash>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    1192 <fillHash+0x52>
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
call   1060 <getVal@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   1030 <getString@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
call   1050 <hashTableSet@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1160 <fillHash+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.HashTable = type { i32 }
define void @fillHash(%struct.HashTable* %0, i32 %1) {
%3 = alloca %struct.HashTable*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store %struct.HashTable* %0, %struct.HashTable** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32, i32* %5
%14 = call i8* @getVal(i32 %13)
store i8* %14, i8** %6
%15 = load i32, i32* %5
%16 = call i8* @getString(i32 %15)
store i8* %16, i8** %7
%17 = load %struct.HashTable*, %struct.HashTable** %3
%18 = load i8*, i8** %7
%19 = load i8*, i8** %6
%20 = call i32 @hashTableSet(%struct.HashTable* %17, i8* %18, i8* %19)
%21 = load i8*, i8** %7
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %12
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %8
26: ; preds = %8
ret void
}

LLVM IR (-O2):
%struct.HashTable = type { i32 }
define void @fillHash(%struct.HashTable* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ 0, %2 ]
%6 = tail call i8* @getVal(i32 %5)
%7 = tail call i8* @getString(i32 %5)
%8 = tail call i32 @hashTableSet(%struct.HashTable* %0, i8* %7, i8* %6)
%9 = tail call i32 @free(i8* %7)
%10 = add nuw nsw i32 %5, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}