#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ list_curr_dir(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int recurse;
  if (argc < 2) {
    recurse = 0;
  } else {
    if (strcmp(argv[1], "-R")) {
      fprintf(stderr, "Unrecognized option: %s\n", argv[1]);
      return 127;
    }
    recurse = 1;
  }
  list_curr_dir(recurse);
  return 0;
}


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)
jge    115c <main+0x2c>
movl   $0x0,-0x14(%rbp)
jmp    11aa <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11a3 <main+0x73>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    11b9 <main+0x89>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <list_curr_dir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
xor    %ebx,%ebx
mov    $0x0,%edi
cmp    $0x2,%eax
jl     117f <main+0x4f>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117a <main+0x4a>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xe95(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x7f,%ebx
jmp    1184 <main+0x54>
mov    $0x1,%edi
call   1030 <list_curr_dir@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-R\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Unrecognized option: %s\0A\00"
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 slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %6
br label %23
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 127, i32* %3
br label %26
22: ; preds = %10
store i32 1, i32* %6
br label %23
23: ; preds = %22, %9
%24 = load i32, i32* %6
%25 = call i32 @list_curr_dir(i32 %24)
store i32 0, i32* %3
br label %26
26: ; preds = %23, %16
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"-R\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Unrecognized option: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %5
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %16
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ 1, %4 ]
%15 = tail call i32 @list_curr_dir(i32 %14)
br label %16
16: ; preds = %13, %9
%17 = phi i32 [ 0, %13 ], [ 127, %9 ]
ret i32 %17
}