#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ putchar(int);
int rand();
int main(int argc, char **argv) {
  int i;
  if (argc != 2)
    exit(-1);
  for (i = 0; i < atoi(argv[1]); i++) {
    putchar(0);
    putchar(0);
    putchar(0);
    putchar(rand() & 0xff);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116a <main+0x2a>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11c8 <main+0x88>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,%edi
and    $0xff,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x31>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    119d <main+0x5d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
jle    1194 <main+0x54>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <rand@plt>
movzbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x8(%rbx),%rdi
call   1040 <atoi@plt>
cmp    %eax,%ebp
jl     1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
store i32 0, i32* %6
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
%18 = icmp slt i32 %13, %17
br i1 %18, label %19, label %29
19: ; preds = %12
%20 = call i32 @putchar(i32 0)
%21 = call i32 @putchar(i32 0)
%22 = call i32 @putchar(i32 0)
%23 = call i32 (...) @rand()
%24 = and i32 %23, 255
%25 = call i32 @putchar(i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %12
29: ; preds = %12
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %11, label %23
9: ; preds = %2
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %4, %11
%12 = phi i32 [ %19, %11 ], [ 0, %4 ]
%13 = tail call i32 @putchar(i32 0)
%14 = tail call i32 @putchar(i32 0)
%15 = tail call i32 @putchar(i32 0)
%16 = tail call i32 (...) @rand()
%17 = and i32 %16, 255
%18 = tail call i32 @putchar(i32 %17)
%19 = add nuw nsw i32 %12, 1
%20 = load i8*, i8** %5
%21 = tail call i32 @atoi(i8* %20)
%22 = icmp slt i32 %19, %21
br i1 %22, label %11, label %23
23: ; preds = %11, %4
ret i32 0
}