#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*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ show(int /*<<< orphan*/, char *, int);
int strcmp(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  char *dn = argc - 1 > 0 ? argv[1] : (char *)".";
  if (strcmp(dn, ".") != 0) {
    (void)printf("%s", dn);
    if (dn[strlen(dn) - 1] != '/') {
      (void)putchar('/');
    }
    (void)putchar('\n');
  }
  int hide = argc - 2 > 0 ? strcmp(argv[2], "-h") : 1;
  show(0, dn, hide);
  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)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jle    1186 <main+0x36>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1196 <main+0x46>
lea    0xe73(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1196 <main+0x46>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     1205 <main+0xb5>
mov    -0x18(%rbp),%rsi
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     11fb <main+0xab>
mov    $0x2f,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
cmp    $0x0,%eax
jle    1230 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde2(%rip),%rsi
call   1070 <strcmp@plt>
mov    %eax,-0x34(%rbp)
jmp    123d <main+0xed>
mov    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    123d <main+0xed>
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %edi,%edi
call   1060 <show@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x2,%edi
jl     1164 <main+0x14>
mov    0x8(%r14),%rbx
jmp    116b <main+0x1b>
lea    0xe95(%rip),%rbx
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11b2 <main+0x62>
lea    0xe7d(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%rbx,1)
je     11a8 <main+0x58>
mov    $0x2f,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edx
cmp    $0x3,%ebp
jl     11ce <main+0x7e>
mov    0x10(%r14),%rdi
lea    0xe3e(%rip),%rsi
call   1070 <strcmp@plt>
mov    %eax,%edx
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <show@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"-h\00"
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 = %2, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%13 = tail call i32 @strlen(i8* %8)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %8, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 47
br i1 %18, label %21, label %19
19: ; preds = %11
%20 = tail call i32 @putchar(i8 signext 47)
br label %21
21: ; preds = %19, %11
%22 = tail call i32 @putchar(i8 signext 10)
br label %23
23: ; preds = %21, %7
%24 = icmp sgt i32 %0, 2
br i1 %24, label %25, label %29
25: ; preds = %23
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32 @strcmp(i8* dereferenceable(1) %27, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %23, %25
%30 = phi i32 [ %28, %25 ], [ 1, %23 ]
%31 = tail call i32 @show(i32 0, i8* %8, i32 %30)
ret i32 0
}