#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int hash_delete(int *T, int k) {
  int i, j;
  for (i = 0; i != 17; i++) {
    j = (k % 17 + i * 1 + (k % (17 - 1))) % 17;
    if (T[j] == k) {
      T[j] = -65535;
      return (0);
    }
  }
  fprintf(stderr, "can't find %d in hashtable\n", k);
  exit(1);
}


x86 assembly (clang, -O0):
<hash_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x11,-0x10(%rbp)
je     11af <hash_delete+0x8f>
mov    -0xc(%rbp),%eax
mov    $0x11,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
shl    $0x0,%eax
add    %eax,%edx
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
add    %edx,%eax
mov    $0x11,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
jne    119c <hash_delete+0x7c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0xffff0001,(%rax,%rcx,4)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    11a1 <hash_delete+0x81>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <hash_delete+0x16>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe3e(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<hash_delete>:
push   %rax
mov    %esi,%r8d
movslq %esi,%rax
imul   $0x78787879,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rcx
add    %esi,%ecx
mov    %ecx,%esi
shl    $0x4,%esi
add    %ecx,%esi
mov    %eax,%ecx
sub    %esi,%ecx
lea    0xf(%rax),%esi
test   %eax,%eax
cmovns %r8d,%esi
and    $0xfffffff0,%esi
sub    %esi,%eax
add    %ecx,%eax
mov    $0x10,%r9d
nopl   0x0(%rax)
movslq %eax,%rcx
imul   $0x78787879,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rdx
add    %esi,%edx
mov    %edx,%esi
shl    $0x4,%esi
add    %edx,%esi
sub    %esi,%ecx
movslq %ecx,%rsi
cmp    %r8d,(%rdi,%rsi,4)
je     11c3 <hash_delete+0xa3>
test   %r9d,%r9d
je     11ce <hash_delete+0xae>
lea    0x1(%rax),%esi
movslq %esi,%rsi
imul   $0x78787879,%rsi,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rdx
add    %ecx,%edx
mov    %edx,%ecx
shl    $0x4,%ecx
add    %edx,%ecx
sub    %ecx,%esi
movslq %esi,%rsi
cmp    %r8d,(%rdi,%rsi,4)
je     11c3 <hash_delete+0xa3>
add    $0xfffffffe,%r9d
add    $0x2,%eax
jmp    1160 <hash_delete+0x40>
movl   $0xffff0001,(%rdi,%rsi,4)
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
mov    %r8d,%edx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"can't find %d in hashtable\0A\00"
define i32 @hash_delete(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 = %33, %2
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 17
br i1 %9, label %10, label %36
10: ; preds = %7
%11 = load i32, i32* %4
%12 = srem i32 %11, 17
%13 = load i32, i32* %5
%14 = mul nsw i32 %13, 1
%15 = add nsw i32 %12, %14
%16 = load i32, i32* %4
%17 = srem i32 %16, 16
%18 = add nsw i32 %15, %17
%19 = srem i32 %18, 17
store i32 %19, i32* %6
%20 = load i32*, i32** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %4
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %10
%28 = load i32*, i32** %3
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 -65535, i32* %31
ret i32 0
32: ; preds = %10
br label %33
33: ; preds = %32
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %7
36: ; preds = %7
%37 = load i32, i32* @stderr
%38 = load i32, i32* %4
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"can't find %d in hashtable\0A\00"
define i32 @hash_delete(i32* nocapture %0, i32 %1) {
%3 = srem i32 %1, 17
%4 = srem i32 %1, 16
%5 = add nsw i32 %4, %3
br label %17
6: ; preds = %17
%7 = icmp eq i32 %25, 17
br i1 %7, label %29, label %8
8: ; preds = %6
%9 = add nsw i32 %5, %25
%10 = srem i32 %9, 17
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, %1
br i1 %14, label %26, label %15
15: ; preds = %8
%16 = add nuw nsw i32 %18, 2
br label %17
17: ; preds = %15, %2
%18 = phi i32 [ 0, %2 ], [ %16, %15 ]
%19 = add nsw i32 %5, %18
%20 = srem i32 %19, 17
%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
%25 = or i32 %18, 1
br i1 %24, label %26, label %6
26: ; preds = %8, %17
%27 = phi i64 [ %21, %17 ], [ %11, %8 ]
%28 = getelementptr inbounds i32, i32* %0, i64 %27
store i32 -65535, i32* %28
ret i32 0
29: ; preds = %6
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
%32 = tail call i32 @exit(i32 1)
unreachable
}