#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*/ printf(char *, char);
int main(int argc, char **argv) {
  char secret_text[] =
      "This is a secret string. You should not be able to read this!!!";
  char normal_text[1] = "s";
  char *p1 = normal_text;
  int num = 0;
  int i;
  if (argc > 1) {
    num = atoi(argv[1]);
  } else {
    num = 0;
  }
  for (i = 0; i < num; i++) {
    printf("%c\n", *p1);
    p1++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
mov    0xedf(%rip),%al
mov    %al,-0x51(%rbp)
lea    -0x51(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1192 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x64(%rbp)
jmp    1199 <main+0x69>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11d9 <main+0xa9>
mov    -0x60(%rbp),%rax
lea    0xe8a(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11a0 <main+0x70>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     1186 <main+0x66>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
jle    1186 <main+0x66>
mov    %eax,%r15d
add    $0xffffffff,%r15d
lea    0xeb7(%rip),%rdi
mov    $0x73,%esi
call   1030 <printf@plt>
test   %r15d,%r15d
je     1186 <main+0x66>
xor    %ebx,%ebx
lea    0xe9f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.secret_text = [64 x i8] c"This is a secret string. You should not be able to read this!!!\00"
@__const.main.normal_text = [1 x i8] c"s"
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
%7 = alloca [1 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [64 x i8]* %6 to i8*
%12 = bitcast [1 x i8]* %7 to i8*
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
store i8* %13, i8** %8
store i32 0, i32* %9
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %9
br label %22
21: ; preds = %2
store i32 0, i32* %9
br label %22
22: ; preds = %21, %16
store i32 0, i32* %10
br label %23
23: ; preds = %33, %22
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %36
27: ; preds = %23
%28 = load i8*, i8** %8
%29 = load i8, i8* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %29)
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %8
br label %33
33: ; preds = %27
%34 = load i32, i32* %10
%35 = add nsw i32 %34, 1
store i32 %35, i32* %10
br label %23
36: ; preds = %23
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1 x i8]
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %6
%12 = add nsw i32 %9, -1
%13 = zext i32 %12 to i64
%14 = getelementptr [1 x i8], [1 x i8]* %3, i64 %13, i64 0
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 115)
%16 = icmp eq i8* %4, %14
br i1 %16, label %25, label %17
17: ; preds = %11
%18 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 1
br label %19
19: ; preds = %17, %19
%20 = phi i8* [ %18, %17 ], [ %23, %19 ]
%21 = load i8, i8* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%23 = getelementptr inbounds i8, i8* %20, i64 1
%24 = icmp eq i8* %20, %14
br i1 %24, label %25, label %19
25: ; preds = %19, %11, %2, %6
ret i32 0
}