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

/* Variables and functions */
int /*<<< orphan*/ install(char *, char *);
struct nlist *lookup(char *);
int /*<<< orphan*/ print_nlist(struct nlist *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ undef(char *);
int main(void) {
  struct nlist *np;
  int i, n;
  n = 3;
  for (i = 0; i < n; i++) {
    np = lookup("HASHSIZE");
    print_nlist(np);
    printf("--\n");
    install("HASHSIZE", "101");
    np = lookup("HASHSIZE");
    print_nlist(np);
    printf("--\n");
    undef("HASHSIZE");
    np = lookup("HASHSIZE");
    print_nlist(np);
    printf("==\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1215 <main+0xc5>
lea    0xe80(%rip),%rdi
call   1070 <lookup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <print_nlist@plt>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1060 <install@plt>
lea    0xe48(%rip),%rdi
call   1070 <lookup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <print_nlist@plt>
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
lea    0xe23(%rip),%rdi
call   1040 <undef@plt>
lea    0xe17(%rip),%rdi
call   1070 <lookup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <print_nlist@plt>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
lea    0xe97(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <install@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <undef@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
lea    0xe49(%rip),%r12
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <install@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <undef@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <install@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <undef@plt>
mov    %rbx,%rdi
call   1070 <lookup@plt>
mov    %rax,%rdi
call   1040 <print_nlist@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.nlist = type { i32 }
@.str = [9 x i8] c"HASHSIZE\00"
@.str.1 = [4 x i8] c"--\0A\00"
@.str.2 = [4 x i8] c"101\00"
@.str.3 = [4 x i8] c"==\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.nlist*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %24, %0
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %27
9: ; preds = %5
%10 = call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.nlist* %10, %struct.nlist** %2
%11 = load %struct.nlist*, %struct.nlist** %2
%12 = call i32 @print_nlist(%struct.nlist* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @install(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.nlist* %15, %struct.nlist** %2
%16 = load %struct.nlist*, %struct.nlist** %2
%17 = call i32 @print_nlist(%struct.nlist* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @undef(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%20 = call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.nlist* %20, %struct.nlist** %2
%21 = load %struct.nlist*, %struct.nlist** %2
%22 = call i32 @print_nlist(%struct.nlist* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %9
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %5
27: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
%struct.nlist = type { i32 }
@.str = [9 x i8] c"HASHSIZE\00"
@.str.2 = [4 x i8] c"101\00"
@str.4 = [3 x i8] c"--\00"
@str.5 = [3 x i8] c"==\00"
define i32 @main() {
%1 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_nlist(%struct.nlist* %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @install(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @print_nlist(%struct.nlist* %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%8 = tail call i32 @undef(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @print_nlist(%struct.nlist* %9)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
%12 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @print_nlist(%struct.nlist* %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%15 = tail call i32 @install(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @print_nlist(%struct.nlist* %16)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%19 = tail call i32 @undef(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%20 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 @print_nlist(%struct.nlist* %20)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
%23 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 @print_nlist(%struct.nlist* %23)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%26 = tail call i32 @install(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%27 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%28 = tail call i32 @print_nlist(%struct.nlist* %27)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%30 = tail call i32 @undef(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%31 = tail call %struct.nlist* @lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%32 = tail call i32 @print_nlist(%struct.nlist* %31)
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}