#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*/ fname;

/* Variables and functions */
int /*<<< orphan*/ hexstr(void *, int, char *);
int /*<<< orphan*/ makefile(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
unsigned long trandom();
void mkfilecheck(int argc, char **argv) {
  char storepath[] = "tmp/2014/06/27/";
  char storename[1024];
  unsigned long fname = trandom();
  char filename[128];
  for (int i = 0; i <= 10; i++) {
    fname++;
    hexstr((void *)&fname, sizeof(fname), filename);
    sprintf(storename, "%s%s", storepath, filename);
    makefile(storename);
    printf("make file %s\n", storename);
  }
}


x86 assembly (clang, -O0):
<mkfilecheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <trandom@plt>
mov    %rax,-0x428(%rbp)
movl   $0x0,-0x4b4(%rbp)
cmpl   $0xa,-0x4b4(%rbp)
jg     1218 <mkfilecheck+0xc8>
mov    -0x428(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x428(%rbp)
lea    -0x428(%rbp),%rdi
lea    -0x4b0(%rbp),%rdx
mov    $0x8,%esi
call   1070 <hexstr@plt>
lea    -0x420(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x4b0(%rbp),%rcx
lea    0xe30(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1050 <makefile@plt>
lea    -0x420(%rbp),%rsi
lea    0xe16(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4b4(%rbp)
jmp    1190 <mkfilecheck+0x40>
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfilecheck>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4a8,%rsp
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <trandom@plt>
mov    $0xa,%r14d
lea    0x20(%rsp),%r12
lea    0xe8a(%rip),%r15
lea    0xa0(%rsp),%rbx
lea    0x10(%rsp),%r13
lea    0xe7b(%rip),%rbp
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x8,%esi
mov    %r12,%rdx
call   1070 <hexstr@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <makefile@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
sub    $0x1,%r14d
jb     11ec <mkfilecheck+0x9c>
mov    0x8(%rsp),%rax
jmp    11a0 <mkfilecheck+0x50>
add    $0x4a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.mkfilecheck.storepath = [16 x i8] c"tmp/2014/06/27/\00"
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [14 x i8] c"make file %s\0A\00"
define void @mkfilecheck(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [16 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i64
%8 = alloca [128 x i8]
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = bitcast [16 x i8]* %5 to i8*
%11 = call i64 (...) @trandom()
store i64 %11, i64* %7
store i32 0, i32* %9
br label %12
12: ; preds = %29, %2
%13 = load i32, i32* %9
%14 = icmp sle i32 %13, 10
br i1 %14, label %15, label %32
15: ; preds = %12
%16 = load i64, i64* %7
%17 = add i64 %16, 1
store i64 %17, i64* %7
%18 = bitcast i64* %7 to i8*
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%20 = call i32 @hexstr(i8* %18, i32 8, i8* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%24 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %23)
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = call i32 @makefile(i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %15
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %12
32: ; preds = %12
ret void
}

LLVM IR (-O2):
@__const.mkfilecheck.storepath = [16 x i8] c"tmp/2014/06/27/\00"
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [14 x i8] c"make file %s\0A\00"
define void @mkfilecheck(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = alloca [1024 x i8]
%5 = alloca i64
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
%10 = tail call i64 (...) @trandom()
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
br label %13
12: ; preds = %13
ret void
13: ; preds = %23, %2
%14 = phi i64 [ %10, %2 ], [ %24, %23 ]
%15 = phi i32 [ 0, %2 ], [ %21, %23 ]
%16 = add i64 %14, 1
store i64 %16, i64* %5
%17 = call i32 @hexstr(i8* %9, i32 8, i8* %11)
%18 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %11)
%19 = call i32 @makefile(i8* %8)
%20 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%21 = add nuw nsw i32 %15, 1
%22 = icmp eq i32 %21, 11
br i1 %22, label %12, label %23
23: ; preds = %13
%24 = load i64, i64* %5
br label %13
}