#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 */
typedef int /*<<< orphan*/ path;

/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  char path[1024];
  memset(path, 0x00, sizeof(path));
  if (argc != 1) {
    printUsage();
    return -1;
  }
  getcwd(path, sizeof(path));
  printf("%s\n", path);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
cmpl   $0x1,-0x8(%rbp)
je     1189 <main+0x49>
mov    $0x0,%al
call   1060 <printUsage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b4 <main+0x74>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <getcwd@plt>
lea    -0x410(%rbp),%rsi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebp
mov    %rsp,%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
cmp    $0x1,%ebp
jne    1182 <main+0x42>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
call   1050 <getcwd@plt>
lea    0xe88(%rip),%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
jmp    118e <main+0x4e>
xor    %eax,%eax
call   1060 <printUsage@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 1024)
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @printUsage()
store i32 -1, i32* %3
br label %18
13: ; preds = %2
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = call i32 @getcwd(i8* %14, i32 1024)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 0, i32* %3
br label %18
18: ; preds = %13, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 1024)
%6 = icmp eq i32 %0, 1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 (...) @printUsage()
br label %12
9: ; preds = %2
%10 = call i32 @getcwd(i8* %4, i32 1024)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %12
12: ; preds = %9, %7
%13 = phi i32 [ -1, %7 ], [ 0, %9 ]
ret i32 %13
}