#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*/ buf;

/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ readFile(char *);
int main(int argc, const char *argv[]) {
  char *filename =
      "/Users/simple/Documents/study/c/study-c/CS02/CS02/config.ini";
  char buf[200];
  getcwd(buf, sizeof(buf));
  printf("current working directory: %s\n", buf);
  debug("你好，测试功能");
  readFile(filename);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0xe0(%rbp),%rdi
mov    $0xc8,%esi
call   1050 <getcwd@plt>
lea    -0xe0(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <debug@plt>
mov    -0x18(%rbp),%rdi
call   1060 <readFile@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1050 <getcwd@plt>
lea    0xede(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <debug@plt>
lea    0xe86(%rip),%rdi
call   1060 <readFile@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [61 x i8] c"/Users/simple/Documents/study/c/study-c/CS02/CS02/config.ini\00"
@.str.1 = [31 x i8] c"current working directory: %s\0A\00"
@.str.2 = [22 x i8] c"\E4\BD\A0\E5\A5\BD\EF\BC\8C\E6\B5\8B\E8\AF\95\E5\8A\9F\E8\83\BD\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [200 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%9 = call i32 @getcwd(i8* %8, i32 200)
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 @debug(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%13 = load i8*, i8** %6
%14 = call i32 @readFile(i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [61 x i8] c"/Users/simple/Documents/study/c/study-c/CS02/CS02/config.ini\00"
@.str.1 = [31 x i8] c"current working directory: %s\0A\00"
@.str.2 = [22 x i8] c"\E4\BD\A0\E5\A5\BD\EF\BC\8C\E6\B5\8B\E8\AF\95\E5\8A\9F\E8\83\BD\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = call i32 @getcwd(i8* %4, i32 200)
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @debug(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @readFile(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
ret i32 0
}