#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*/ hashtable_add(int);
int hashtable_get(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int coolint[10] = {1, 3, 4, 9, 19, 21, 22, 2, 29, 111};
  int target = 5;
  int i;
  for (i = 0; i < 10; i++) {
    if (hashtable_get(coolint[i]) != -1) {
      printf("%d, %d", target - coolint[i], coolint[i]);
    } else {
      hashtable_add(target - coolint[i]);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
movl   $0x5,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11d9 <main+0x99>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1050 <hashtable_get@plt>
cmp    $0xffffffff,%eax
je     11b6 <main+0x76>
mov    -0x34(%rbp),%esi
movslq -0x38(%rbp),%rax
sub    -0x30(%rbp,%rax,4),%esi
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
jmp    11c6 <main+0x86>
mov    -0x34(%rbp),%edi
movslq -0x38(%rbp),%rax
sub    -0x30(%rbp,%rax,4),%edi
call   1030 <hashtable_add@plt>
jmp    11cb <main+0x8b>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1172 <main+0x32>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xec0(%rip),%r15
lea    0xee1(%rip),%r14
jmp    1161 <main+0x31>
nopl   0x0(%rax)
mov    %esi,%edi
call   1030 <hashtable_add@plt>
add    $0x4,%rbx
cmp    $0x28,%rbx
je     1184 <main+0x54>
mov    (%rbx,%r15,1),%ebp
mov    %ebp,%edi
call   1050 <hashtable_get@plt>
mov    $0x5,%esi
sub    %ebp,%esi
cmp    $0xffffffff,%eax
je     1150 <main+0x20>
mov    %r14,%rdi
mov    %ebp,%edx
call   1040 <printf@plt>
jmp    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.coolint = [10 x i32] [i32 1, i32 3, i32 4, i32 9, i32 19, i32 21, i32 22, i32 2, i32 29, i32 111]
@.str = [7 x i8] c"%d, %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
store i32 5, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %40
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @hashtable_get(i32 %13)
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %28
16: ; preds = %9
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = sub nsw i32 %17, %21
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %26)
br label %36
28: ; preds = %9
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = sub nsw i32 %29, %33
%35 = call i32 @hashtable_add(i32 %34)
br label %36
36: ; preds = %28, %16
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %6
40: ; preds = %6
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@__const.main.coolint = [10 x i32] [i32 1, i32 3, i32 4, i32 9, i32 19, i32 21, i32 22, i32 2, i32 29, i32 111]
@.str = [7 x i8] c"%d, %d\00"
define i32 @main() {
br label %1
1: ; preds = %0, %12
%2 = phi i64 [ 0, %0 ], [ %13, %12 ]
%3 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.coolint, i64 0, i64 %2
%4 = load i32, i32* %3
%5 = tail call i32 @hashtable_get(i32 %4)
%6 = icmp eq i32 %5, -1
%7 = sub nsw i32 5, %4
br i1 %6, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %4)
br label %12
10: ; preds = %1
%11 = tail call i32 @hashtable_add(i32 %7)
br label %12
12: ; preds = %8, %10
%13 = add nuw nsw i64 %2, 1
%14 = icmp eq i64 %13, 10
br i1 %14, label %15, label %1
15: ; preds = %12
ret i32 0
}