#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*/ printf(char *);
void HashInsert(int T[], int k) {
  int i = 0;
  do {
    int j = (k + i) % 7;
    if (T[j] == -1) {
      T[j] = k;
      return;
    }
    i++;
  } while (i != 7);
  printf("Hash Table Overflow.\n");
}


x86 assembly (clang, -O0):
<HashInsert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    115c <HashInsert+0x4c>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    117b <HashInsert+0x6b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jne    1126 <HashInsert+0x16>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashInsert>:
movslq %esi,%rax
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x1(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x1,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x1,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x2(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x2,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x2,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x3(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x3,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x3,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x4(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x4,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x4,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x5(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x5,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x5,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0x6(%rsi),%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %esi,%eax
add    $0x6,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %esi,%eax
add    $0x6,%eax
cltq
cmpl   $0xffffffff,(%rdi,%rax,4)
je     1297 <HashInsert+0x187>
lea    0xd6e(%rip),%rdi
jmp    1030 <puts@plt>
mov    %esi,(%rdi,%rax,4)
ret

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

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