xunge/DecIR huggingface dataset:
int Check_CPU() {
  union x {
    int a;
    char b;
  } c;
  c.a = 1;
  return (c.b == 1);
}


x86 assembly (clang, -O0):
<Check_CPU>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.x = type { i32 }
define i32 @Check_CPU() {
%1 = alloca %union.x
%2 = bitcast %union.x* %1 to i32*
store i32 1, i32* %2
%3 = bitcast %union.x* %1 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @Check_CPU() {
ret i32 1
}
/* Variables and functions */
#define SIGPIPE 128
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ signal(int, void (*)(int));
void SignalHandler(int nSigno) {
  signal(nSigno, SignalHandler);
  switch (nSigno) {
  case SIGPIPE:
    printf("Process will not exit\n");
    break;
  default:
    printf("%d signal unregister\n", nSigno);
    break;
  }
}


x86 assembly (clang, -O0):
<SignalHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rsi
call   1040 <signal@plt>
mov    -0x4(%rbp),%eax
sub    $0x80,%eax
jne    1160 <SignalHandler+0x40>
jmp    114d <SignalHandler+0x2d>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1171 <SignalHandler+0x51>
mov    -0x4(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SignalHandler>:
push   %rbx
mov    %edi,%ebx
mov    0x2eae(%rip),%rsi
call   1050 <signal@plt>
cmp    $0x80,%ebx
jne    1154 <SignalHandler+0x24>
lea    0xec8(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xea5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Process will not exit\0A\00"
@.str.1 = [22 x i8] c"%d signal unregister\0A\00"
define void @SignalHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @signal(i32 %3, void (i32)* @SignalHandler)
%5 = load i32, i32* %2
switch i32 %5, label %8 [
i32 128, label %6
]
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"%d signal unregister\0A\00"
@str = [22 x i8] c"Process will not exit\00"
define void @SignalHandler(i32 %0) {
%2 = tail call i32 @signal(i32 %0, void (i32)* @SignalHandler)
%3 = icmp eq i32 %0, 128
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int sysconf(int /*<<< orphan*/);
int grt_get_clk_tck(void) { return sysconf(_SC_CLK_TCK); }


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

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

LLVM IR (-O0):
@_SC_CLK_TCK = global i32 0
define i32 @grt_get_clk_tck() {
%1 = load i32, i32* @_SC_CLK_TCK
%2 = call i32 @sysconf(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@_SC_CLK_TCK = global i32 0
define i32 @grt_get_clk_tck() {
%1 = load i32, i32* @_SC_CLK_TCK
%2 = tail call i32 @sysconf(i32 %1)
ret i32 %2
}
void swap_my(char *v[], int i, int j) {
  char *temp;
  temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}


x86 assembly (clang, -O0):
<swap_my>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_my>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rcx
movslq %edx,%rdx
mov    (%rdi,%rdx,8),%rsi
mov    %rsi,(%rdi,%rax,8)
mov    %rcx,(%rdi,%rdx,8)
ret

LLVM IR (-O0):
define void @swap_my(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8**, i8*** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %7
%13 = load i8**, i8*** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
store i8* %17, i8** %21
%22 = load i8*, i8** %7
%23 = load i8**, i8*** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
store i8* %22, i8** %26
ret void
}

LLVM IR (-O2):
define void @swap_my(i8** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
store i8* %9, i8** %5
store i8* %6, i8** %8
ret void
}
unsigned short get_knee_from_leg(unsigned short leg) {
  switch (leg) {
  case 7:
    return 6;
  case 5:
    return 4;
  case 3:
    return 2;
  case 1:
    return 0;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_knee_from_leg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     1161 <get_knee_from_leg+0x61>
mov    -0x10(%rbp),%rax
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movw   $0x6,-0x2(%rbp)
jmp    1167 <get_knee_from_leg+0x67>
movw   $0x4,-0x2(%rbp)
jmp    1167 <get_knee_from_leg+0x67>
movw   $0x2,-0x2(%rbp)
jmp    1167 <get_knee_from_leg+0x67>
movw   $0x0,-0x2(%rbp)
jmp    1167 <get_knee_from_leg+0x67>
movw   $0xffff,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_knee_from_leg>:
add    $0xffffffff,%edi
mov    $0xffff,%ax
cmp    $0x6,%di
ja     111c <get_knee_from_leg+0x1c>
movswq %di,%rax
lea    0xee8(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
ret

LLVM IR (-O0):
define zeroext i16 @get_knee_from_leg(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
switch i32 %5, label %10 [
i32 7, label %6
i32 5, label %7
i32 3, label %8
i32 1, label %9
]
6: ; preds = %1
store i16 6, i16* %2
br label %11
7: ; preds = %1
store i16 4, i16* %2
br label %11
8: ; preds = %1
store i16 2, i16* %2
br label %11
9: ; preds = %1
store i16 0, i16* %2
br label %11
10: ; preds = %1
store i16 -1, i16* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6
%12 = load i16, i16* %2
ret i16 %12
}

LLVM IR (-O2):
@switch.table.get_knee_from_leg = [7 x i16] [i16 0, i16 -1, i16 2, i16 -1, i16 4, i16 -1, i16 6]
define zeroext i16 @get_knee_from_leg(i16 zeroext %0) {
%2 = add i16 %0, -1
%3 = icmp ult i16 %2, 7
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i16 %2 to i64
%6 = getelementptr inbounds [7 x i16], [7 x i16]* @switch.table.get_knee_from_leg, i64 0, i64 %5
%7 = load i16, i16* %6
br label %8
8: ; preds = %1, %4
%9 = phi i16 [ %7, %4 ], [ -1, %1 ]
ret i16 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_svector(unsigned short *v, long nl, long nh) {
  free((char *)(v + nl - 1));
}


x86 assembly (clang, -O0):
<free_svector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rdi
add    $0xfffffffffffffffe,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_svector>:
lea    (%rdi,%rsi,2),%rdi
add    $0xfffffffffffffffe,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_svector(i16* %0, i64 %1, i64 %2) {
%4 = alloca i16*
%5 = alloca i64
%6 = alloca i64
store i16* %0, i16** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i16*, i16** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds i16, i16* %7, i64 %8
%10 = getelementptr inbounds i16, i16* %9, i64 -1
%11 = bitcast i16* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_svector(i16* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i16, i16* %0, i64 %1
%5 = getelementptr inbounds i16, i16* %4, i64 -1
%6 = bitcast i16* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("acm");
  main();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
call   1040 <main@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1120 <main+0x10>

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

LLVM IR (-O2):
@.str = [4 x i8] c"acm\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %1
}
void XcmsTekHVCQueryMaxC() {}


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

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

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

LLVM IR (-O2):
define void @XcmsTekHVCQueryMaxC() {
ret void
}
void io_wake_up(struct io_stream *s) {}


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

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

LLVM IR (-O0):
%struct.io_stream = type opaque
define void @io_wake_up(%struct.io_stream* %0) {
%2 = alloca %struct.io_stream*
store %struct.io_stream* %0, %struct.io_stream** %2
ret void
}

LLVM IR (-O2):
%struct.io_stream = type opaque
define void @io_wake_up(%struct.io_stream* nocapture %0) {
ret void
}
char *strapp(char *dp, const char *sp) {
  while (*sp != '\0') {
    *dp++ = *sp++;
  }
  return dp;
}


x86 assembly (clang, -O0):
<strapp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <strapp+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <strapp+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strapp>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <strapp+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <strapp+0x10>
ret

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

LLVM IR (-O2):
define i8* @strapp(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ test_dirtree();
int /*<<< orphan*/ test_hash_table();
void testing() {
  test_hash_table();
  test_dirtree();
}


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

x86 assembly (clang, -O2):
<testing>:
push   %rax
xor    %eax,%eax
call   1040 <test_hash_table@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_dirtree@plt>

LLVM IR (-O0):
define void @testing() {
%1 = call i32 (...) @test_hash_table()
%2 = call i32 (...) @test_dirtree()
ret void
}

LLVM IR (-O2):
define void @testing() {
%1 = tail call i32 (...) @test_hash_table()
%2 = tail call i32 (...) @test_dirtree()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = '3' - '0';
  x = x * 10;
  x = x + '8' - '0';
  printf("%d\n", x);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x26,%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() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 10
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 56
%7 = sub nsw i32 %6, 48
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 38)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int mylog2(int /*<<< orphan*/);
int log2s(int32_t value) {
  return (value < 0) ? -mylog2(-value) : mylog2(value);
}


x86 assembly (clang, -O0):
<log2s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    113d <log2s+0x2d>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   1030 <mylog2@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <log2s+0x38>
mov    -0x4(%rbp),%edi
call   1030 <mylog2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2s>:
test   %edi,%edi
js     1119 <log2s+0x9>
jmp    1030 <mylog2@plt>
push   %rax
neg    %edi
call   1030 <mylog2@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @log2s(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
%8 = call i32 @mylog2(i32 %7)
%9 = sub nsw i32 0, %8
br label %13
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i32 @mylog2(i32 %11)
br label %13
13: ; preds = %10, %5
%14 = phi i32 [ %9, %5 ], [ %12, %10 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @log2s(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sub nsw i32 0, %0
%5 = tail call i32 @mylog2(i32 %4)
%6 = sub nsw i32 0, %5
br label %9
7: ; preds = %1
%8 = tail call i32 @mylog2(i32 %0)
br label %9
9: ; preds = %7, %3
%10 = phi i32 [ %6, %3 ], [ %8, %7 ]
ret i32 %10
}
/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ deleteAtPos(struct Node **, int);
int /*<<< orphan*/ insertList(struct Node **, int);
int /*<<< orphan*/ printList(struct Node *);
int main() {
  struct Node *head = NULL;
  insertList(&head, 5);
  insertList(&head, 4);
  insertList(&head, 3);
  insertList(&head, 2);
  deleteAtPos(&head, 1);
  printList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <deleteAtPos@plt>
mov    -0x10(%rbp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <insertList@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <insertList@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <insertList@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <insertList@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <deleteAtPos@plt>
mov    0x8(%rsp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Node*
store i32 0, i32* %1
store %struct.Node* null, %struct.Node** %2
%3 = call i32 @insertList(%struct.Node** %2, i32 5)
%4 = call i32 @insertList(%struct.Node** %2, i32 4)
%5 = call i32 @insertList(%struct.Node** %2, i32 3)
%6 = call i32 @insertList(%struct.Node** %2, i32 2)
%7 = call i32 @deleteAtPos(%struct.Node** %2, i32 1)
%8 = load %struct.Node*, %struct.Node** %2
%9 = call i32 @printList(%struct.Node* %8)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca %struct.Node*
%2 = bitcast %struct.Node** %1 to i8*
store %struct.Node* null, %struct.Node** %1
%3 = call i32 @insertList(%struct.Node** %1, i32 5)
%4 = call i32 @insertList(%struct.Node** %1, i32 4)
%5 = call i32 @insertList(%struct.Node** %1, i32 3)
%6 = call i32 @insertList(%struct.Node** %1, i32 2)
%7 = call i32 @deleteAtPos(%struct.Node** %1, i32 1)
%8 = load %struct.Node*, %struct.Node** %1
%9 = call i32 @printList(%struct.Node* %8)
ret i32 0
}
/* Variables and functions */
char tan(char);
char internal_tan_b(char value) { return tan(value); }


x86 assembly (clang, -O0):
<internal_tan_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <tan@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_tan_b>:
jmp    1030 <tan@plt>

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

LLVM IR (-O2):
define signext i8 @internal_tan_b(i8 signext %0) {
%2 = tail call signext i8 @tan(i8 signext %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char *, int /*<<< orphan*/);
bool file_exists(char fname[]) {
  if (access(fname, F_OK) != -1)
    return true;
  else
    return false;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
je     1143 <file_exists+0x33>
movl   $0x1,-0x4(%rbp)
jmp    114a <file_exists+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @file_exists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i32, i32* @F_OK
%6 = call i32 @access(i8* %4, i32 %5)
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @file_exists(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ quicksortsubrange(long *, int /*<<< orphan*/, long);
void quicksort(long *a, long n) { quicksortsubrange(a, 0, n - 1); }


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1030 <quicksortsubrange@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
lea    -0x1(%rsi),%rdx
xor    %esi,%esi
jmp    1030 <quicksortsubrange@plt>

LLVM IR (-O0):
define void @quicksort(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* %4
%7 = sub nsw i64 %6, 1
%8 = call i32 @quicksortsubrange(i64* %5, i32 0, i64 %7)
ret void
}

LLVM IR (-O2):
define void @quicksort(i64* %0, i64 %1) {
%3 = add nsw i64 %1, -1
%4 = tail call i32 @quicksortsubrange(i64* %0, i32 0, i64 %3)
ret void
}
int g(double a) { return a * a; }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
mulsd  %xmm0,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @g(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @g(double %0) {
%2 = fmul double %0, %0
%3 = fptosi double %2 to i32
ret i32 %3
}
int reverse_memcmp(char *string1, char *string2, int n) {
  int _n = n - 1;
  while (_n > -1) {
    if (*(string1 + _n) != *(string2 + _n)) {
      return -1;
    }
    _n = _n - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<reverse_memcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jle    115c <reverse_memcmp+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <reverse_memcmp+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <reverse_memcmp+0x63>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1118 <reverse_memcmp+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_memcmp>:
mov    %edx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %eax,%eax
jle    112c <reverse_memcmp+0x2c>
movzbl -0x1(%rdi,%rax,1),%ecx
lea    -0x1(%rax),%rdx
cmp    -0x1(%rsi,%rax,1),%cl
mov    %rdx,%rax
je     1110 <reverse_memcmp+0x10>
mov    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @reverse_memcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %2 to i64
br label %5
5: ; preds = %10, %3
%6 = phi i64 [ %7, %10 ], [ %4, %3 ]
%7 = add nsw i64 %6, -1
%8 = trunc i64 %6 to i32
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 %7
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %7
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
br i1 %15, label %5, label %16
16: ; preds = %5, %10
%17 = phi i32 [ -1, %10 ], [ 0, %5 ]
ret i32 %17
}
unsigned revbin(unsigned x) {
  x = ((x & 0x55555555U) << 1) | ((x & (~0x55555555U)) >> 1);
  x = ((x & 0x33333333U) << 2) | ((x & (~0x33333333U)) >> 2);
  x = ((x & 0x0f0f0f0fU) << 4) | ((x & (~0x0f0f0f0fU)) >> 4);
  x = __builtin_bswap32(x);
  return x;
}


x86 assembly (clang, -O0):
<revbin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x55555555,%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0xaaaaaaaa,%ecx
shr    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x33333333,%eax
shl    $0x2,%eax
mov    -0x4(%rbp),%ecx
and    $0xcccccccc,%ecx
shr    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0f0f0f,%eax
shl    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0f0f0f0,%ecx
shr    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
bswap  %eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<revbin>:
mov    %edi,%eax
and    $0xd5555555,%eax
shr    %edi
and    $0x55555555,%edi
lea    (%rdi,%rax,2),%eax
mov    %eax,%ecx
and    $0xf3333333,%ecx
shr    $0x2,%eax
and    $0x33333333,%eax
lea    (%rax,%rcx,4),%eax
mov    %eax,%ecx
shl    $0x4,%ecx
and    $0xf0f0f0f0,%ecx
shr    $0x4,%eax
and    $0xf0f0f0f,%eax
or     %ecx,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @revbin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1431655765
%5 = shl i32 %4, 1
%6 = load i32, i32* %2
%7 = and i32 %6, -1431655766
%8 = lshr i32 %7, 1
%9 = or i32 %5, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = and i32 %10, 858993459
%12 = shl i32 %11, 2
%13 = load i32, i32* %2
%14 = and i32 %13, -858993460
%15 = lshr i32 %14, 2
%16 = or i32 %12, %15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = and i32 %17, 252645135
%19 = shl i32 %18, 4
%20 = load i32, i32* %2
%21 = and i32 %20, -252645136
%22 = lshr i32 %21, 4
%23 = or i32 %19, %22
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = call i32 @llvm.bswap.i32(i32 %24)
store i32 %25, i32* %2
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @revbin(i32 %0) {
%2 = shl i32 %0, 1
%3 = and i32 %2, -1431655766
%4 = lshr i32 %0, 1
%5 = and i32 %4, 1431655765
%6 = or i32 %3, %5
%7 = shl i32 %6, 2
%8 = and i32 %7, -858993460
%9 = lshr i32 %6, 2
%10 = and i32 %9, 858993459
%11 = or i32 %8, %10
%12 = shl i32 %11, 4
%13 = and i32 %12, -252645136
%14 = lshr i32 %11, 4
%15 = and i32 %14, 252645135
%16 = or i32 %13, %15
%17 = tail call i32 @llvm.bswap.i32(i32 %16)
ret i32 %17
}
void rpdr2i_(dx, dy) int *dx, *dy;
{ rpdr2((float)*dx, (float)*dy); }


x86 assembly (clang, -O0):
<rpdr2i_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssl (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1030 <rpdr2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpdr2i_>:
cvtsi2ssl (%rdi),%xmm0
cvtsi2ssl (%rsi),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
jmp    1030 <rpdr2@plt>

LLVM IR (-O0):
define void @rpdr2i_(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to float
%12 = fpext float %11 to double
%13 = call i32 (double, double, ...) bitcast (i32 (...)* @rpdr2 to i32 (double, double, ...)*)(double %8, double %12)
ret void
}

LLVM IR (-O2):
define void @rpdr2i_(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = sitofp i32 %3 to float
%5 = fpext float %4 to double
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = tail call i32 (double, double, ...) bitcast (i32 (...)* @rpdr2 to i32 (double, double, ...)*)(double %5, double %8)
ret void
}
/* Variables and functions */
int fun_c(int);
__attribute__((always_)) int fun_b(int argb) {
  static int locb = 0;
  locb += argb;
  return fun_c(locb);
}


x86 assembly (clang, -O0):
<fun_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    0x2f08(%rip),%eax
mov    %eax,0x2f02(%rip)
mov    0x2efc(%rip),%edi
call   1030 <fun_c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_b>:
add    0x2f16(%rip),%edi
mov    %edi,0x2f10(%rip)
jmp    1030 <fun_c@plt>

LLVM IR (-O0):
@fun_b.locb = internal global i32 0
define i32 @fun_b(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @fun_b.locb
%5 = add nsw i32 %4, %3
store i32 %5, i32* @fun_b.locb
%6 = load i32, i32* @fun_b.locb
%7 = call i32 @fun_c(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@fun_b.locb = internal unnamed_addr global i32 0
define i32 @fun_b(i32 %0) {
%2 = load i32, i32* @fun_b.locb
%3 = add nsw i32 %2, %0
store i32 %3, i32* @fun_b.locb
%4 = tail call i32 @fun_c(i32 %3)
ret i32 %4
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int sum(int, int);
int main(int argc, char *argv[]) {
  int x = atoi(argv[1]);
  int y = atoi(argv[2]);
  printf("%d + %d = %d\n", x, y, sum(x, y));
  return 0;
}


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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <sum@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <sum@plt>
lea    0xea4(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %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 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = tail call i32 @sum(i32 %5, i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %9)
ret i32 0
}
/* Variables and functions */
char shift_letter(char, int);
char caesar_decrypt_char(char cipherchar, int key) {
  return shift_letter(cipherchar, -key);
}


x86 assembly (clang, -O0):
<caesar_decrypt_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x1(%rbp),%al
xor    %esi,%esi
sub    -0x8(%rbp),%esi
movsbl %al,%edi
call   1030 <shift_letter@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caesar_decrypt_char>:
neg    %esi
jmp    1030 <shift_letter@plt>

LLVM IR (-O0):
define signext i8 @caesar_decrypt_char(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 0, %6
%8 = call signext i8 @shift_letter(i8 signext %5, i32 %7)
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @caesar_decrypt_char(i8 signext %0, i32 %1) {
%3 = sub nsw i32 0, %1
%4 = tail call signext i8 @shift_letter(i8 signext %0, i32 %3)
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int die;
  srand(time(NULL));
  die = rand() % 6 + 1;
  { printf("congratulations, you rolled a %d\n", die); }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"congratulations, you rolled a %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 6
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"congratulations, you rolled a %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = add nsw i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
double elapsedTime(int, int);
double totalTime(int, int, double, double);
double remainingTime(int time, int startTime, double bytes, double totalBytes) {
  return (totalTime(time, startTime, bytes, totalBytes) -
          elapsedTime(time, startTime));
}


x86 assembly (clang, -O0):
<remainingTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <totalTime@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <elapsedTime@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remainingTime>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <totalTime@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <elapsedTime@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @remainingTime(i32 %0, i32 %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
store double %3, double* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load double, double* %7
%12 = load double, double* %8
%13 = call double @totalTime(i32 %9, i32 %10, double %11, double %12)
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call double @elapsedTime(i32 %14, i32 %15)
%17 = fsub double %13, %16
ret double %17
}

LLVM IR (-O2):
define double @remainingTime(i32 %0, i32 %1, double %2, double %3) {
%5 = tail call double @totalTime(i32 %0, i32 %1, double %2, double %3)
%6 = tail call double @elapsedTime(i32 %0, i32 %1)
%7 = fsub double %5, %6
ret double %7
}
int adis16203_probe_trigger(struct iio_dev *indio_dev) { return 0; }


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

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

LLVM IR (-O0):
%struct.iio_dev = type opaque
define i32 @adis16203_probe_trigger(%struct.iio_dev* %0) {
%2 = alloca %struct.iio_dev*
store %struct.iio_dev* %0, %struct.iio_dev** %2
ret i32 0
}

LLVM IR (-O2):
%struct.iio_dev = type opaque
define i32 @adis16203_probe_trigger(%struct.iio_dev* nocapture readnone %0) {
ret i32 0
}
int comparePointerKeys(void *key1, void *key2) { return key2 - key1; }


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

x86 assembly (clang, -O2):
<comparePointerKeys>:
mov    %rsi,%rax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @comparePointerKeys(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @comparePointerKeys(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
int pbl_BufToShort(unsigned char *buf) {
  unsigned int s = ((unsigned int)(*buf++)) << 8;
  s |= *buf;
  return (s);
}


x86 assembly (clang, -O0):
<pbl_BufToShort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbl_BufToShort>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @pbl_BufToShort(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i32 1
store i8* %5, i8** %2
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = shl i32 %7, 8
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i32, i32* %3
%13 = or i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @pbl_BufToShort(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = shl nuw nsw i32 %4, 8
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ locate(int, int);
int popNumber();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
void basLocate() {
  int x, y;
  y = popNumber();
  x = popNumber();
  pushNumber(locate(x, y));
}


x86 assembly (clang, -O0):
<basLocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <locate@plt>
mov    %eax,%edi
call   1040 <pushNumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basLocate>:
push   %rbx
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1030 <locate@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
define void @basLocate() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @popNumber()
store i32 %3, i32* %2
%4 = call i32 (...) @popNumber()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @locate(i32 %5, i32 %6)
%8 = call i32 @pushNumber(i32 %7)
ret void
}

LLVM IR (-O2):
define void @basLocate() {
%1 = tail call i32 (...) @popNumber()
%2 = tail call i32 (...) @popNumber()
%3 = tail call i32 @locate(i32 %2, i32 %1)
%4 = tail call i32 @pushNumber(i32 %3)
ret void
}
/* Variables and functions */
unsigned int strlen(const char *s) {
  unsigned int ret = 0;
  while (*s != '\0') {
    ret++;
    s++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <strlen+0x39>
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 = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i32, i32* %3
%11 = add i32 %10, 1
store i32 %11, i32* %3
%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 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
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void display_help() {
  printf("Mount - mount a device on to a directory\n");
  printf("Syntax: mount [-t type] device directory\n");
  printf("Switches:\n\t-t <type>: Specify filesystem type (e.g. 'ext2')\n");
  printf("Note: Not specifying -t will have the kernel try all types until one "
         "works\n");
}


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

x86 assembly (clang, -O2):
<display_help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xf22(%rip),%rdi
call   1030 <puts@plt>
lea    0xf52(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Mount - mount a device on to a directory\0A\00"
@.str.1 = [42 x i8] c"Syntax: mount [-t type] device directory\0A\00"
@.str.2 = [61 x i8] c"Switches:\0A\09-t <type>: Specify filesystem type (e.g. 'ext2')\0A\00"
@.str.3 = [76 x i8] c"Note: Not specifying -t will have the kernel try all types until one works\0A\00"
define void @display_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [41 x i8] c"Mount - mount a device on to a directory\00"
@str.4 = [41 x i8] c"Syntax: mount [-t type] device directory\00"
@str.5 = [60 x i8] c"Switches:\0A\09-t <type>: Specify filesystem type (e.g. 'ext2')\00"
@str.6 = [75 x i8] c"Note: Not specifying -t will have the kernel try all types until one works\00"
define void @display_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stop_display(int);
void oglspectrum_cleanup(void) { stop_display(1); }


x86 assembly (clang, -O0):
<oglspectrum_cleanup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <stop_display@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<oglspectrum_cleanup>:
mov    $0x1,%edi
jmp    1030 <stop_display@plt>

LLVM IR (-O0):
define void @oglspectrum_cleanup() {
%1 = call i32 @stop_display(i32 1)
ret void
}

LLVM IR (-O2):
define void @oglspectrum_cleanup() {
%1 = tail call i32 @stop_display(i32 1)
ret void
}
int test_imm_29int8_mem(signed char *val) {
  return ((*val) & (-0x29 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_29int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -41
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}