xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ get_char2();
int flush_8051() {
  char i = 0;
  while (((*(volatile unsigned long *)(0x80000000 + (0x1140))) & 0x00400000) !=
         0x00400000) {
    get_char2();
    i = 1;
  }
  return i;
}


x86 assembly (clang, -O0):
<flush_8051>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
mov    $0x80001140,%eax
mov    (%rax),%rax
and    $0x400000,%rax
cmp    $0x400000,%rax
je     1146 <flush_8051+0x36>
mov    $0x0,%al
call   1030 <get_char2@plt>
movb   $0x1,-0x1(%rbp)
jmp    111c <flush_8051+0xc>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_8051>:
push   %rbx
mov    $0x80001140,%ebx
xor    %eax,%eax
testq  $0x400000,(%rbx)
jne    1145 <flush_8051+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <get_char2@plt>
testq  $0x400000,(%rbx)
je     1130 <flush_8051+0x20>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @flush_8051() {
%1 = alloca i8
store i8 0, i8* %1
br label %2
2: ; preds = %6, %0
%3 = load volatile i64, i64* inttoptr (i64 2147488064 to i64*)
%4 = and i64 %3, 4194304
%5 = icmp ne i64 %4, 4194304
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (...) @get_char2()
store i8 1, i8* %1
br label %2
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @flush_8051() {
%1 = load volatile i64, i64* inttoptr (i64 2147488064 to i64*)
%2 = and i64 %1, 4194304
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0, %4
%5 = tail call i32 (...) @get_char2()
%6 = load volatile i64, i64* inttoptr (i64 2147488064 to i64*)
%7 = and i64 %6, 4194304
%8 = icmp eq i64 %7, 0
br i1 %8, label %4, label %9
9: ; preds = %4, %0
%10 = phi i32 [ 0, %0 ], [ 1, %4 ]
ret i32 %10
}
int ary_cb_cmpchar(const void *a, const void *b) {
  char x = *(const char *)a, y = *(const char *)b;
  return x > y ? 1 : x < y ? -1 : 0;
}


x86 assembly (clang, -O0):
<ary_cb_cmpchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jle    113b <ary_cb_cmpchar+0x3b>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1152 <ary_cb_cmpchar+0x52>
movsbl -0x11(%rbp),%edx
movsbl -0x12(%rbp),%esi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ary_cb_cmpchar>:
mov    (%rdi),%al
mov    (%rsi),%cl
xor    %edx,%edx
cmp    %cl,%al
setl   %dl
neg    %edx
cmp    %cl,%al
mov    $0x1,%eax
cmovle %edx,%eax
ret

LLVM IR (-O0):
define i32 @ary_cb_cmpchar(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
store i8 %8, i8* %5
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
store i8 %10, i8* %6
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %12, %14
br i1 %15, label %16, label %17
16: ; preds = %2
br label %25
17: ; preds = %2
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = icmp slt i32 %19, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 -1, i32 0
br label %25
25: ; preds = %17, %16
%26 = phi i32 [ 1, %16 ], [ %24, %17 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @ary_cb_cmpchar(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp sgt i8 %3, %4
%6 = icmp slt i8 %3, %4
%7 = sext i1 %6 to i32
%8 = select i1 %5, i32 1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ marshmallow_terminal_output(char const *);
void fatal(const char *str) {
  marshmallow_terminal_output("\nFatal error: ");
  marshmallow_terminal_output(str);
  marshmallow_terminal_output("\nMarshmallow execution is halted.");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <marshmallow_terminal_output@plt>
mov    -0x8(%rbp),%rdi
call   1030 <marshmallow_terminal_output@plt>
lea    0xed7(%rip),%rdi
call   1030 <marshmallow_terminal_output@plt>
jmp    113d <fatal+0x2d>

x86 assembly (clang, -O2):
<fatal>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <marshmallow_terminal_output@plt>
mov    %rbx,%rdi
call   1030 <marshmallow_terminal_output@plt>
lea    0xee0(%rip),%rdi
call   1030 <marshmallow_terminal_output@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1140 <fatal+0x30>

LLVM IR (-O0):
@.str = [15 x i8] c"\0AFatal error: \00"
@.str.1 = [34 x i8] c"\0AMarshmallow execution is halted.\00"
define void @fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @marshmallow_terminal_output(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @marshmallow_terminal_output(i8* %4)
%6 = call i32 @marshmallow_terminal_output(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %1, %7
br label %7
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0AFatal error: \00"
@.str.1 = [34 x i8] c"\0AMarshmallow execution is halted.\00"
define void @fatal(i8* %0) {
%2 = tail call i32 @marshmallow_terminal_output(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @marshmallow_terminal_output(i8* %0)
%4 = tail call i32 @marshmallow_terminal_output(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %1, %5
br label %5
}
int vector() {
#pragma acc loop vector
  for (int i = 0; i < 10; i++) {
  }
  return 1;
}


x86 assembly (clang, -O0):
<vector>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1128 <vector+0x28>
jmp    111a <vector+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <vector+0xb>
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @vector() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret i32 1
}

LLVM IR (-O2):
define i32 @vector() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0x92() {
  Assert_real((isascii(146) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              735, ("isascii should be 0 for 0x92"));
}


x86 assembly (clang, -O0):
<t_isascii_0x92>:
push   %rbp
mov    %rsp,%rbp
mov    $0x92,%edi
call   1030 <isascii@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2df,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x92>:
push   %rax
mov    $0x92,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2df,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0x92\00"
define void @t_isascii_0x92() {
%1 = call i64 @isascii(i32 146)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 735, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0x92\00"
define void @t_isascii_0x92() {
%1 = tail call i64 @isascii(i32 146)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 735, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strlen(const char *str) {
  int n;
  for (n = 0; *str; ++str)
    ++n;
  return n;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1136 <strlen+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @strlen(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 i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void send_data(uint8_t *buffer, int size) {}


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

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

LLVM IR (-O0):
define void @send_data(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @send_data(i32* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void doo() { printf("Hello from second lib\n"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"Hello from second lib\0A\00"
define void @doo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"Hello from second lib\00"
define void @doo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fn1();
int /*<<< orphan*/ fn2();
int main() {
  fn1();
  fn2();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fn1@plt>
mov    $0x0,%al
call   1040 <fn2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <fn1@plt>
xor    %eax,%eax
call   1040 <fn2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @fn1()
%3 = call i32 (...) @fn2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fn1()
%2 = tail call i32 (...) @fn2()
ret i32 0
}
/* Variables and functions */
int partition(int, int, int *, int);
void sort(int *ar, int start, int end, int ar_size) {
  if (start < end) {
    int s = partition(start, end, ar, ar_size);
    sort(ar, start, s, ar_size);
    sort(ar, s + 1, end, ar_size);
  }
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117d <sort+0x5d>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <partition@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    %edx,%esi
jge    116b <sort+0x4b>
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%r12
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r12,%rdx
mov    %r14d,%ecx
call   1030 <partition@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %ebx,%esi
mov    %eax,%edx
mov    %r14d,%ecx
call   1040 <sort@plt>
add    $0x1,%ebp
mov    %ebp,%ebx
cmp    %r15d,%ebp
jl     1140 <sort+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @sort(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %1, %2
br i1 %5, label %6, label %11
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %1, %4 ]
%8 = tail call i32 @partition(i32 %7, i32 %2, i32* %0, i32 %3)
tail call void @sort(i32* %0, i32 %7, i32 %8, i32 %3)
%9 = add nsw i32 %8, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %6, label %11
11: ; preds = %6, %4
ret void
}
/* Variables and functions */
long long gcd(long long, long long);
long long lcm(long long a1, long long a2) { return a1 / gcd(a1, a2) * a2; }


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cqto
idiv   %rcx
imul   -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <gcd@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1135 <lcm+0x25>
mov    %rbx,%rax
cqto
idiv   %rcx
jmp    113b <lcm+0x2b>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
imul   %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @lcm(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i64 @gcd(i64 %6, i64 %7)
%9 = sdiv i64 %5, %8
%10 = load i64, i64* %4
%11 = mul nsw i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @lcm(i64 %0, i64 %1) {
%3 = tail call i64 @gcd(i64 %0, i64 %1)
%4 = sdiv i64 %0, %3
%5 = mul nsw i64 %4, %1
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fgetc(FILE *stream __attribute__((unused))) { return 0; }


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

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

LLVM IR (-O0):
define i32 @fgetc(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @fgetc(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int giveNum();
int main(int argc, const char *argv[]) {
  int out;
  out = giveNum();
  return out;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <giveNum@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @giveNum()
store i32 %7, i32* %6
%8 = load i32, i32* %6
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @giveNum()
ret i32 %3
}
RX0I1(r0, r1, x0, x1, p0, p1) char r0, r1;
char *p0, *p1;
{ (p0[x0]) = 33; }


x86 assembly (clang, -O0):
<RX0I1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x21,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RX0I1>:
movslq %edx,%rax
movb   $0x21,(%r8,%rax,1)
ret

LLVM IR (-O0):
define i32 @RX0I1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i8*, i8** %12
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 33, i8* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @RX0I1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture writeonly %4, i8* nocapture readnone %5) {
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 33, i8* %8
ret i32 undef
}
void stepRight() {}


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

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

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

LLVM IR (-O2):
define void @stepRight() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int get_tcr();
int /*<<< orphan*/ set_tcr(int);
__attribute__((unused)) void set_fit_period(uint8_t p) {
  set_tcr(get_tcr() | ((p & (0x3)) << (24)));
}


x86 assembly (clang, -O0):
<set_fit_period>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <get_tcr@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%eax
and    $0x3,%eax
shl    $0x18,%eax
or     %eax,%edi
call   1040 <set_tcr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_fit_period>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <get_tcr@plt>
and    $0x3,%ebx
shl    $0x18,%ebx
or     %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <set_tcr@plt>

LLVM IR (-O0):
define void @set_fit_period(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @get_tcr()
%4 = load i32, i32* %2
%5 = and i32 %4, 3
%6 = shl i32 %5, 24
%7 = or i32 %3, %6
%8 = call i32 @set_tcr(i32 %7)
ret void
}

LLVM IR (-O2):
define void @set_fit_period(i32 %0) {
%2 = tail call i32 (...) @get_tcr()
%3 = shl i32 %0, 24
%4 = and i32 %3, 50331648
%5 = or i32 %2, %4
%6 = tail call i32 @set_tcr(i32 %5)
ret void
}
double fgen_bitstring_uint16_to_double(const unsigned char *bitstring,
                                       double domain_min, double domain_max) {
  unsigned int x_int;
  double x;
  x_int = *(unsigned short int *)&bitstring[0];
  x = domain_min + (domain_max - domain_min) * x_int / (double)65536;
  return x;
}


x86 assembly (clang, -O0):
<fgen_bitstring_uint16_to_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  %xmm0,%xmm1
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xec2(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgen_bitstring_uint16_to_double>:
movzwl (%rdi),%eax
subsd  %xmm0,%xmm1
cvtsi2sd %eax,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xee9(%rip),%xmm2
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @fgen_bitstring_uint16_to_double(i8* %0, double %1, double %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store i8* %0, i8** %4
store double %1, double* %5
store double %2, double* %6
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = bitcast i8* %10 to i16*
%12 = load i16, i16* %11
%13 = zext i16 %12 to i32
store i32 %13, i32* %7
%14 = load double, double* %5
%15 = load double, double* %6
%16 = load double, double* %5
%17 = fsub double %15, %16
%18 = load i32, i32* %7
%19 = uitofp i32 %18 to double
%20 = fmul double %17, %19
%21 = fdiv double %20, 6.553600e+04
%22 = fadd double %14, %21
store double %22, double* %8
%23 = load double, double* %8
ret double %23
}

LLVM IR (-O2):
define double @fgen_bitstring_uint16_to_double(i8* nocapture %0, double %1, double %2) {
%4 = bitcast i8* %0 to i16*
%5 = load i16, i16* %4
%6 = fsub double %2, %1
%7 = uitofp i16 %5 to double
%8 = fmul double %6, %7
%9 = fmul double %8, 0x3EF0000000000000
%10 = fadd double %9, %1
ret double %10
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_file;

/* Variables and functions */
int wrap_SectorSize(sqlite3_file *pFile) { return 0; }


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

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

LLVM IR (-O0):
define i32 @wrap_SectorSize(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @wrap_SectorSize(i32* nocapture readnone %0) {
ret i32 0
}
unsigned long djb2_hash(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = *str++) != 0)
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<djb2_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <djb2_hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <djb2_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<djb2_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <djb2_hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <djb2_hash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i64 @djb2_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 5381, i64* %3
br label %5
5: ; preds = %11, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %5
%12 = load i64, i64* %3
%13 = shl i64 %12, 5
%14 = load i64, i64* %3
%15 = add i64 %13, %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = add i64 %15, %17
store i64 %18, i64* %3
br label %5
19: ; preds = %5
%20 = load i64, i64* %3
ret i64 %20
}

LLVM IR (-O2):
define i64 @djb2_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
void check_memory_gf_replay_c(void) {}


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

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

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

LLVM IR (-O2):
define void @check_memory_gf_replay_c() {
ret void
}
unsigned long btoll(unsigned long big) {
  int c = 0;
  union {
    unsigned long big;
    char bytes[sizeof(unsigned long)];
  } swapper_big;
  union {
    char bytes[sizeof(unsigned long)];
    unsigned long little;
  } swapper_little;
  swapper_big.big = big;
  for (c = 0; c < sizeof(unsigned long); c++)
    swapper_little.bytes[c] = swapper_big.bytes[sizeof(unsigned long) - c - 1];
  return (swapper_little.little);
}


x86 assembly (clang, -O0):
<btoll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x8,%rax
jae    1156 <btoll+0x56>
movslq -0xc(%rbp),%rcx
mov    $0x8,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    -0x18(%rbp,%rax,1),%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111e <btoll+0x1e>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i64 }
%union.anon.0 = type { i64 }
define i64 @btoll(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca %union.anon
%5 = alloca %union.anon.0
store i64 %0, i64* %2
store i32 0, i32* %3
%6 = load i64, i64* %2
%7 = bitcast %union.anon* %4 to i64*
store i64 %6, i64* %7
store i32 0, i32* %3
br label %8
8: ; preds = %24, %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 8
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = bitcast %union.anon* %4 to [8 x i8]*
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = sub i64 8, %15
%17 = sub i64 %16, 1
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = bitcast %union.anon.0* %5 to [8 x i8]*
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %20, i64 0, i64 %22
store i8 %19, i8* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = bitcast %union.anon.0* %5 to i64*
%29 = load i64, i64* %28
ret i64 %29
}

LLVM IR (-O2):
define i64 @btoll(i64 %0) {
%2 = call i64 @llvm.bswap.i64(i64 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ motor(int /*<<< orphan*/, int);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ off(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void motorInit() {
  motor(0, 100);
  msleep(7000);
  off(0);
  printf("Motor initialized!\n");
}


x86 assembly (clang, -O0):
<motorInit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1b58,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
call   1040 <off@plt>
lea    0xe98(%rip),%rdi
call   1060 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<motorInit>:
push   %rax
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1b58,%edi
call   1060 <msleep@plt>
xor    %edi,%edi
call   1050 <off@plt>
lea    0xe9b(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Motor initialized!\0A\00"
define void @motorInit() {
%1 = call i32 @motor(i32 0, i32 100)
%2 = call i32 @msleep(i32 7000)
%3 = call i32 @off(i32 0)
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Motor initialized!\00"
define void @motorInit() {
%1 = tail call i32 @motor(i32 0, i32 100)
%2 = tail call i32 @msleep(i32 7000)
%3 = tail call i32 @off(i32 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct comp {
  int dummy;
};
struct BrzNullAdapt_ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SEND_REQDOWN(int /*<<< orphan*/);
void BrzNullAdapt_ackup(struct comp *comp, int port) {
  struct BrzNullAdapt_ *c = (struct BrzNullAdapt_ *)comp;
  SEND_REQDOWN(0);
}


x86 assembly (clang, -O0):
<BrzNullAdapt_ackup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <SEND_REQDOWN@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzNullAdapt_ = type { i32 }
define void @BrzNullAdapt_ackup(%struct.comp* %0, i32 %1) {
%3 = alloca %struct.comp*
%4 = alloca i32
%5 = alloca %struct.BrzNullAdapt_*
store %struct.comp* %0, %struct.comp** %3
store i32 %1, i32* %4
%6 = load %struct.comp*, %struct.comp** %3
%7 = bitcast %struct.comp* %6 to %struct.BrzNullAdapt_*
store %struct.BrzNullAdapt_* %7, %struct.BrzNullAdapt_** %5
%8 = call i32 @SEND_REQDOWN(i32 0)
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzNullAdapt_ackup(%struct.comp* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @SEND_REQDOWN(i32 0)
ret void
}
void syslog_write(int priority, const char *format, ...) {}


x86 assembly (clang, -O0):
<syslog_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @syslog_write(i32 %0, i8* %1, ...) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @syslog_write(i32 %0, i8* nocapture %1, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *, unsigned int, char *);
char *remove_at(char *, unsigned int);
void test_remove_at() {
  char cs[] = "germany";
  unsigned i = 6;
  char *ds = remove_at(cs, i);
  printf("%s, after removal at %u = %s\n", cs, i, ds);
  free(ds);
}


x86 assembly (clang, -O0):
<test_remove_at>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <remove_at@plt>
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_remove_at>:
push   %r14
push   %rbx
push   %rax
movabs $0x796e616d726567,%rax
mov    %rax,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x6,%esi
call   1050 <remove_at@plt>
mov    %rax,%rbx
lea    0xea4(%rip),%rdi
mov    %r14,%rsi
mov    $0x6,%edx
mov    %rax,%rcx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_remove_at.cs = [8 x i8] c"germany\00"
@.str = [30 x i8] c"%s, after removal at %u = %s\0A\00"
define void @test_remove_at() {
%1 = alloca [8 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = bitcast [8 x i8]* %1 to i8*
store i32 6, i32* %2
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i8* @remove_at(i8* %5, i32 %6)
store i8* %7, i8** %3
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s, after removal at %u = %s\0A\00"
define void @test_remove_at() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 34179836909086055, i64* %1
%3 = call i8* @remove_at(i8* %2, i32 6)
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %2, i32 6, i8* %3)
%5 = call i32 @free(i8* %3)
ret void
}
int c40_enkey(c40)
int c40;
{ return (ioctl(c40, (_IO('v', 8)), 0)); }


x86 assembly (clang, -O0):
<c40_enkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x76,%edi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c40_enkey>:
push   %rbx
mov    %edi,%ebx
mov    $0x76,%edi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %edx,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @c40_enkey(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, i32, ...) bitcast (i32 (...)* @_IO to i32 (i32, i32, ...)*)(i32 118, i32 8)
%5 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i32, ...)*)(i32 %3, i32 %4, i32 0)
ret i32 %5
}

LLVM IR (-O2):
define i32 @c40_enkey(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @_IO to i32 (i32, i32, ...)*)(i32 118, i32 8)
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %2, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bswap_64(int /*<<< orphan*/);
uint64_t knot_wire_read_u64(const uint8_t *pos) {
  return bswap_64(*(uint64_t *)pos);
}


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

x86 assembly (clang, -O2):
<knot_wire_read_u64>:
mov    (%rdi),%edi
jmp    1030 <bswap_64@plt>

LLVM IR (-O0):
define i32 @knot_wire_read_u64(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @bswap_64(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @knot_wire_read_u64(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @bswap_64(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ evutil_socket_t;

/* Variables and functions */
void keepAliveCb(evutil_socket_t fd, short flags, void *arg) {}


x86 assembly (clang, -O0):
<keepAliveCb>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @keepAliveCb(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @keepAliveCb(i32 %0, i16 signext %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int minDistance(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d\n", minDistance(argv[1], argv[2]));
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <minDistance@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @minDistance(i8* %8, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @minDistance(i8* %4, i8* %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
unsigned int performZero() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @performZero() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ipsum_fold(int /*<<< orphan*/);
int /*<<< orphan*/ ipsum_unfolded(void const *, size_t);
uint16_t ipsum(const void *addr, size_t bytes) {
  return ipsum_fold(ipsum_unfolded(addr, bytes));
}


x86 assembly (clang, -O0):
<ipsum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ipsum_unfolded@plt>
mov    %eax,%edi
call   1040 <ipsum_fold@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipsum>:
push   %rax
call   1030 <ipsum_unfolded@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ipsum_fold@plt>

LLVM IR (-O0):
define i32 @ipsum(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @ipsum_unfolded(i8* %5, i64 %6)
%8 = call i32 @ipsum_fold(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @ipsum(i8* %0, i64 %1) {
%3 = tail call i32 @ipsum_unfolded(i8* %0, i64 %1)
%4 = tail call i32 @ipsum_fold(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void test_unequal_initializer() {
  char outhaplo[50] = "outhaplo";
  printf("outhaplo = %s\n", outhaplo);
}


x86 assembly (clang, -O0):
<test_unequal_initializer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x32,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rsi
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unequal_initializer>:
sub    $0x38,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xeed(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.test_unequal_initializer.outhaplo = [50 x i8] c"outhaplo\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [15 x i8] c"outhaplo = %s\0A\00"
define void @test_unequal_initializer() {
%1 = alloca [50 x i8]
%2 = bitcast [50 x i8]* %1 to i8*
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@__const.test_unequal_initializer.outhaplo = [50 x i8] c"outhaplo\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [15 x i8] c"outhaplo = %s\0A\00"
define void @test_unequal_initializer() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int strcasecmp(char *, char *);
char *strrchr(char *, char);
int cmp_ext(char *file, char *ext) {
  char *dot = strrchr(file, '.');
  if (dot == NULL)
    return 1;
  return strcasecmp(dot, ext);
}


x86 assembly (clang, -O0):
<cmp_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <cmp_ext+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1169 <cmp_ext+0x49>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_ext>:
push   %rbx
mov    %rsi,%rbx
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     113f <cmp_ext+0x1f>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcasecmp@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cmp_ext(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i8* @strrchr(i8* %7, i8 signext 46)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %16
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8*, i8** %5
%15 = call i32 @strcasecmp(i8* %13, i8* %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @cmp_ext(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @strcasecmp(i8* %3, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 1, %2 ]
ret i32 %8
}
/* Variables and functions */
int atoi(char const *const);
int toc_internal_split_exchange(const char *const string) {
  return (atoi(string));
}


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

x86 assembly (clang, -O2):
<toc_internal_split_exchange>:
jmp    1030 <atoi@plt>

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

LLVM IR (-O2):
define i32 @toc_internal_split_exchange(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int vfprintf(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
__attribute__((__format__(__printf__, 2, 0))) int
XSUM_vfprintf(FILE *stream, const char *format, va_list ap) {
  return vfprintf(stream, format, ap);
}


x86 assembly (clang, -O0):
<XSUM_vfprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <vfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XSUM_vfprintf>:
jmp    1030 <vfprintf@plt>

LLVM IR (-O0):
define i32 @XSUM_vfprintf(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @vfprintf(i32* %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @XSUM_vfprintf(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @vfprintf(i32* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig(int signum) { printf("Received signal number %d!\n", signum); }


x86 assembly (clang, -O0):
<sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Received signal number %d!\0A\00"
define void @sig(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Received signal number %d!\0A\00"
define void @sig(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void main() {
  const int num = 5;
  char *a[num];
  printf("1.const num 的值：%d\n", num);
  int *p = &num;
  *p = 3;
  printf("2.经由指针改变后，const num 的值：%d\n", num);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x5,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
lea    0xec9(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x5,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"1.const num \E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
@.str.1 = [49 x i8] c"2.\E7\BB\8F\E7\94\B1\E6\8C\87\E9\92\88\E6\94\B9\E5\8F\98\E5\90\8E\EF\BC\8Cconst num \E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32*
store i32 5, i32* %1
%4 = call i8* @llvm.stacksave()
store i8* %4, i8** %2
%5 = alloca i8*, i64 5
%6 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 5)
store i32* %1, i32** %3
%7 = load i32*, i32** %3
store i32 3, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 5)
%9 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"1.const num \E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
@.str.1 = [49 x i8] c"2.\E7\BB\8F\E7\94\B1\E6\8C\87\E9\92\88\E6\94\B9\E5\8F\98\E5\90\8E\EF\BC\8Cconst num \E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 5)
ret void
}