xunge/DecIR huggingface dataset:
int getpid(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @getpid() {
ret i32 1
}

LLVM IR (-O2):
define i32 @getpid() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getgid();
int getuid();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("组id = %d, 用户id = %d\n", getgid(), getuid());
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getgid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getgid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getuid@plt>
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\E7\BB\84id = %d, \E7\94\A8\E6\88\B7id = %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getgid()
%3 = call i32 (...) @getuid()
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"\E7\BB\84id = %d, \E7\94\A8\E6\88\B7id = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getgid()
%2 = tail call i32 (...) @getuid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ heapSort(void *);
void *threadSort(void *param) {
  heapSort(param);
  return 0;
}


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

x86 assembly (clang, -O2):
<threadSort>:
push   %rax
call   1030 <heapSort@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @threadSort(i8* %0) {
%2 = tail call i32 @heapSort(i8* %0)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ clamp_buf_len(size_t *, size_t *);
int max_lines(size_t, size_t);
size_t hexcdiff_msg_size(size_t expect_buf_len, size_t actual_buf_len) {
  clamp_buf_len(&expect_buf_len, &actual_buf_len);
  return max_lines(expect_buf_len, actual_buf_len) *
             (7 + 16 * 3 + ((int)(16 / 4) - 1) * 2 + 2 + 0 + 16 + 1) * 2 +
         1;
}


x86 assembly (clang, -O0):
<hexcdiff_msg_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <clamp_buf_len@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <max_lines@plt>
imul   $0x50,%eax,%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexcdiff_msg_size>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <clamp_buf_len@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1030 <max_lines@plt>
shl    $0x5,%eax
lea    (%rax,%rax,4),%eax
or     $0x1,%eax
cltq
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i64 @hexcdiff_msg_size(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i32 @clamp_buf_len(i64* %3, i64* %4)
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i32 @max_lines(i64 %6, i64 %7)
%9 = mul nsw i32 %8, 80
%10 = mul nsw i32 %9, 2
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
ret i64 %12
}

LLVM IR (-O2):
define i64 @hexcdiff_msg_size(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i32 @clamp_buf_len(i64* %3, i64* %4)
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i32 @max_lines(i64 %6, i64 %7)
%9 = mul i32 %8, 160
%10 = or i32 %9, 1
%11 = sext i32 %10 to i64
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ digitalWrite(int, int /*<<< orphan*/);
int /*<<< orphan*/ pinMode(int, int);
void initializeIO() {
  digitalWrite(9, 0);
  pinMode(9, 0x01);
}


x86 assembly (clang, -O0):
<initializeIO>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
xor    %esi,%esi
call   1030 <digitalWrite@plt>
mov    $0x9,%edi
mov    $0x1,%esi
call   1040 <pinMode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initializeIO>:
push   %rax
mov    $0x9,%edi
xor    %esi,%esi
call   1030 <digitalWrite@plt>
mov    $0x9,%edi
mov    $0x1,%esi
pop    %rax
jmp    1040 <pinMode@plt>

LLVM IR (-O0):
define void @initializeIO() {
%1 = call i32 @digitalWrite(i32 9, i32 0)
%2 = call i32 @pinMode(i32 9, i32 1)
ret void
}

LLVM IR (-O2):
define void @initializeIO() {
%1 = tail call i32 @digitalWrite(i32 9, i32 0)
%2 = tail call i32 @pinMode(i32 9, i32 1)
ret void
}
unsigned int popcount(unsigned int x) { return __builtin_popcount(x); }


x86 assembly (clang, -O0):
<popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @popcount(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctpop.i32(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @popcount(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fnc(int n, int m) {
  printf(" ");
  int x = n + m;
  n = m - n;
  m = m / 2;
  x = x + n * m;
  printf(" ");
  return x;
}


x86 assembly (clang, -O0):
<fnc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    (%rbx,%r14,1),%eax
mov    %ebx,%ecx
sub    %r14d,%ecx
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
sar    %ebp
imul   %ecx,%ebp
add    %eax,%ebp
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @fnc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %3
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 2
store i32 %14, i32* %4
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = mul nsw i32 %16, %17
%19 = add nsw i32 %15, %18
store i32 %19, i32* %5
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @fnc(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i32 32)
%4 = add nsw i32 %1, %0
%5 = sub nsw i32 %1, %0
%6 = sdiv i32 %1, 2
%7 = mul nsw i32 %5, %6
%8 = add nsw i32 %4, %7
%9 = tail call i32 @putchar(i32 32)
ret i32 %8
}
void fresh_arr_ok(int size) {
  int arr[size];
  for (int i = 0; i < size - 1; i++) {
    arr[i] = 0;
  }
}


x86 assembly (clang, -O0):
<fresh_arr_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1167 <fresh_arr_ok+0x67>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <fresh_arr_ok+0x39>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fresh_arr_ok(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i32, i64 %7
store i64 %7, i64* %4
store i32 0, i32* %5
br label %10
10: ; preds = %19, %1
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %9, i64 %17
store i32 0, i32* %18
br label %19
19: ; preds = %15
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %10
22: ; preds = %10
%23 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @fresh_arr_ok(i32 %0) {
ret void
}
void save() { ; }


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

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

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

LLVM IR (-O2):
define void @save() {
ret void
}
int test_imm_C4int32_mem(int *val) {
  return ((*val) & (0xC4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C4int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0xc4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C4int32_mem>:
testb  $0xc4,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C4int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 196
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_C4int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 196
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int Disassemble(int, unsigned char const *, char *, int);
int z80dis(int addr, const unsigned char *buf, char *out, int len) {
  return Disassemble(addr, buf, out, len);
}


x86 assembly (clang, -O0):
<z80dis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <Disassemble@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z80dis>:
jmp    1030 <Disassemble@plt>

LLVM IR (-O0):
define i32 @z80dis(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @Disassemble(i32 %9, i8* %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @z80dis(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @Disassemble(i32 %0, i8* %1, i8* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print(int *a, int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d\t", a[i]);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <print+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
short test_42_2(short *mem) { return __atomic_sub_fetch(mem + 0, 1, 4); }


x86 assembly (clang, -O0):
<test_42_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
movw   $0x1,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
mov    %ax,%cx
neg    %eax
lock xadd %ax,(%rdx)
sub    %cx,%ax
mov    %ax,-0xc(%rbp)
movswl -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_42_2>:
mov    $0xffff,%ax
lock xadd %ax,(%rdi)
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define signext i16 @test_42_2(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 0
store i16 1, i16* %3
%7 = load i16, i16* %3
%8 = atomicrmw sub i16* %6, i16 %7 acq_rel
%9 = sub i16 %8, %7
store i16 %9, i16* %4
%10 = load i16, i16* %4
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @test_42_2(i16* nocapture %0) {
%2 = atomicrmw sub i16* %0, i16 1 acq_rel
%3 = add i16 %2, -1
ret i16 %3
}
main() {
  int a[2];
  return sizeof(a);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
ret i32 8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
int resize_threshold(int capacity, double max_load_factor) {
  return (int)(((double)capacity * max_load_factor) + 0.5);
}


x86 assembly (clang, -O0):
<resize_threshold>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<resize_threshold>:
cvtsi2sd %edi,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm1
cvttsd2si %xmm1,%eax
ret

LLVM IR (-O0):
define i32 @resize_threshold(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double %6, double %7, double 5.000000e-01)
%9 = fptosi double %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @resize_threshold(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = tail call double @llvm.fmuladd.f64(double %3, double %1, double 5.000000e-01)
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main() {
  char str[] = "Hannah";
  reverse(str);
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xec4(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x7(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x7(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x68616e,0xb(%rsp)
movl   $0x6e6e6148,0x8(%rsp)
6e
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [7 x i8] c"Hannah\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = bitcast [7 x i8]* %1 to i8*
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = call i32 @reverse(i8* %3)
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [7 x i8] c"Hannah\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @reverse(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ vdmnum(int, char *);
int /*<<< orphan*/ vdmprintf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
void vdmsetlinetype(int lintype) {
  char ltyp[4], expfact[4];
  vdmprintf("E1%s%s\x1e", vdmnum(lintype, ltyp), vdmnum(1, expfact));
}


x86 assembly (clang, -O0):
<vdmsetlinetype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <vdmnum@plt>
mov    %eax,-0x10(%rbp)
lea    -0xc(%rbp),%rsi
mov    $0x1,%edi
call   1030 <vdmnum@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xeac(%rip),%rdi
call   1040 <vdmprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vdmsetlinetype>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
call   1030 <vdmnum@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    $0x1,%edi
call   1030 <vdmnum@plt>
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <vdmprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"E1%s%s\1E\00"
define void @vdmsetlinetype(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%7 = call i32 @vdmnum(i32 %5, i8* %6)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%9 = call i32 @vdmnum(i32 1, i8* %8)
%10 = call i32 @vdmprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"E1%s%s\1E\00"
define void @vdmsetlinetype(i32 %0) {
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = call i32 @vdmnum(i32 %0, i8* %4)
%7 = call i32 @vdmnum(i32 1, i8* %5)
%8 = call i32 @vdmprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}
/* Variables and functions */
int platform_chdir(char const *);
scalar_t__ strlen(char const *);
int io_chdir(const char *path) {
  if (strlen(path) == 0)
    path = ".";
  return platform_chdir(path);
}


x86 assembly (clang, -O0):
<io_chdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    114a <io_chdir+0x2a>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <platform_chdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_chdir>:
cmpb   $0x0,(%rdi)
lea    0xee6(%rip),%rax
cmove  %rax,%rdi
jmp    1030 <platform_chdir@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define i32 @io_chdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
7: ; preds = %6, %1
%8 = load i8*, i8** %2
%9 = call i32 @platform_chdir(i8* %8)
ret i32 %9
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define i32 @io_chdir(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %0
%5 = tail call i32 @platform_chdir(i8* %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int O_ACCMODE;
int O_RDONLY;
int fcntl(int, int /*<<< orphan*/);
int /*<<< orphan*/ fdatasync(int);
void sync_if_writable(int fd) {
  int r;
  if ((r = fcntl(fd, F_GETFL)) == -1)
    return;
  if ((r & O_ACCMODE) != O_RDONLY)
    fdatasync(fd);
}


x86 assembly (clang, -O0):
<sync_if_writable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
call   1040 <fcntl@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    114d <sync_if_writable+0x2d>
jmp    1170 <sync_if_writable+0x50>
mov    -0x8(%rbp),%eax
mov    0x2e99(%rip),%rcx
and    (%rcx),%eax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
je     1170 <sync_if_writable+0x50>
mov    -0x4(%rbp),%edi
call   1030 <fdatasync@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_if_writable>:
push   %rbx
mov    %edi,%ebx
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
call   1040 <fcntl@plt>
cmp    $0xffffffff,%eax
je     114a <sync_if_writable+0x2a>
mov    0x2eb3(%rip),%rcx
and    (%rcx),%eax
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
jne    114c <sync_if_writable+0x2c>
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1030 <fdatasync@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@O_ACCMODE = global i32 0
@O_RDONLY = global i32 0
define void @sync_if_writable(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 @fcntl(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
br label %18
9: ; preds = %1
%10 = load i32, i32* %3
%11 = load i32, i32* @O_ACCMODE
%12 = and i32 %10, %11
%13 = load i32, i32* @O_RDONLY
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i32, i32* %2
%17 = call i32 @fdatasync(i32 %16)
br label %18
18: ; preds = %8, %15, %9
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@O_ACCMODE = global i32 0
@O_RDONLY = global i32 0
define void @sync_if_writable(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = load i32, i32* @O_ACCMODE
%7 = and i32 %6, %3
%8 = load i32, i32* @O_RDONLY
%9 = icmp eq i32 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = tail call i32 @fdatasync(i32 %0)
br label %12
12: ; preds = %5, %10, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t __le_s16(const void *p) { return *((int16_t *)(p)); }


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

x86 assembly (clang, -O2):
<__le_s16>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @__le_s16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int bar(int i) { return i; }


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

x86 assembly (clang, -O2):
<bar>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @bar(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int inb(int);
int serial_tx_empty(void) { return inb((0x3f8 + 5)) & 0x20; }


x86 assembly (clang, -O0):
<serial_tx_empty>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fd,%edi
call   1030 <inb@plt>
and    $0x20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_tx_empty>:
push   %rax
mov    $0x3fd,%edi
call   1030 <inb@plt>
and    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @serial_tx_empty() {
%1 = call i32 @inb(i32 1021)
%2 = and i32 %1, 32
ret i32 %2
}

LLVM IR (-O2):
define i32 @serial_tx_empty() {
%1 = tail call i32 @inb(i32 1021)
%2 = and i32 %1, 32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ erroFatalMemoria();
void *realloc(void *, size_t);
void *xrealloc(void *m, size_t t) {
  void *p = realloc(m, t);
  if (!p)
    erroFatalMemoria();
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <xrealloc+0x33>
mov    $0x0,%al
call   1030 <erroFatalMemoria@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xrealloc+0x15>
xor    %eax,%eax
call   1030 <erroFatalMemoria@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (...) @erroFatalMemoria()
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @erroFatalMemoria()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
signed char extractchar(unsigned char *buffer, unsigned short *index) {
  char data;
  data = buffer[*index];
  *index += 1;
  if (data & 0x80) {
    data &= 0x7f;
    data *= -1;
  }
  return (data);
}


x86 assembly (clang, -O0):
<extractchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movzwl (%rcx),%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%ecx
add    $0x1,%ecx
mov    %cx,(%rax)
movsbl -0x11(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1150 <extractchar+0x50>
movsbl -0x11(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
imul   $0xffffffff,%eax,%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractchar>:
movzwl (%rsi),%eax
movzbl (%rdi,%rax,1),%ecx
add    $0x1,%eax
mov    %ax,(%rsi)
mov    %ecx,%eax
and    $0x7f,%al
neg    %al
test   %cl,%cl
movzbl %al,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @extractchar(i8* %0, i16* %1) {
%3 = alloca i8*
%4 = alloca i16*
%5 = alloca i8
store i8* %0, i8** %3
store i16* %1, i16** %4
%6 = load i8*, i8** %3
%7 = load i16*, i16** %4
%8 = load i16, i16* %7
%9 = zext i16 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
store i8 %11, i8* %5
%12 = load i16*, i16** %4
%13 = load i16, i16* %12
%14 = zext i16 %13 to i32
%15 = add nsw i32 %14, 1
%16 = trunc i32 %15 to i16
store i16 %16, i16* %12
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = and i32 %18, 128
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %2
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = and i32 %23, 127
%25 = trunc i32 %24 to i8
store i8 %25, i8* %5
%26 = load i8, i8* %5
%27 = sext i8 %26 to i32
%28 = mul nsw i32 %27, -1
%29 = trunc i32 %28 to i8
store i8 %29, i8* %5
br label %30
30: ; preds = %21, %2
%31 = load i8, i8* %5
ret i8 %31
}

LLVM IR (-O2):
define signext i8 @extractchar(i8* nocapture %0, i16* nocapture %1) {
%3 = load i16, i16* %1
%4 = zext i16 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = add i16 %3, 1
store i16 %7, i16* %1
%8 = icmp sgt i8 %6, -1
%9 = and i8 %6, 127
%10 = sub nsw i8 0, %9
%11 = select i1 %8, i8 %6, i8 %10
ret i8 %11
}
void empty_fpu_stack() {
  asm("ffree %st(1) \n\t"
      "ffree %st(2) \n\t"
      "ffree %st(3) \n\t"
      "ffree %st(4) \n\t"
      "ffree %st(5) \n\t"
      "ffree %st(6) \n\t"
      "ffree %st(7)");
}


x86 assembly (clang, -O0):
<empty_fpu_stack>:
push   %rbp
mov    %rsp,%rbp
ffree  %st(1)
ffree  %st(2)
ffree  %st(3)
ffree  %st(4)
ffree  %st(5)
ffree  %st(6)
ffree  %st(7)
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty_fpu_stack>:
ffree  %st(1)
ffree  %st(2)
ffree  %st(3)
ffree  %st(4)
ffree  %st(5)
ffree  %st(6)
ffree  %st(7)
ret

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

LLVM IR (-O2):
define void @empty_fpu_stack() {
tail call void asm sideeffect "ffree %st(1) \0A\09ffree %st(2) \0A\09ffree %st(3) \0A\09ffree %st(4) \0A\09ffree %st(5) \0A\09ffree %st(6) \0A\09ffree %st(7)", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *string = "The quick brown fox";
  memcpy(&string[4], "slow ", 5);
  printf("%s\n", string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
lea    0xecb(%rip),%rsi
mov    $0x5,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    $0x5,%edx
call   1040 <memcpy@plt>
lea    0xec0(%rip),%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"The quick brown fox\00"
@.str.1 = [6 x i8] c"slow \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 4
%5 = call i32 @memcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"The quick brown fox\00"
@.str.1 = [6 x i8] c"slow \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 @memcpy(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 4), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct t_gui_key {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gui_keyboard_free(struct t_gui_key **, struct t_gui_key **,
                                     struct t_gui_key *);
void gui_keyboard_free_all(struct t_gui_key **keys,
                           struct t_gui_key **last_key) {
  while (*keys) {
    gui_keyboard_free(keys, last_key, *keys);
  }
}


x86 assembly (clang, -O0):
<gui_keyboard_free_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1147 <gui_keyboard_free_all+0x37>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
call   1030 <gui_keyboard_free@plt>
jmp    1120 <gui_keyboard_free_all+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_keyboard_free_all>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rdx
test   %rdx,%rdx
je     1143 <gui_keyboard_free_all+0x33>
mov    %rsi,%r14
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <gui_keyboard_free@plt>
mov    (%rbx),%rdx
test   %rdx,%rdx
jne    1130 <gui_keyboard_free_all+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.t_gui_key = type { i32 }
define void @gui_keyboard_free_all(%struct.t_gui_key** %0, %struct.t_gui_key** %1) {
%3 = alloca %struct.t_gui_key**
%4 = alloca %struct.t_gui_key**
store %struct.t_gui_key** %0, %struct.t_gui_key*** %3
store %struct.t_gui_key** %1, %struct.t_gui_key*** %4
br label %5
5: ; preds = %9, %2
%6 = load %struct.t_gui_key**, %struct.t_gui_key*** %3
%7 = load %struct.t_gui_key*, %struct.t_gui_key** %6
%8 = icmp ne %struct.t_gui_key* %7, null
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load %struct.t_gui_key**, %struct.t_gui_key*** %3
%11 = load %struct.t_gui_key**, %struct.t_gui_key*** %4
%12 = load %struct.t_gui_key**, %struct.t_gui_key*** %3
%13 = load %struct.t_gui_key*, %struct.t_gui_key** %12
%14 = call i32 @gui_keyboard_free(%struct.t_gui_key** %10, %struct.t_gui_key** %11, %struct.t_gui_key* %13)
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.t_gui_key = type { i32 }
define void @gui_keyboard_free_all(%struct.t_gui_key** %0, %struct.t_gui_key** %1) {
%3 = load %struct.t_gui_key*, %struct.t_gui_key** %0
%4 = icmp eq %struct.t_gui_key* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi %struct.t_gui_key* [ %8, %5 ], [ %3, %2 ]
%7 = tail call i32 @gui_keyboard_free(%struct.t_gui_key** %0, %struct.t_gui_key** %1, %struct.t_gui_key* %6)
%8 = load %struct.t_gui_key*, %struct.t_gui_key** %0
%9 = icmp eq %struct.t_gui_key* %8, null
br i1 %9, label %10, label %5
10: ; preds = %5, %2
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
char *skip_space_at_end(char *p) {
  char *p1;
  if (!p)
    return NULL;
  p1 = p;
  while (isspace(*p1))
    p1--;
  p1++;
  return p1;
}


x86 assembly (clang, -O0):
<skip_space_at_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <skip_space_at_end+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1177 <skip_space_at_end+0x67>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1163 <skip_space_at_end+0x53>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    113c <skip_space_at_end+0x2c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_space_at_end>:
push   %rbx
test   %rdi,%rdi
je     1134 <skip_space_at_end+0x24>
mov    %rdi,%rbx
add    $0x2,%rbx
nopl   (%rax)
movsbl -0x2(%rbx),%edi
call   1030 <isspace@plt>
add    $0xffffffffffffffff,%rbx
test   %rax,%rax
jne    1120 <skip_space_at_end+0x10>
jmp    1136 <skip_space_at_end+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_space_at_end(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i8* null, i8** %2
br label %22
8: ; preds = %1
%9 = load i8*, i8** %3
store i8* %9, i8** %4
br label %10
10: ; preds = %15, %8
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = call i64 @isspace(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 -1
store i8* %17, i8** %4
br label %10
18: ; preds = %10
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
%21 = load i8*, i8** %4
store i8* %21, i8** %2
br label %22
22: ; preds = %18, %7
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
define i8* @skip_space_at_end(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call i64 @isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 -1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %4, i64 1
br label %11
11: ; preds = %1, %9
%12 = phi i8* [ %10, %9 ], [ null, %1 ]
ret i8* %12
}
/* Variables and functions */
void Default_SysTick_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Default_SysTick_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_SysTick_Handler+0x9>
jmp    1109 <Default_SysTick_Handler+0x9>

x86 assembly (clang, -O2):
<Default_SysTick_Handler>:
jmp    1100 <Default_SysTick_Handler>

LLVM IR (-O0):
define void @Default_SysTick_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_SysTick_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ f(int *);
main() {
  int x;
  f(&x);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = call i32 @f(i32* %1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @f(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
void *reallocf(void *ptr, size_t t) {
  void *ptr2;
  ptr2 = realloc(ptr, t);
  if (ptr2 == NULL && ptr != NULL) {
    free(ptr);
  }
  return ptr2;
}


x86 assembly (clang, -O0):
<reallocf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1160 <reallocf+0x40>
cmpq   $0x0,-0x8(%rbp)
je     1160 <reallocf+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1141 <reallocf+0x21>
test   %r14,%r14
jne    1141 <reallocf+0x21>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @reallocf(i8* %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i8* %0, null
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @free(i8* %0)
br label %9
9: ; preds = %7, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ LCD_DataWrite(int /*<<< orphan*/);
void LCDPutString(char *str) {
  while (*str) {
    LCD_DataWrite(*str++);
  }
}


x86 assembly (clang, -O0):
<LCDPutString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <LCDPutString+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <LCD_DataWrite@plt>
jmp    111c <LCDPutString+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @LCDPutString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @LCD_DataWrite(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int rand();
int flip() {
  int res = rand() % 2;
  if (res)
    printf("Heads ");
  else
    printf("Tails ");
  return res;
}


x86 assembly (clang, -O0):
<flip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1155 <flip+0x35>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1161 <flip+0x41>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip>:
push   %rbx
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
lea    0xecc(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Heads \00"
@.str.1 = [7 x i8] c"Tails \00"
define i32 @flip() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 2
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [7 x i8] c"Heads \00"
@.str.1 = [7 x i8] c"Tails \00"
define i32 @flip() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 2
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
ret i32 %2
}
int getpagesize() { return 4096; }


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

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

LLVM IR (-O0):
define i32 @getpagesize() {
ret i32 4096
}

LLVM IR (-O2):
define i32 @getpagesize() {
ret i32 4096
}
const char *mg_version(void) { return "3.7"; }


x86 assembly (clang, -O0):
<mg_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"3.7\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"3.7\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
float pow(int, float);
float getFreqFromNote(float x) {
  float f1 = pow(2, (x / 12));
  float f2 = 8.1758 * f1;
  return f2;
}


x86 assembly (clang, -O0):
<getFreqFromNote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xede(%rip),%xmm1
divss  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFreqFromNote>:
push   %rax
divss  0xee7(%rip),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0xed9(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @getFreqFromNote(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fdiv float %5, 1.200000e+01
%7 = call float @pow(i32 2, float %6)
store float %7, float* %3
%8 = load float, float* %3
%9 = fpext float %8 to double
%10 = fmul double 8.175800e+00, %9
%11 = fptrunc double %10 to float
store float %11, float* %4
%12 = load float, float* %4
ret float %12
}

LLVM IR (-O2):
define float @getFreqFromNote(float %0) {
%2 = fdiv float %0, 1.200000e+01
%3 = tail call float @pow(i32 2, float %2)
%4 = fpext float %3 to double
%5 = fmul double %4, 8.175800e+00
%6 = fptrunc double %5 to float
ret float %6
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_STRING;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_STRING_type_new(int /*<<< orphan*/);
int /*<<< orphan*/ V_ASN1_OCTET_STRING;
ASN1_STRING *ASN1_STRING_new(void) {
  return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
}


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

x86 assembly (clang, -O2):
<ASN1_STRING_new>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <ASN1_STRING_type_new@plt>

LLVM IR (-O0):
@V_ASN1_OCTET_STRING = global i32 0
define i32* @ASN1_STRING_new() {
%1 = load i32, i32* @V_ASN1_OCTET_STRING
%2 = call i32* @ASN1_STRING_type_new(i32 %1)
ret i32* %2
}

LLVM IR (-O2):
@V_ASN1_OCTET_STRING = global i32 0
define i32* @ASN1_STRING_new() {
%1 = load i32, i32* @V_ASN1_OCTET_STRING
%2 = tail call i32* @ASN1_STRING_type_new(i32 %1)
ret i32* %2
}