#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
void *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
int /*<<< orphan*/ stderr;
void CreateHashTableFiles() {
  unsigned int i;
  FILE *fp;
  char fname[7];
  void *ZERO_BUCKET;
  ZERO_BUCKET = malloc(64 * sizeof(unsigned int));
  if (ZERO_BUCKET == NULL) {
    perror("Zero_Bucket");
    exit(-1);
  }
  memset(ZERO_BUCKET, 0, 64 * sizeof(unsigned int));
  if (1 > 1) {
    for (i = 0; i < 64; i++)
      fprintf(stderr, "%x\n",
              *(unsigned int *)(ZERO_BUCKET + i * (sizeof(unsigned int))));
    fflush(stderr);
  }
  for (i = 0; i < 16777216; i++) {
    memset(fname, '\0', 4);
    sprintf(fname, "%u.hash", i & 7);
    fp = fopen(fname, "ab+");
    if (fp == NULL) {
      perror("zero file");
      exit(-1);
    }
    fwrite(ZERO_BUCKET, sizeof(unsigned int), 64, fp);
    fclose(fp);
  }
  free(ZERO_BUCKET);
  return;
}


x86 assembly (clang, -O0):
<CreateHashTableFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x100,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c7 <CreateHashTableFiles+0x37>
lea    0xe48(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x1000000,-0x4(%rbp)
jae    1274 <CreateHashTableFiles+0xe4>
lea    -0x17(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
lea    -0x17(%rbp),%rdi
mov    -0x4(%rbp),%edx
and    $0x7,%edx
lea    0xe00(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x17(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1246 <CreateHashTableFiles+0xb6>
lea    0xde1(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x4,%esi
mov    $0x40,%edx
call   10b0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11de <CreateHashTableFiles+0x4e>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateHashTableFiles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x100,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     1267 <CreateHashTableFiles+0xd7>
mov    %rax,%r14
xor    %ebp,%ebp
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    0x1(%rsp),%r13
lea    0xe3e(%rip),%r15
lea    0xe3f(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
mov    %ebp,%edx
and    $0x7,%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   1090 <sprintf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1251 <CreateHashTableFiles+0xc1>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x40,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x1,%ebp
cmp    $0x1000000,%ebp
jne    11e0 <CreateHashTableFiles+0x50>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdc0(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xd92(%rip),%rdi
jmp    1258 <CreateHashTableFiles+0xc8>

LLVM IR (-O0):
@.str = [12 x i8] c"Zero_Bucket\00"
@.str.1 = [8 x i8] c"%u.hash\00"
@.str.2 = [4 x i8] c"ab+\00"
@.str.3 = [10 x i8] c"zero file\00"
@stderr = global i32 0
define void @CreateHashTableFiles() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [7 x i8]
%4 = alloca i8*
%5 = call i8* @malloc(i32 256)
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %0
%12 = load i8*, i8** %4
%13 = call i32 @memset(i8* %12, i8 signext 0, i32 256)
store i32 0, i32* %1
br label %14
14: ; preds = %37, %11
%15 = load i32, i32* %1
%16 = icmp ult i32 %15, 16777216
br i1 %16, label %17, label %40
17: ; preds = %14
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i8 signext 0, i32 4)
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%21 = load i32, i32* %1
%22 = and i32 %21, 7
%23 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %2
%26 = load i32*, i32** %2
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %17
%29 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %17
%32 = load i8*, i8** %4
%33 = load i32*, i32** %2
%34 = call i32 @fwrite(i8* %32, i32 4, i32 64, i32* %33)
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
br label %37
37: ; preds = %31
%38 = load i32, i32* %1
%39 = add i32 %38, 1
store i32 %39, i32* %1
br label %14
40: ; preds = %14
%41 = load i8*, i8** %4
%42 = call i32 @free(i8* %41)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Zero_Bucket\00"
@.str.1 = [8 x i8] c"%u.hash\00"
@.str.2 = [4 x i8] c"ab+\00"
@.str.3 = [10 x i8] c"zero file\00"
@stderr = global i32 0
define void @CreateHashTableFiles() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %0
%9 = tail call i32 @memset(i8* %3, i8 signext 0, i32 256)
br label %10
10: ; preds = %8, %20
%11 = phi i32 [ 0, %8 ], [ %23, %20 ]
%12 = call i32 @memset(i8* %2, i8 signext 0, i32 4)
%13 = and i32 %11, 7
%14 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %10
%21 = call i32 @fwrite(i8* %3, i32 4, i32 64, i32* %15)
%22 = call i32 @fclose(i32* %15)
%23 = add nuw nsw i32 %11, 1
%24 = icmp eq i32 %23, 16777216
br i1 %24, label %25, label %10
25: ; preds = %20
%26 = call i32 @free(i8* %3)
ret void
}