#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 *);
int test_chdir();
int test_create();
int test_list();
int test_remove();
int /*<<< orphan*/ wait_enter();
int main(void) {
  int result;
  printf("fatfs_dirent\n"
         "Press Enter to continue...\n");
  wait_enter();
  result = test_create();
  if (result != 0) {
    return result;
  }
  result = test_chdir();
  if (result != 0) {
    return result;
  }
  result = test_list();
  if (result != 0) {
    return result;
  }
  result = test_remove();
  if (result != 0) {
    return result;
  }
  printf("Done.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <wait_enter@plt>
mov    $0x0,%al
call   1080 <test_create@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a1 <main+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <main+0xb1>
mov    $0x0,%al
call   1050 <test_chdir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11c0 <main+0x60>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <main+0xb1>
mov    $0x0,%al
call   1040 <test_list@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11df <main+0x7f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <main+0xb1>
mov    $0x0,%al
call   1070 <test_remove@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11fe <main+0x9e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <main+0xb1>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <wait_enter@plt>
xor    %eax,%eax
call   1080 <test_create@plt>
test   %eax,%eax
je     1181 <main+0x21>
pop    %rcx
ret
xor    %eax,%eax
call   1050 <test_chdir@plt>
test   %eax,%eax
jne    117f <main+0x1f>
xor    %eax,%eax
call   1040 <test_list@plt>
test   %eax,%eax
jne    117f <main+0x1f>
xor    %eax,%eax
call   1070 <test_remove@plt>
test   %eax,%eax
jne    117f <main+0x1f>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"fatfs_dirent\0APress Enter to continue...\0A\00"
@.str.1 = [7 x i8] c"Done.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @wait_enter()
%5 = call i32 (...) @test_create()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = load i32, i32* %2
store i32 %9, i32* %1
br label %30
10: ; preds = %0
%11 = call i32 (...) @test_chdir()
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* %2
store i32 %15, i32* %1
br label %30
16: ; preds = %10
%17 = call i32 (...) @test_list()
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32, i32* %2
store i32 %21, i32* %1
br label %30
22: ; preds = %16
%23 = call i32 (...) @test_remove()
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %2
store i32 %27, i32* %1
br label %30
28: ; preds = %22
%29 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %30
30: ; preds = %28, %26, %20, %14, %8
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@str = [40 x i8] c"fatfs_dirent\0APress Enter to continue...\00"
@str.2 = [6 x i8] c"Done.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @wait_enter()
%3 = tail call i32 (...) @test_create()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %16
5: ; preds = %0
%6 = tail call i32 (...) @test_chdir()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = tail call i32 (...) @test_list()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = tail call i32 (...) @test_remove()
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0))
br label %16
16: ; preds = %11, %8, %5, %0, %14
%17 = phi i32 [ 0, %14 ], [ %3, %0 ], [ %6, %5 ], [ %9, %8 ], [ %12, %11 ]
ret i32 %17
}