xunge/DecIR huggingface dataset:
glabel(lab) char *lab;
{
  output_string(lab);
  output_label_terminator();
  newline();
}


x86 assembly (clang, -O0):
<glabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <output_string@plt>
mov    $0x0,%al
call   1050 <output_label_terminator@plt>
mov    $0x0,%al
call   1030 <newline@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glabel>:
push   %rax
xor    %eax,%eax
call   1040 <output_string@plt>
xor    %eax,%eax
call   1050 <output_label_terminator@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <newline@plt>

LLVM IR (-O0):
define i32 @glabel(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @output_string to i32 (i8*, ...)*)(i8* %4)
%6 = call i32 (...) @output_label_terminator()
%7 = call i32 (...) @newline()
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @glabel(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @output_string to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (...) @output_label_terminator()
%4 = tail call i32 (...) @newline()
ret i32 undef
}
int wdlen(txt)
char *txt;
{
  int i;
  for (i = 0; *txt && !isspace(*txt++); i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<wdlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     115a <wdlen+0x4a>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    116a <wdlen+0x5a>
jmp    117d <wdlen+0x6d>
jmp    116f <wdlen+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <wdlen+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdlen>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113c <wdlen+0x2c>
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    113e <wdlen+0x2e>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <wdlen+0x10>
jmp    113e <wdlen+0x2e>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @wdlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %20, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
%12 = load i8, i8* %10
%13 = sext i8 %12 to i32
%14 = call i32 @isspace(i32 %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br label %17
17: ; preds = %9, %4
%18 = phi i1 [ false, %4 ], [ %16, %9 ]
br i1 %18, label %19, label %23
19: ; preds = %17
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %4
23: ; preds = %17
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @wdlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %14, %11 ], [ %2, %1 ]
%6 = phi i32 [ %13, %11 ], [ 0, %1 ]
%7 = phi i8* [ %12, %11 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = tail call i32 @isspace(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = add nuw nsw i32 %6, 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %11, %1
%17 = phi i32 [ 0, %1 ], [ %13, %11 ], [ %6, %4 ]
ret i32 %17
}
struct bgp_node *bgp_node_from_rnode(struct route_node *rnode) {
  return (struct bgp_node *)rnode;
}


x86 assembly (clang, -O0):
<bgp_node_from_rnode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgp_node_from_rnode>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.bgp_node = type opaque
%struct.route_node = type opaque
define %struct.bgp_node* @bgp_node_from_rnode(%struct.route_node* %0) {
%2 = alloca %struct.route_node*
store %struct.route_node* %0, %struct.route_node** %2
%3 = load %struct.route_node*, %struct.route_node** %2
%4 = bitcast %struct.route_node* %3 to %struct.bgp_node*
ret %struct.bgp_node* %4
}

LLVM IR (-O2):
%struct.bgp_node = type opaque
%struct.route_node = type opaque
define %struct.bgp_node* @bgp_node_from_rnode(%struct.route_node* readnone %0) {
%2 = bitcast %struct.route_node* %0 to %struct.bgp_node*
ret %struct.bgp_node* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_password(char *str) {
  int i = 0;
  while (str[i]) {
    printf("%c", str[i]);
    i++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_password>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115d <print_password+0x4d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_password+0x13>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_password>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <print_password+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <print_password+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_password(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Open Source SW Project\n");
  printf("first GitHub Tranning\n");
  printf("BumHee We Finish\n");
  printf("2012244010 YooByeongPil");
  printf("2012244055 JoBumHee");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Open Source SW Project\0A\00"
@.str.1 = [23 x i8] c"first GitHub Tranning\0A\00"
@.str.2 = [18 x i8] c"BumHee We Finish\0A\00"
@.str.3 = [24 x i8] c"2012244010 YooByeongPil\00"
@.str.4 = [20 x i8] c"2012244055 JoBumHee\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [24 x i8] c"2012244010 YooByeongPil\00"
@.str.4 = [20 x i8] c"2012244055 JoBumHee\00"
@str = [23 x i8] c"Open Source SW Project\00"
@str.5 = [22 x i8] c"first GitHub Tranning\00"
@str.6 = [17 x i8] c"BumHee We Finish\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}
void *f2(struct s1 *p) { return ((struct t6 *)p); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.s1 = type opaque
%struct.t6 = type opaque
define i8* @f2(%struct.s1* %0) {
%2 = alloca %struct.s1*
store %struct.s1* %0, %struct.s1** %2
%3 = load %struct.s1*, %struct.s1** %2
%4 = bitcast %struct.s1* %3 to %struct.t6*
%5 = bitcast %struct.t6* %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
%struct.s1 = type opaque
define i8* @f2(%struct.s1* readnone %0) {
%2 = bitcast %struct.s1* %0 to i8*
ret i8* %2
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ unix_error(char *);
void Close(int fd) {
  int rc;
  if ((rc == close(fd)) < 0)
    unix_error("Close error");
}


x86 assembly (clang, -O0):
<Close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jge    115d <Close+0x3d>
lea    0xea8(%rip),%rdi
call   1040 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Close>:
jmp    1030 <close@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Close error\00"
define void @Close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = call i32 @close(i32 %5)
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
ret void
}

LLVM IR (-O2):
define void @Close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
void INT_Excep_USB_USBR1(void) {}


x86 assembly (clang, -O0):
<INT_Excep_USB_USBR1>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_Excep_USB_USBR1>:
ret

LLVM IR (-O0):
define void @INT_Excep_USB_USBR1() {
ret void
}

LLVM IR (-O2):
define void @INT_Excep_USB_USBR1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World");
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_int(int);
int main() {
  int i = 1;
  int j = 1;
  j = i++;
  print_int(j);
  print_int(i);
  j = ++i;
  print_int(j);
  print_int(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <print_int@plt>
mov    -0x8(%rbp),%edi
call   1030 <print_int@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <print_int@plt>
mov    -0x8(%rbp),%edi
call   1030 <print_int@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <print_int@plt>
mov    $0x2,%edi
call   1030 <print_int@plt>
mov    $0x3,%edi
call   1030 <print_int@plt>
mov    $0x3,%edi
call   1030 <print_int@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
store i32 %4, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @print_int(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @print_int(i32 %8)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = call i32 @print_int(i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @print_int(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_int(i32 1)
%2 = tail call i32 @print_int(i32 2)
%3 = tail call i32 @print_int(i32 3)
%4 = tail call i32 @print_int(i32 3)
ret i32 0
}
char *rev_w(const char *w) {}


x86 assembly (clang, -O0):
<rev_w>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_w>:
ret

LLVM IR (-O0):
define i8* @rev_w(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %2
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @rev_w(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ clear_input_buff();
char getchar();
scalar_t__ isdigit(char);
int get_int(void) {
  char input[1];
  int i = 0;
  do {
    input[i] = getchar();
    if (isdigit(input[i])) {
      ++i;
    }
  } while (i < 1);
  clear_input_buff();
  return (input[0] - 48);
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x1(%rbp,%rax,1)
movslq -0x8(%rbp),%rax
movsbl -0x1(%rbp,%rax,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1171 <get_int+0x41>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <get_int+0x46>
cmpl   $0x1,-0x8(%rbp)
jl     113f <get_int+0xf>
mov    $0x0,%al
call   1040 <clear_input_buff@plt>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1140 <get_int+0x10>
xor    %eax,%eax
call   1040 <clear_input_buff@plt>
add    $0xffffffd0,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_int() {
%1 = alloca [1 x i8]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %18, %0
%4 = call signext i8 (...) @getchar()
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 %6
store i8 %4, i8* %7
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = call i64 @isdigit(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %3
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 1
br i1 %20, label %3, label %21
21: ; preds = %18
%22 = call i32 (...) @clear_input_buff()
%23 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 48
ret i32 %26
}

LLVM IR (-O2):
define i32 @get_int() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = tail call i64 @isdigit(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = tail call i32 (...) @clear_input_buff()
%7 = sext i8 %2 to i32
%8 = add nsw i32 %7, -48
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void evenODD(int i) {
  if (i % 2 == 0) {
    printf("%d is even.\n", i);
  } else {
    printf("%d is odd.\n", i);
  }
}


x86 assembly (clang, -O0):
<evenODD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <evenODD+0x33>
mov    -0x4(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <evenODD+0x42>
mov    -0x4(%rbp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evenODD>:
mov    %edi,%esi
test   $0x1,%sil
lea    0xee3(%rip),%rax
lea    0xee9(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%d is even.\0A\00"
@.str.1 = [12 x i8] c"%d is odd.\0A\00"
define void @evenODD(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d is even.\0A\00"
@.str.1 = [12 x i8] c"%d is odd.\0A\00"
define void @evenODD(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i32 %0)
ret void
}
int nmultiplier(int num) {
  if (num < 0)
    return 0;
  if (num < 10)
    return 1;
  if (num < 100)
    return 2;
  if (num < 1000)
    return 3;
  return 0;
}


x86 assembly (clang, -O0):
<nmultiplier>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <nmultiplier+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1169 <nmultiplier+0x69>
cmpl   $0xa,-0x8(%rbp)
jge    1133 <nmultiplier+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1169 <nmultiplier+0x69>
cmpl   $0x64,-0x8(%rbp)
jge    1149 <nmultiplier+0x49>
movl   $0x2,-0x4(%rbp)
jmp    1169 <nmultiplier+0x69>
cmpl   $0x3e8,-0x8(%rbp)
jge    1162 <nmultiplier+0x62>
movl   $0x3,-0x4(%rbp)
jmp    1169 <nmultiplier+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmultiplier>:
test   %edi,%edi
js     1127 <nmultiplier+0x27>
mov    $0x1,%eax
cmp    $0xa,%edi
jb     1126 <nmultiplier+0x26>
mov    $0x2,%eax
cmp    $0x64,%edi
jb     1126 <nmultiplier+0x26>
xor    %eax,%eax
cmp    $0x3e8,%edi
setb   %al
lea    (%rax,%rax,2),%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @nmultiplier(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %20
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %20
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 100
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 2, i32* %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 1000
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 3, i32* %2
br label %20
19: ; preds = %15
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %14, %10, %6
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @nmultiplier(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 10
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 100
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 1000
%9 = select i1 %8, i32 3, i32 0
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ %9, %7 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void c1(void) { puts("c1"); }


x86 assembly (clang, -O0):
<c1>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c1>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"c1\00"
define void @c1() {
%1 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"c1\00"
define void @c1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sysbuild_debug(char *, unsigned char);
int host_byte_order() {
  long n = 0x12345678;
  unsigned char *b = (unsigned char *)(&n);
  sysbuild_debug("host_byte_order () - returning 0x%02x\n", b[0]);
  return b[0];
}


x86 assembly (clang, -O0):
<host_byte_order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x12345678,-0x8(%rbp)
12
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xecd(%rip),%rdi
movzbl (%rax),%esi
call   1030 <sysbuild_debug@plt>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_byte_order>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x78,%esi
call   1030 <sysbuild_debug@plt>
mov    $0x78,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"host_byte_order () - returning 0x%02x\0A\00"
define i32 @host_byte_order() {
%1 = alloca i64
%2 = alloca i8*
store i64 305419896, i64* %1
%3 = bitcast i64* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = call i32 @sysbuild_debug(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@.str = [39 x i8] c"host_byte_order () - returning 0x%02x\0A\00"
define i32 @host_byte_order() {
%1 = tail call i32 @sysbuild_debug(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext 120)
ret i32 120
}
int cmain(void) { return 0; }


x86 assembly (clang, -O0):
<cmain>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmain>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @cmain() {
ret i32 0
}

LLVM IR (-O2):
define i32 @cmain() {
ret i32 0
}
void initialize_targets(void) {}


x86 assembly (clang, -O0):
<initialize_targets>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_targets>:
ret

LLVM IR (-O0):
define void @initialize_targets() {
ret void
}

LLVM IR (-O2):
define void @initialize_targets() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ err_exit(char *, int);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
FILE *err_fopen(const char *filename, const char *permits) {
  FILE *rval = fopen(filename, permits);
  if (!rval) {
    char buff[90];
    sprintf(buff, "Couldn't open '%s'\n", filename);
    err_exit(buff, -1);
  }
  return (rval);
}


x86 assembly (clang, -O0):
<err_fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1181 <err_fopen+0x51>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <err_exit@plt>
mov    -0x18(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_fopen>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%r14
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116b <err_fopen+0x3b>
lea    0xeb0(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    $0xffffffff,%esi
call   1030 <err_exit@plt>
mov    %rbx,%rax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Couldn't open '%s'\0A\00"
define i32* @err_fopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [90 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %7, i8* %8)
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = icmp ne i32* %10, null
br i1 %11, label %18, label %12
12: ; preds = %2
%13 = getelementptr inbounds [90 x i8], [90 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [90 x i8], [90 x i8]* %6, i64 0, i64 0
%17 = call i32 @err_exit(i8* %16, i32 -1)
br label %18
18: ; preds = %12, %2
%19 = load i32*, i32** %5
ret i32* %19
}

LLVM IR (-O2):
@.str = [20 x i8] c"Couldn't open '%s'\0A\00"
define noalias i32* @err_fopen(i8* %0, i8* nocapture %1) {
%3 = alloca [90 x i8]
%4 = tail call i32* @fopen(i8* %0, i8* %1)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = getelementptr inbounds [90 x i8], [90 x i8]* %3, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = call i32 @err_exit(i8* %7, i32 -1)
br label %10
10: ; preds = %6, %2
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int partition(int /*<<< orphan*/ *, int, int);
void quicksort(uint32_t a[], int begin, int end) {
  int m;
  if (begin < end) {
    m = partition(a, begin, end);
    quicksort(a, begin, m - 1);
    quicksort(a, m, end);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1171 <quicksort+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1163 <quicksort+0x43>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quicksort@plt>
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = load i32, i32* %6
br label %23
23: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %10
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort(i32* %0, i32 %6, i32 %8)
%9 = icmp slt i32 %7, %2
br i1 %9, label %5, label %10
10: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ mp2vseqdx_get_color(int const *);
uint8_t mp2vseqdx_get_primaries(const uint8_t *p_mp2vseqdx) {
  if (!mp2vseqdx_get_color(p_mp2vseqdx))
    return 1;
  return p_mp2vseqdx[5];
}


x86 assembly (clang, -O0):
<mp2vseqdx_get_primaries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <mp2vseqdx_get_color@plt>
cmp    $0x0,%eax
jne    113a <mp2vseqdx_get_primaries+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1144 <mp2vseqdx_get_primaries+0x34>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vseqdx_get_primaries>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mp2vseqdx_get_color@plt>
test   %eax,%eax
je     1122 <mp2vseqdx_get_primaries+0x12>
mov    0x14(%rbx),%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mp2vseqdx_get_primaries(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i32 @mp2vseqdx_get_color(i32* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 1, i32* %2
br label %12
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 5
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %12
12: ; preds = %8, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @mp2vseqdx_get_primaries(i32* %0) {
%2 = tail call i32 @mp2vseqdx_get_color(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 5
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ 1, %1 ]
ret i32 %8
}
/* Type definitions */
struct xfs_trans {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ xfs_trans_free(struct xfs_trans *);
void zxfs_trans_free(struct xfs_trans *tp) { xfs_trans_free(tp); }


x86 assembly (clang, -O0):
<zxfs_trans_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <xfs_trans_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zxfs_trans_free>:
jmp    1030 <xfs_trans_free@plt>

LLVM IR (-O0):
%struct.xfs_trans = type { i32 }
define void @zxfs_trans_free(%struct.xfs_trans* %0) {
%2 = alloca %struct.xfs_trans*
store %struct.xfs_trans* %0, %struct.xfs_trans** %2
%3 = load %struct.xfs_trans*, %struct.xfs_trans** %2
%4 = call i32 @xfs_trans_free(%struct.xfs_trans* %3)
ret void
}

LLVM IR (-O2):
%struct.xfs_trans = type { i32 }
define void @zxfs_trans_free(%struct.xfs_trans* %0) {
%2 = tail call i32 @xfs_trans_free(%struct.xfs_trans* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
int /*<<< orphan*/ shared();
main() {
  f(1, 1);
  shared();
  f(0, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <f@plt>
mov    $0x0,%al
call   1040 <shared@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <f@plt>
xor    %eax,%eax
call   1040 <shared@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1, i32 1)
%2 = call i32 (...) @shared()
%3 = call i32 @f(i32 0, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1, i32 1)
%2 = tail call i32 (...) @shared()
%3 = tail call i32 @f(i32 0, i32 0)
ret i32 0
}
int libfunc2(void) { return 4; }


x86 assembly (clang, -O0):
<libfunc2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libfunc2>:
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @libfunc2() {
ret i32 4
}

LLVM IR (-O2):
define i32 @libfunc2() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ console_puts(char *);
void kernel(void) {
  console_puts("Kernel ready.\r\n");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<kernel>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <console_puts@plt>
jmp    1120 <kernel+0x10>

x86 assembly (clang, -O2):
<kernel>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <console_puts@plt>
nopl   (%rax)
jmp    1120 <kernel+0x10>

LLVM IR (-O0):
@.str = [16 x i8] c"Kernel ready.\0D\0A\00"
define void @kernel() {
%1 = call i32 @console_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [16 x i8] c"Kernel ready.\0D\0A\00"
define void @kernel() {
%1 = tail call i32 @console_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
void egg_memory_unlock(void) {}


x86 assembly (clang, -O0):
<egg_memory_unlock>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<egg_memory_unlock>:
ret

LLVM IR (-O0):
define void @egg_memory_unlock() {
ret void
}

LLVM IR (-O2):
define void @egg_memory_unlock() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int standard_witness_set_to_system_container(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(47, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<standard_witness_set_to_system_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x2f,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_witness_set_to_system_container>:
mov    $0x2f,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @standard_witness_set_to_system_container() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 47, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @standard_witness_set_to_system_container() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 47, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
int bitcount(int x) {
  int nb = 0;
  unsigned int m = 01;
  while (x != 0) {
    if (x & m) {
      ++nb;
      x &= (x - 1);
    }
    m *= 2;
  }
  return nb;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1151 <bitcount+0x51>
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
je     1143 <bitcount+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <bitcount+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     112c <bitcount+0x2c>
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
and    %edi,%edx
cmp    $0x1,%edx
sbb    %esi,%esi
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
lea    -0x1(%rdi),%edx
or     %esi,%edx
add    %ecx,%ecx
and    %edi,%edx
mov    %edx,%edi
jne    1110 <bitcount+0x10>
ret

LLVM IR (-O0):
define i32 @bitcount(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %20, %1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %2
%19 = and i32 %18, %17
store i32 %19, i32* %2
br label %20
20: ; preds = %13, %8
%21 = load i32, i32* %4
%22 = mul i32 %21, 2
store i32 %22, i32* %4
br label %5
23: ; preds = %5
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %17, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %10, %3 ], [ 1, %1 ]
%5 = phi i32 [ %15, %3 ], [ 0, %1 ]
%6 = phi i32 [ %12, %3 ], [ %0, %1 ]
%7 = and i32 %4, %6
%8 = icmp eq i32 %7, 0
%9 = add nsw i32 %6, -1
%10 = shl i32 %4, 1
%11 = select i1 %8, i32 -1, i32 %9
%12 = and i32 %11, %6
%13 = xor i1 %8, true
%14 = zext i1 %13 to i32
%15 = add nuw nsw i32 %5, %14
%16 = icmp eq i32 %12, 0
br i1 %16, label %17, label %3
17: ; preds = %3, %1
%18 = phi i32 [ 0, %1 ], [ %15, %3 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ zsim_heartbeat();
void zsim_heartbeat_() { zsim_heartbeat(); }


x86 assembly (clang, -O0):
<zsim_heartbeat_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <zsim_heartbeat@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zsim_heartbeat_>:
xor    %eax,%eax
jmp    1030 <zsim_heartbeat@plt>

LLVM IR (-O0):
define void @zsim_heartbeat_() {
%1 = call i32 (...) @zsim_heartbeat()
ret void
}

LLVM IR (-O2):
define void @zsim_heartbeat_() {
%1 = tail call i32 (...) @zsim_heartbeat()
ret void
}
int WIFI_GET_TCMD_MODE(void) { return 16; }


x86 assembly (clang, -O0):
<WIFI_GET_TCMD_MODE>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WIFI_GET_TCMD_MODE>:
mov    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @WIFI_GET_TCMD_MODE() {
ret i32 16
}

LLVM IR (-O2):
define i32 @WIFI_GET_TCMD_MODE() {
ret i32 16
}
int joy_arch_init(void) { return 0; }


x86 assembly (clang, -O0):
<joy_arch_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<joy_arch_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @joy_arch_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @joy_arch_init() {
ret i32 0
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
void sigint(int signo) { printf("pid %d catch sigint!\n", getpid()); }


x86 assembly (clang, -O0):
<sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigint>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"pid %d catch sigint!\0A\00"
define void @sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"pid %d catch sigint!\0A\00"
define void @sigint(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ _wall_Date(int);
uint64_t wall_Date(void) { return _wall_Date(false); }


x86 assembly (clang, -O0):
<wall_Date>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <_wall_Date@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wall_Date>:
xor    %edi,%edi
jmp    1030 <_wall_Date@plt>

LLVM IR (-O0):
define i32 @wall_Date() {
%1 = call i32 @_wall_Date(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @wall_Date() {
%1 = tail call i32 @_wall_Date(i32 0)
ret i32 %1
}
int destroy_test_item(void *item, void *ctx) {
  (void)item;
  (void)ctx;
  return 1;
}


x86 assembly (clang, -O0):
<destroy_test_item>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_test_item>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @destroy_test_item(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
ret i32 1
}

LLVM IR (-O2):
define i32 @destroy_test_item(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ my_putstr_fail(char *);
int exit_func(char *str) {
  my_putstr_fail(str);
  return (-1);
}


x86 assembly (clang, -O0):
<exit_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_putstr_fail@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_func>:
push   %rax
call   1030 <my_putstr_fail@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @exit_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @my_putstr_fail(i8* %3)
ret i32 -1
}

LLVM IR (-O2):
define i32 @exit_func(i8* %0) {
%2 = tail call i32 @my_putstr_fail(i8* %0)
ret i32 -1
}
/* Variables and functions */
int rom_present(char *);
int s3_virge_available() { return rom_present("s3virge.bin"); }


x86 assembly (clang, -O0):
<s3_virge_available>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <rom_present@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<s3_virge_available>:
lea    0xee9(%rip),%rdi
jmp    1030 <rom_present@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"s3virge.bin\00"
define i32 @s3_virge_available() {
%1 = call i32 @rom_present(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"s3virge.bin\00"
define i32 @s3_virge_available() {
%1 = tail call i32 @rom_present(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
long double NAN;
long double erfl(long double x) {
  (void)x;
  return NAN;
}


x86 assembly (clang, -O0):
<erfl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    0x2ee7(%rip),%rax
fldt   (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfl>:
mov    0x2ef1(%rip),%rax
fldt   (%rax)
ret

LLVM IR (-O0):
@NAN = global x86_fp80 0xK00000000000000000000
define x86_fp80 @erfl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* @NAN
ret x86_fp80 %4
}

LLVM IR (-O2):
@NAN = global x86_fp80 0xK00000000000000000000
define x86_fp80 @erfl(x86_fp80 %0) {
%2 = load x86_fp80, x86_fp80* @NAN
ret x86_fp80 %2
}
void dataCpy(void *dest, void *src, int size, int checkNUll) {
  char c;
  int i;
  for (i = 0; i < size; i++) {
    c = *((char *)(dest + i)) = *((char *)(src + i));
    if (c == '\0' && checkNUll == 1) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<dataCpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116d <dataCpy+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
jne    115a <dataCpy+0x5a>
cmpl   $0x1,-0x18(%rbp)
jne    115a <dataCpy+0x5a>
jmp    116d <dataCpy+0x6d>
jmp    115f <dataCpy+0x5f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1119 <dataCpy+0x19>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dataCpy>:
test   %edx,%edx
jle    1136 <dataCpy+0x36>
mov    %edx,%r8d
mov    $0x1,%edx
nopl   0x0(%rax)
cmp    $0x1,%ecx
sete   %r9b
movzbl -0x1(%rsi,%rdx,1),%eax
mov    %al,-0x1(%rdi,%rdx,1)
test   %al,%al
sete   %al
test   %al,%r9b
jne    1136 <dataCpy+0x36>
lea    0x1(%rdx),%rax
cmp    %r8,%rdx
mov    %rax,%rdx
jb     1110 <dataCpy+0x10>
ret

LLVM IR (-O0):
define void @dataCpy(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %10
br label %11
11: ; preds = %33, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = load i8*, i8** %5
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr i8, i8* %21, i64 %23
store i8 %20, i8* %24
store i8 %20, i8* %9
%25 = load i8, i8* %9
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %15
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %28
br label %36
32: ; preds = %28, %15
br label %33
33: ; preds = %32
%34 = load i32, i32* %10
%35 = add nsw i32 %34, 1
store i32 %35, i32* %10
br label %11
36: ; preds = %31, %11
ret void
}

LLVM IR (-O2):
define void @dataCpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %19
6: ; preds = %4
%7 = icmp ne i32 %3, 1
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %9, %6
%10 = phi i64 [ %15, %9 ], [ 0, %6 ]
%11 = getelementptr i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr i8, i8* %0, i64 %10
store i8 %12, i8* %13
%14 = icmp ne i8 %12, 0
%15 = add nuw nsw i64 %10, 1
%16 = or i1 %7, %14
%17 = icmp ult i64 %15, %8
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %9, label %19
19: ; preds = %9, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_getpid;
int /*<<< orphan*/ _real_syscall(int /*<<< orphan*/);
__attribute__((visibility("hidden"))) pid_t _real_getpid(void) {
  return (pid_t)_real_syscall(SYS_getpid);
}


x86 assembly (clang, -O0):
<_real_getpid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%edi
call   1030 <_real_syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_real_getpid>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_real_syscall@plt>

LLVM IR (-O0):
@SYS_getpid = global i32 0
define hidden i32 @_real_getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = call i32 @_real_syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SYS_getpid = global i32 0
define hidden i32 @_real_getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = tail call i32 @_real_syscall(i32 %1)
ret i32 %2
}