#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 atoi(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned int);
char *makeRandom();
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *, char *, char *);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int size = atoi(argv[1]);
  int i = 0;
  char result[7];
  unsigned int hex;
  FILE *out = fopen("vmsizeOut.txt", "a");
  for (i = 0; i < size; i++) {
    sprintf(result, "%s%s%s%s%s%s%s%s", makeRandom(), makeRandom(),
            makeRandom(), makeRandom(), makeRandom(), makeRandom(),
            makeRandom(), makeRandom());
    hex = (unsigned int)strtol(result, NULL, 16);
    fprintf(out, "%08x\n", hex);
    printf("hex is :%08x\n", hex);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x88,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe58(%rip),%rdi
lea    0xe5f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a6 <main+0x136>
lea    -0x27(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x68(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x58(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,%rbx
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <makeRandom@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    -0x48(%rbp),%r11
mov    -0x40(%rbp),%r10
lea    0xdc7(%rip),%rsi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1090 <sprintf@plt>
lea    -0x27(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1060 <strtol@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xda5(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x2c(%rbp),%esi
lea    0xd8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11bf <main+0x4f>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r12d
lea    0xe6f(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
test   %r12d,%r12d
jle    126d <main+0xfd>
mov    %rax,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,0x20(%rsp)
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1030 <makeRandom@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1030 <makeRandom@plt>
lea    0x9(%rsp),%rdi
lea    0xe01(%rip),%rsi
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x10(%rsp),%r8
mov    %r14,%r9
push   %rax
push   %r13
push   %r15
push   %rbp
call   1090 <sprintf@plt>
add    $0x20,%rsp
lea    0x9(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <strtol@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
lea    0xddb(%rip),%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
lea    0xdc5(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0xffffffff,%r12d
jne    11b0 <main+0x40>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"vmsizeOut.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [17 x i8] c"%s%s%s%s%s%s%s%s\00"
@.str.3 = [6 x i8] c"%08x\0A\00"
@.str.4 = [14 x i8] c"hex is :%08x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [7 x i8]
%9 = alloca i32
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %6
store i32 0, i32* %7
%15 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %10
store i32 0, i32* %7
br label %16
16: ; preds = %39, %2
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %42
20: ; preds = %16
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 0
%22 = call i8* (...) @makeRandom()
%23 = call i8* (...) @makeRandom()
%24 = call i8* (...) @makeRandom()
%25 = call i8* (...) @makeRandom()
%26 = call i8* (...) @makeRandom()
%27 = call i8* (...) @makeRandom()
%28 = call i8* (...) @makeRandom()
%29 = call i8* (...) @makeRandom()
%30 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %22, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28, i8* %29)
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 0
%32 = call i64 @strtol(i8* %31, i32* null, i32 16)
%33 = trunc i64 %32 to i32
store i32 %33, i32* %9
%34 = load i32*, i32** %10
%35 = load i32, i32* %9
%36 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %9
%38 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %20
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %16
42: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"vmsizeOut.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [17 x i8] c"%s%s%s%s%s%s%s%s\00"
@.str.3 = [6 x i8] c"%08x\0A\00"
@.str.4 = [14 x i8] c"hex is :%08x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp sgt i32 %6, 0
br i1 %9, label %10, label %27
10: ; preds = %2, %10
%11 = phi i32 [ %25, %10 ], [ 0, %2 ]
%12 = tail call i8* (...) @makeRandom()
%13 = tail call i8* (...) @makeRandom()
%14 = tail call i8* (...) @makeRandom()
%15 = tail call i8* (...) @makeRandom()
%16 = tail call i8* (...) @makeRandom()
%17 = tail call i8* (...) @makeRandom()
%18 = tail call i8* (...) @makeRandom()
%19 = tail call i8* (...) @makeRandom()
%20 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %13, i8* %14, i8* %15, i8* %16, i8* %17, i8* %18, i8* %19)
%21 = call i64 @strtol(i8* nocapture %7, i32* null, i32 16)
%22 = trunc i64 %21 to i32
%23 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%25 = add nuw nsw i32 %11, 1
%26 = icmp eq i32 %25, %6
br i1 %26, label %27, label %10
27: ; preds = %10, %2
ret i32 0
}