#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 */
size_t hash_with_scan(int, int);
int /*<<< orphan*/ printf(char *);
void hash_open_insert(int table[], int value) {
  int i = 0;
  while (i < 10 && table[hash_with_scan(value, i)] != -2)
    i += 1;
  if (i < 10)
    table[hash_with_scan(value, i)] = value;
  else
    printf("full!!!\n");
}


x86 assembly (clang, -O0):
<hash_open_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jge    1169 <hash_open_insert+0x49>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <hash_with_scan@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmpl   $0xfffffffe,(%rax,%rcx,4)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1179 <hash_open_insert+0x59>
jmp    1187 <hash_open_insert+0x67>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <hash_open_insert+0x16>
cmpl   $0xa,-0x10(%rbp)
jge    11bc <hash_open_insert+0x9c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <hash_with_scan@plt>
mov    -0x2c(%rbp),%edx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %edx,(%rax,%rcx,4)
jmp    11c8 <hash_open_insert+0xa8>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_open_insert>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
xor    %ebp,%ebp
mov    %esi,%edi
xor    %esi,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x1,%ebp
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x2,%ebp
mov    %ebx,%edi
mov    $0x2,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x3,%ebp
mov    %ebx,%edi
mov    $0x3,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x4,%ebp
mov    %ebx,%edi
mov    $0x4,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x5,%ebp
mov    %ebx,%edi
mov    $0x5,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x6,%ebp
mov    %ebx,%edi
mov    $0x6,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x7,%ebp
mov    %ebx,%edi
mov    $0x7,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x8,%ebp
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
je     1223 <hash_open_insert+0x103>
mov    $0x9,%ebp
mov    %ebx,%edi
mov    $0x9,%esi
call   1040 <hash_with_scan@plt>
cmpl   $0xfffffffe,(%r14,%rax,4)
jne    1235 <hash_open_insert+0x115>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <hash_with_scan@plt>
mov    %ebx,(%r14,%rax,4)
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xdc4(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"full!!!\0A\00"
define void @hash_open_insert(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i64 @hash_with_scan(i32 %11, i32 %12)
%14 = getelementptr inbounds i32, i32* %10, i64 %13
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, -2
br label %17
17: ; preds = %9, %6
%18 = phi i1 [ false, %6 ], [ %16, %9 ]
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %17
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %4
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i64 @hash_with_scan(i32 %28, i32 %29)
%31 = getelementptr inbounds i32, i32* %27, i64 %30
store i32 %26, i32* %31
br label %34
32: ; preds = %22
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %32, %25
ret void
}

LLVM IR (-O2):
@str = [8 x i8] c"full!!!\00"
define void @hash_open_insert(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @hash_with_scan(i32 %1, i32 0)
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, -2
br i1 %6, label %54, label %7
7: ; preds = %2
%8 = tail call i64 @hash_with_scan(i32 %1, i32 1)
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -2
br i1 %11, label %54, label %12
12: ; preds = %7
%13 = tail call i64 @hash_with_scan(i32 %1, i32 2)
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, -2
br i1 %16, label %54, label %17
17: ; preds = %12
%18 = tail call i64 @hash_with_scan(i32 %1, i32 3)
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, -2
br i1 %21, label %54, label %22
22: ; preds = %17
%23 = tail call i64 @hash_with_scan(i32 %1, i32 4)
%24 = getelementptr inbounds i32, i32* %0, i64 %23
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, -2
br i1 %26, label %54, label %27
27: ; preds = %22
%28 = tail call i64 @hash_with_scan(i32 %1, i32 5)
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, -2
br i1 %31, label %54, label %32
32: ; preds = %27
%33 = tail call i64 @hash_with_scan(i32 %1, i32 6)
%34 = getelementptr inbounds i32, i32* %0, i64 %33
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, -2
br i1 %36, label %54, label %37
37: ; preds = %32
%38 = tail call i64 @hash_with_scan(i32 %1, i32 7)
%39 = getelementptr inbounds i32, i32* %0, i64 %38
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, -2
br i1 %41, label %54, label %42
42: ; preds = %37
%43 = tail call i64 @hash_with_scan(i32 %1, i32 8)
%44 = getelementptr inbounds i32, i32* %0, i64 %43
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, -2
br i1 %46, label %54, label %47
47: ; preds = %42
%48 = tail call i64 @hash_with_scan(i32 %1, i32 9)
%49 = getelementptr inbounds i32, i32* %0, i64 %48
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, -2
br i1 %51, label %54, label %52
52: ; preds = %47
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %58
54: ; preds = %47, %42, %37, %32, %27, %22, %17, %12, %7, %2
%55 = phi i32 [ 0, %2 ], [ 1, %7 ], [ 2, %12 ], [ 3, %17 ], [ 4, %22 ], [ 5, %27 ], [ 6, %32 ], [ 7, %37 ], [ 8, %42 ], [ 9, %47 ]
%56 = tail call i64 @hash_with_scan(i32 %1, i32 %55)
%57 = getelementptr inbounds i32, i32* %0, i64 %56
store i32 %1, i32* %57
br label %58
58: ; preds = %52, %54
ret void
}