#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 /*<<< orphan*/ foo(char *, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int strtol(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int len = strlen("'a' letter in ");
  char str[len + strlen(argv[0]) + 1];
  int max = -1;
  int sleep = 100;
  strcpy(str, "'a' letter in ");
  strcpy(str + len, argv[0]);
  if (argc > 1)
    max = strtol(argv[1], (char **)0, 0);
  if (argc > 2)
    sleep = strtol(argv[2], (char **)0, 0);
  foo(str, max, sleep);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%edx
mov    %ecx,%eax
mov    %edx,%ecx
lea    0x1(%rax,%rcx,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
movl   $0x64,-0x30(%rbp)
lea    0xe44(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11f8 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1218 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1060 <foo@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xea5(%rip),%r12
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    (%r14),%rdi
call   1040 <strlen@plt>
add    %r13d,%eax
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
movslq %r13d,%rdi
add    %rbx,%rdi
mov    (%r14),%rsi
call   1030 <strcpy@plt>
mov    $0x64,%r12d
mov    $0xffffffff,%r13d
cmp    $0x2,%r15d
jl     11d6 <main+0x96>
mov    0x8(%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,%r13d
cmp    $0x2,%r15d
je     11d6 <main+0x96>
mov    0x10(%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
call   1060 <foo@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"'a' letter in \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @strlen(i8* %15)
%17 = add nsw i32 %12, %16
%18 = add nsw i32 %17, 1
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %7
%21 = alloca i8, i64 %19
store i64 %19, i64* %8
store i32 -1, i32* %9
store i32 100, i32* %10
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %25, i8* %28)
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strtol(i8* %35, i8** null, i32 0)
store i32 %36, i32* %9
br label %37
37: ; preds = %32, %2
%38 = load i32, i32* %4
%39 = icmp sgt i32 %38, 2
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @strtol(i8* %43, i8** null, i32 0)
store i32 %44, i32* %10
br label %45
45: ; preds = %40, %37
%46 = load i32, i32* %9
%47 = load i32, i32* %10
%48 = call i32 @foo(i8* %21, i32 %46, i32 %47)
store i32 0, i32* %3
%49 = load i8*, i8** %7
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [15 x i8] c"'a' letter in \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = tail call i32 @strlen(i8* %4)
%6 = add i32 %3, 1
%7 = add i32 %6, %5
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = sext i32 %3 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8*, i8** %1
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = icmp sgt i32 %0, 1
br i1 %15, label %16, label %25
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strtol(i8* nocapture %18, i8** null, i32 0)
%20 = icmp eq i32 %0, 2
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @strtol(i8* nocapture %23, i8** null, i32 0)
br label %25
25: ; preds = %2, %21, %16
%26 = phi i32 [ %19, %21 ], [ %19, %16 ], [ -1, %2 ]
%27 = phi i32 [ %24, %21 ], [ 100, %16 ], [ 100, %2 ]
%28 = call i32 @foo(i8* %9, i32 %26, i32 %27)
ret i32 0
}