#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*/ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ create_file();
int /*<<< orphan*/ create_title();
int /*<<< orphan*/ printf(char *);
int system(char *);
int main(void) {
  int ret;
  create_title();
  if (!access(".git", 0)) {
    ret = system("git log --pretty=%H -10 > .git/gitcommit_top10");
    if (ret == -1)
      printf("/* error: git log cmd system call error! */\n");
  } else
    printf("/* error: .git not exist! */\n");
  create_file();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <create_title@plt>
lea    0xe93(%rip),%rdi
xor    %esi,%esi
call   1060 <access@plt>
cmp    $0x0,%eax
jne    11a7 <main+0x57>
lea    0xe81(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    11a2 <main+0x52>
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
jmp    11b3 <main+0x63>
lea    0xeb3(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <create_file@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <create_title@plt>
lea    0xea1(%rip),%rdi
xor    %esi,%esi
call   1060 <access@plt>
test   %eax,%eax
je     1178 <main+0x28>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
jmp    1189 <main+0x39>
lea    0xe86(%rip),%rdi
call   1050 <system@plt>
cmp    $0xffffffff,%eax
je     1194 <main+0x44>
xor    %eax,%eax
call   1070 <create_file@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe99(%rip),%rdi
jmp    1171 <main+0x21>

LLVM IR (-O0):
@.str = [5 x i8] c".git\00"
@.str.1 = [47 x i8] c"git log --pretty=%H -10 > .git/gitcommit_top10\00"
@.str.2 = [45 x i8] c"/* error: git log cmd system call error! */\0A\00"
@.str.3 = [30 x i8] c"/* error: .git not exist! */\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @create_title()
%4 = call i32 @access(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = icmp ne i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0
%7 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %12
%16 = call i32 (...) @create_file()
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c".git\00"
@.str.1 = [47 x i8] c"git log --pretty=%H -10 > .git/gitcommit_top10\00"
@str = [44 x i8] c"/* error: git log cmd system call error! */\00"
@str.4 = [29 x i8] c"/* error: .git not exist! */\00"
define i32 @main() {
%1 = tail call i32 (...) @create_title()
%2 = tail call i32 @access(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0, %4
%8 = phi i8* [ getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0), %0 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %10
10: ; preds = %7, %4
%11 = tail call i32 (...) @create_file()
ret i32 0
}