#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getpid();
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ process_dir(char *);
int main(int argc, char *argv[]) {
  char *dirname = ".";
  if (argc > 1)
    dirname = argv[1];
  printf("DIRECTORY: %s - %d\n", dirname, getpid());
  process_dir(dirname);
  exit(EXIT_SUCCESS);
}


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)
lea    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1177 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <process_dir@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     114c <main+0xc>
mov    0x8(%rsi),%rbx
jmp    1153 <main+0x13>
lea    0xead(%rip),%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <process_dir@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [20 x i8] c"DIRECTORY: %s - %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %13
13: ; preds = %9, %2
%14 = load i8*, i8** %6
%15 = call i32 (...) @getpid()
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %15)
%17 = load i8*, i8** %6
%18 = call i32 @process_dir(i8* %17)
%19 = load i32, i32* @EXIT_SUCCESS
%20 = call i32 @exit(i32 %19)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [20 x i8] c"DIRECTORY: %s - %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %4, %2
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = tail call i32 (...) @getpid()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %9)
%11 = tail call i32 @process_dir(i8* %8)
%12 = load i32, i32* @EXIT_SUCCESS
%13 = tail call i32 @exit(i32 %12)
unreachable
}