xunge/DecIR huggingface dataset:
void replicationGetSlaveOffset(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               108, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<replicationGetSlaveOffset>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x6c,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replicationGetSlaveOffset>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x6c,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.replicationGetSlaveOffset = [26 x i8] c"replicationGetSlaveOffset\00"
define void @replicationGetSlaveOffset() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 108, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @__func__.replicationGetSlaveOffset, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.replicationGetSlaveOffset = [26 x i8] c"replicationGetSlaveOffset\00"
define void @replicationGetSlaveOffset() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 108, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @__func__.replicationGetSlaveOffset, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ls_memdump_ex(void const *const, size_t const, int, int);
void ls_memdump(const void *const ptr, const size_t size) {
  ls_memdump_ex(ptr, size, 16, 1);
}


x86 assembly (clang, -O0):
<ls_memdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
mov    $0x1,%ecx
call   1030 <ls_memdump_ex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_memdump>:
mov    $0x10,%edx
mov    $0x1,%ecx
jmp    1030 <ls_memdump_ex@plt>

LLVM IR (-O0):
define void @ls_memdump(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @ls_memdump_ex(i8* %5, i64 %6, i32 16, i32 1)
ret void
}

LLVM IR (-O2):
define void @ls_memdump(i8* %0, i64 %1) {
%3 = tail call i32 @ls_memdump_ex(i8* %0, i64 %1, i32 16, i32 1)
ret void
}
int CalculateUsedColors(int bitcount) {
  int c = 1 << bitcount;
  return ((c <= 256) && (c > 1)) ? c : 0;
}


x86 assembly (clang, -O0):
<CalculateUsedColors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jg     1136 <CalculateUsedColors+0x36>
cmpl   $0x1,-0x8(%rbp)
jle    1136 <CalculateUsedColors+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <CalculateUsedColors+0x40>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <CalculateUsedColors+0x40>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateUsedColors>:
mov    %edi,%ecx
mov    $0x1,%edx
shl    %cl,%edx
lea    -0x2(%rdx),%ecx
xor    %eax,%eax
cmp    $0xff,%ecx
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @CalculateUsedColors(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = shl i32 1, %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 256
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* %3
br label %14
13: ; preds = %8, %1
br label %14
14: ; preds = %13, %11
%15 = phi i32 [ %12, %11 ], [ 0, %13 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @CalculateUsedColors(i32 %0) {
%2 = shl nuw i32 1, %0
%3 = add i32 %2, -2
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %2, i32 0
ret i32 %5
}
void performance_init() {}


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

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

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

LLVM IR (-O2):
define void @performance_init() {
ret void
}
void palm27x_udc_init(int vbus, int pullup, int vbus_inverted) {}


x86 assembly (clang, -O0):
<palm27x_udc_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @palm27x_udc_init(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
extern bool liq_crash_if_invalid_pointer_given(void *pointer) {
  if (!pointer) {
    return false;
  }
  char test_access = *((volatile char *)pointer);
  return test_access || true;
}


x86 assembly (clang, -O0):
<liq_crash_if_invalid_pointer_given>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <liq_crash_if_invalid_pointer_given+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    114f <liq_crash_if_invalid_pointer_given+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
jne    1144 <liq_crash_if_invalid_pointer_given+0x44>
mov    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1144 <liq_crash_if_invalid_pointer_given+0x44>
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<liq_crash_if_invalid_pointer_given>:
test   %rdi,%rdi
je     110d <liq_crash_if_invalid_pointer_given+0xd>
mov    (%rdi),%al
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @liq_crash_if_invalid_pointer_given(i8* %0) {
%2 = alloca i32
%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 i32 0, i32* %2
br label %18
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load volatile i8, i8* %9
store i8 %10, i8* %4
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %8
br label %15
15: ; preds = %14, %8
%16 = phi i1 [ true, %8 ], [ true, %14 ]
%17 = zext i1 %16 to i32
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @liq_crash_if_invalid_pointer_given(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = load volatile i8, i8* %0
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 1, %3 ], [ 0, %1 ]
ret i32 %6
}
void test_assert_fails() {
  do {
    seatest_assert_true(1 == 2, __FUNCTION__, 12);
  } while (0);
  do {
    seatest_assert_true(3 == 5, __FUNCTION__, 13);
  } while (0);
}


x86 assembly (clang, -O0):
<test_assert_fails>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <test_assert_fails+0x9>
xor    %edi,%edi
lea    0xede(%rip),%rsi
mov    $0xc,%edx
mov    $0x0,%al
call   1030 <seatest_assert_true@plt>
jmp    1133 <test_assert_fails+0x23>
xor    %edi,%edi
lea    0xec4(%rip),%rsi
mov    $0xd,%edx
mov    $0x0,%al
call   1030 <seatest_assert_true@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_assert_fails>:
push   %rbx
lea    0xee8(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
xor    %eax,%eax
call   1030 <seatest_assert_true@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0xd,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <seatest_assert_true@plt>

LLVM IR (-O0):
@__FUNCTION__.test_assert_fails = [18 x i8] c"test_assert_fails\00"
define void @test_assert_fails() {
br label %1
1: ; preds = %0
%2 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_true to i32 (i32, i8*, i32, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.test_assert_fails, i64 0, i64 0), i32 12)
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
%5 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_true to i32 (i32, i8*, i32, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.test_assert_fails, i64 0, i64 0), i32 13)
br label %6
6: ; preds = %4
ret void
}

LLVM IR (-O2):
@__FUNCTION__.test_assert_fails = [18 x i8] c"test_assert_fails\00"
define void @test_assert_fails() {
%1 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_true to i32 (i32, i8*, i32, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.test_assert_fails, i64 0, i64 0), i32 12)
%2 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_true to i32 (i32, i8*, i32, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.test_assert_fails, i64 0, i64 0), i32 13)
ret void
}
int quest_sort_id(const void *_i1, const void *_i2) {
  int i1 = *((int *)_i1);
  int i2 = *((int *)_i2);
  return (i1 > i2) ? 1 : (i1 < i2) ? -1 : 0;
}


x86 assembly (clang, -O0):
<quest_sort_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1137 <quest_sort_id+0x37>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <quest_sort_id+0x4c>
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @quest_sort_id(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
void test_strings_equal(void) {
  char *s = "hello";
  do {
    seatest_assert_string_equal("hello", s, __FUNCTION__, 6);
  } while (0);
}


x86 assembly (clang, -O0):
<test_strings_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
lea    0xed1(%rip),%rdx
mov    $0x6,%ecx
mov    $0x0,%al
call   1030 <seatest_assert_string_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strings_equal>:
lea    0xee9(%rip),%rdi
lea    0xee8(%rip),%rdx
mov    %rdi,%rsi
mov    $0x6,%ecx
xor    %eax,%eax
jmp    1030 <seatest_assert_string_equal@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@__FUNCTION__.test_strings_equal = [19 x i8] c"test_strings_equal\00"
define void @test_strings_equal() {
%1 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
br label %2
2: ; preds = %0
%3 = load i8*, i8** %1
%4 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_strings_equal, i64 0, i64 0), i32 6)
br label %5
5: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@__FUNCTION__.test_strings_equal = [19 x i8] c"test_strings_equal\00"
define void @test_strings_equal() {
%1 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_strings_equal, i64 0, i64 0), i32 6)
ret void
}
__attribute__((no)) void arraywrite(char *arr) {
  int i = 1024 * 1024 * 1024 - 1, r = 0;
  for (; i >= 0; i -= 3) {
    arr[i] = (char)i;
  }
}


x86 assembly (clang, -O0):
<arraywrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x3fffffff,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     113e <arraywrite+0x3e>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <arraywrite+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arraywrite>:
mov    $0x3fffffff,%eax
mov    $0x3ffffffc,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x3(%rcx),%edx
mov    %dl,0x3(%rdi,%rcx,1)
lea    -0x3(%rax),%rdx
mov    %dl,(%rdi,%rcx,1)
add    $0xfffffffffffffffa,%rax
add    $0xfffffffffffffffa,%rcx
cmp    $0x2,%rdx
ja     1110 <arraywrite+0x10>
ret

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

LLVM IR (-O2):
define void @arraywrite(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 1073741823, %1 ], [ %9, %2 ]
%4 = trunc i64 %3 to i8
%5 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 %4, i8* %5
%6 = add nsw i64 %3, -3
%7 = trunc i64 %6 to i8
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nsw i64 %3, -6
%10 = icmp ugt i64 %6, 2
br i1 %10, label %2, label %11
11: ; preds = %2
ret void
}
/* Variables and functions */
double atan(double);
double tosReal_atan(double x) { return atan(x); }


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

x86 assembly (clang, -O2):
<tosReal_atan>:
jmp    1030 <atan@plt>

LLVM IR (-O0):
define double @tosReal_atan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @atan(double %3)
ret double %4
}

LLVM IR (-O2):
define double @tosReal_atan(double %0) {
%2 = tail call double @atan(double %0)
ret double %2
}
/* Variables and functions */
int setscrreg(int, int);
int t_setscrreg(int top, int bottom) { return setscrreg(top, bottom); }


x86 assembly (clang, -O0):
<t_setscrreg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <setscrreg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_setscrreg>:
jmp    1030 <setscrreg@plt>

LLVM IR (-O0):
define i32 @t_setscrreg(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* %4
%7 = call i32 @setscrreg(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @t_setscrreg(i32 %0, i32 %1) {
%3 = tail call i32 @setscrreg(i32 %0, i32 %1)
ret i32 %3
}
void eglGetCurrentContext(void) { return; }


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

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

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

LLVM IR (-O2):
define void @eglGetCurrentContext() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char *);
void key_1_handler(void) {
  uart_puts("\nkey_1_handler");
  return;
}


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"\0Akey_1_handler\00"
define void @key_1_handler() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
void wifi_evt_endpoint_status(
    const struct wifi_msg_endpoint_status_evt_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_endpoint_status_evt_t = type opaque
define void @wifi_evt_endpoint_status(%struct.wifi_msg_endpoint_status_evt_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strrindex(char *, char *);
int main(void) {
  char characters[] = "kunal";
  char string[] = "hello my name is kunal. kunal is spelt kunal.";
  int value = strrindex(characters, string);
  printf("%i\n", value);
  return value;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x2e,%edx
call   1050 <memcpy@plt>
lea    -0xa(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <strrindex@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movw   $0x6c,0xc(%rsp)
movl   $0x616e756b,0x8(%rsp)
61
movups 0xef3(%rip),%xmm0
movups %xmm0,0x2e(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <strrindex@plt>
mov    %eax,%ebx
lea    0xe96(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.characters = [6 x i8] c"kunal\00"
@__const.main.string = [46 x i8] c"hello my name is kunal. kunal is spelt kunal.\00"
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [46 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [6 x i8]* %2 to i8*
%6 = bitcast [46 x i8]* %3 to i8*
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [46 x i8], [46 x i8]* %3, i64 0, i64 0
%9 = call i32 @strrindex(i8* %7, i8* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
@__const.main.characters = [6 x i8] c"kunal\00"
@__const.main.string = [46 x i8] c"hello my name is kunal. kunal is spelt kunal.\00"
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [46 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [46 x i8], [46 x i8]* %2, i64 0, i64 0
%5 = call i32 @strrindex(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ neo430_uart_putc(char);
void neo430_uart_br_print(char *s) {
  char c = 0;
  while ((c = *s++)) {
    if (c == '\n') {
      neo430_uart_putc('\r');
    }
    neo430_uart_putc(c);
  }
}


x86 assembly (clang, -O0):
<neo430_uart_br_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x9(%rbp)
cmp    $0x0,%al
je     1161 <neo430_uart_br_print+0x51>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    1153 <neo430_uart_br_print+0x43>
mov    $0xd,%edi
call   1030 <neo430_uart_putc@plt>
movsbl -0x9(%rbp),%edi
call   1030 <neo430_uart_putc@plt>
jmp    1120 <neo430_uart_br_print+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neo430_uart_br_print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
jmp    1136 <neo430_uart_br_print+0x26>
nopl   0x0(%rax)
mov    $0xd,%edi
call   1030 <neo430_uart_putc@plt>
add    $0x1,%r14
movsbl %bl,%edi
call   1030 <neo430_uart_putc@plt>
movzbl (%r14),%ebx
cmp    $0xa,%bl
je     1120 <neo430_uart_br_print+0x10>
test   %bl,%bl
jne    112a <neo430_uart_br_print+0x1a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @neo430_uart_br_print(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %4, %8 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %10
i8 10, label %6
]
6: ; preds = %2
%7 = tail call i32 @neo430_uart_putc(i8 signext 13)
br label %8
8: ; preds = %2, %6
%9 = tail call i32 @neo430_uart_putc(i8 signext %5)
br label %2
10: ; preds = %2
ret void
}
/* Variables and functions */
int rand();
int luck(int per) {
  if ((rand() % 100) < per)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<luck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    -0x8(%rbp),%edx
jge    113f <luck+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <luck+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luck>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setl   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @luck(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 100
%6 = load i32, i32* %3
%7 = icmp slt i32 %5, %6
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):
define i32 @luck(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 100
%4 = icmp slt i32 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
scalar_t__ strlen(char *);
char *make_version_name(char *file, int version) {
  char *backup_name;
  backup_name = malloc(strlen(file) + 16);
  if (backup_name == 0)
    return 0;
  sprintf(backup_name, "%s.~%d~", file, version);
  return backup_name;
}


x86 assembly (clang, -O0):
<make_version_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rdi
add    $0x10,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1170 <make_version_name+0x40>
movq   $0x0,-0x8(%rbp)
jmp    118f <make_version_name+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xe7e(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_version_name>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x10(%rax),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1165 <make_version_name+0x35>
lea    0xea9(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1050 <sprintf@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s.~%d~\00"
define noalias i8* @make_version_name(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add nsw i64 %3, 16
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
br label %9
9: ; preds = %2, %7
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *fmalloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL) {
    perror("malloc");
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<fmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <fmalloc+0x3e>
lea    0xea5(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <fmalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"malloc\00"
@EXIT_FAILURE = global i32 0
define i8* @fmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"malloc\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @fmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %2
}
int main(void) {
  short *p = 0, *u;
  *(u + *p) = 23;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movswl (%rcx),%ecx
movslq %ecx,%rcx
movw   $0x17,(%rax,%rcx,2)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16*
%3 = alloca i16*
store i32 0, i32* %1
store i16* null, i16** %2
%4 = load i16*, i16** %3
%5 = load i16*, i16** %2
%6 = load i16, i16* %5
%7 = sext i16 %6 to i32
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i16, i16* %4, i64 %8
store i16 23, i16* %9
ret i32 0
}

LLVM IR (-O2):
/* Type definitions */
struct vm_area_struct {
  int dummy;
};
struct mm_struct {
  int dummy;
};

/* Variables and functions */
int __handle_mm_fault(struct mm_struct *, struct vm_area_struct *,
                      unsigned long, int);
__attribute__((always_)) int handle_mm_fault(struct mm_struct *mm,
                                             struct vm_area_struct *vma,
                                             unsigned long address,
                                             int write_access) {
  return __handle_mm_fault(mm, vma, address, write_access) & (~0x10);
}


x86 assembly (clang, -O0):
<handle_mm_fault>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <__handle_mm_fault@plt>
and    $0xffffffef,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_mm_fault>:
push   %rax
call   1030 <__handle_mm_fault@plt>
and    $0xffffffef,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.mm_struct = type { i32 }
%struct.vm_area_struct = type { i32 }
define i32 @handle_mm_fault(%struct.mm_struct* %0, %struct.vm_area_struct* %1, i64 %2, i32 %3) {
%5 = alloca %struct.mm_struct*
%6 = alloca %struct.vm_area_struct*
%7 = alloca i64
%8 = alloca i32
store %struct.mm_struct* %0, %struct.mm_struct** %5
store %struct.vm_area_struct* %1, %struct.vm_area_struct** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load %struct.mm_struct*, %struct.mm_struct** %5
%10 = load %struct.vm_area_struct*, %struct.vm_area_struct** %6
%11 = load i64, i64* %7
%12 = load i32, i32* %8
%13 = call i32 @__handle_mm_fault(%struct.mm_struct* %9, %struct.vm_area_struct* %10, i64 %11, i32 %12)
%14 = and i32 %13, -17
ret i32 %14
}

LLVM IR (-O2):
%struct.mm_struct = type { i32 }
%struct.vm_area_struct = type { i32 }
define i32 @handle_mm_fault(%struct.mm_struct* %0, %struct.vm_area_struct* %1, i64 %2, i32 %3) {
%5 = tail call i32 @__handle_mm_fault(%struct.mm_struct* %0, %struct.vm_area_struct* %1, i64 %2, i32 %3)
%6 = and i32 %5, -17
ret i32 %6
}
/* Variables and functions */
int core_id();
int /*<<< orphan*/ sort(int, int);
int block_sort(int loop_count) {
  int core_no = core_id();
  int segment = 20 / loop_count;
  int head = core_no * segment;
  int tail = (core_no + 1) * segment - 1;
  if ((core_no + 1) >= loop_count) {
    tail = 20 - 1;
  }
  sort(head, tail);
}


x86 assembly (clang, -O0):
<block_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <core_id@plt>
mov    %eax,-0xc(%rbp)
mov    $0x14,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
imul   -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     1171 <block_sort+0x51>
movl   $0x13,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <sort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_sort>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <core_id@plt>
mov    %eax,%ecx
mov    $0x14,%eax
xor    %edx,%edx
idiv   %ebx
mov    %eax,%edi
imul   %ecx,%edi
add    $0x1,%ecx
imul   %ecx,%eax
add    $0xffffffff,%eax
cmp    %ebx,%ecx
mov    $0x13,%esi
cmovl  %eax,%esi
pop    %rbx
jmp    1030 <sort@plt>

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

LLVM IR (-O2):
define i32 @block_sort(i32 %0) {
%2 = tail call i32 (...) @core_id()
%3 = sdiv i32 20, %0
%4 = mul nsw i32 %3, %2
%5 = add nsw i32 %2, 1
%6 = mul nsw i32 %5, %3
%7 = add nsw i32 %6, -1
%8 = icmp slt i32 %5, %0
%9 = select i1 %8, i32 %7, i32 19
%10 = tail call i32 @sort(i32 %4, i32 %9)
ret i32 undef
}
int gcd1(int x, int y) {
  if (y == 0)
    return x;
  else
    return gcd1(y, x % y);
}


x86 assembly (clang, -O0):
<gcd1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gcd1+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <gcd1+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcd1@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd1>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd1+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd1+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd1(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
void avcodec_dct_alloc() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_dct_alloc() {
ret void
}
int d_size_strvec(int m) {
  int size = m * sizeof(double);
  return size;
}


x86 assembly (clang, -O0):
<d_size_strvec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_size_strvec>:
lea    0x0(,%rdi,8),%eax
ret

LLVM IR (-O0):
define i32 @d_size_strvec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 8
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @d_size_strvec(i32 %0) {
%2 = shl i32 %0, 3
ret i32 %2
}
int voisinBasDroite(int *tab, int position, int colonne) {
  int count = 0;
  tab += position;
  count += *(tab - 1 - colonne);
  count += *(tab - colonne);
  count += *(tab - 1);
  return count;
}


x86 assembly (clang, -O0):
<voisinBasDroite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
mov    -0x4(%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
mov    (%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4(%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<voisinBasDroite>:
movslq %esi,%rcx
lea    (%rdi,%rcx,4),%rax
lea    (%rdi,%rcx,4),%rsi
add    $0xfffffffffffffffc,%rsi
movslq %edx,%rdx
shl    $0x2,%rdx
sub    %rdx,%rsi
sub    %rdx,%rax
mov    (%rax),%eax
add    (%rsi),%eax
add    -0x4(%rdi,%rcx,4),%eax
ret

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

LLVM IR (-O2):
define i32 @voisinBasDroite(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = getelementptr inbounds i32, i32* %5, i64 -1
%7 = sext i32 %2 to i64
%8 = sub nsw i64 0, %7
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %5, i64 %8
%12 = load i32, i32* %11
%13 = add nsw i32 %12, %10
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
ret i32 %15
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ slab_put_item_into_freeq(struct item *);
void _slab_put_item(struct item *it) { slab_put_item_into_freeq(it); }


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

x86 assembly (clang, -O2):
<_slab_put_item>:
jmp    1030 <slab_put_item_into_freeq@plt>

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

LLVM IR (-O2):
%struct.item = type { i32 }
define void @_slab_put_item(%struct.item* %0) {
%2 = tail call i32 @slab_put_item_into_freeq(%struct.item* %0)
ret void
}
long decode2(long x, long y, long z) {
  long t1 = y - z;
  long t2 = x * t1;
  long t3 = (t1 << 63) >> 63;
  long t4 = t3 ^ t2;
  return t4;
}


x86 assembly (clang, -O0):
<decode2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x3f,%rax
sar    $0x3f,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
xor    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode2>:
mov    %rsi,%rax
sub    %rdx,%rax
imul   %rax,%rdi
and    $0x1,%eax
neg    %rax
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @decode2(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = sub nsw i64 %11, %12
store i64 %13, i64* %7
%14 = load i64, i64* %4
%15 = load i64, i64* %7
%16 = mul nsw i64 %14, %15
store i64 %16, i64* %8
%17 = load i64, i64* %7
%18 = shl i64 %17, 63
%19 = ashr i64 %18, 63
store i64 %19, i64* %9
%20 = load i64, i64* %9
%21 = load i64, i64* %8
%22 = xor i64 %20, %21
store i64 %22, i64* %10
%23 = load i64, i64* %10
ret i64 %23
}

LLVM IR (-O2):
define i64 @decode2(i64 %0, i64 %1, i64 %2) {
%4 = sub nsw i64 %1, %2
%5 = mul nsw i64 %4, %0
%6 = and i64 %4, 1
%7 = sub nsw i64 0, %6
%8 = xor i64 %5, %7
ret i64 %8
}
void initial(char *locker, int no) {
  int i, j;
  for (i = 0; i < 2000; i++) {
    locker[i] = 'c';
  }
}


x86 assembly (clang, -O0):
<initial>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7d0,-0x10(%rbp)
jge    1139 <initial+0x39>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x63,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <initial+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initial>:
push   %rax
mov    $0x7d0,%edx
mov    $0x63,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @initial(i8* nocapture writeonly %0, i32 %1) {
ret void
}
/* Variables and functions */
int f66(int *);
int f67(int *p) { return f66(p); }


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

x86 assembly (clang, -O2):
<f67>:
jmp    1030 <f66@plt>

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

LLVM IR (-O2):
define i32 @f67(i32* %0) {
%2 = tail call i32 @f66(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int extract_year(uint16_t date) {
  int year = date & 0x007f;
  if ((year >= 0) && (year <= 1999))
    year += 1900;
  else if ((year >= 100) && (year <= 126)) {
    year %= 100;
    year += 2000;
  }
  return year;
}


x86 assembly (clang, -O0):
<extract_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1137 <extract_year+0x37>
cmpl   $0x7cf,-0x8(%rbp)
jg     1137 <extract_year+0x37>
mov    -0x8(%rbp),%eax
add    $0x76c,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <extract_year+0x69>
cmpl   $0x64,-0x8(%rbp)
jl     1164 <extract_year+0x64>
cmpl   $0x7e,-0x8(%rbp)
jg     1164 <extract_year+0x64>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7d0,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <extract_year+0x69>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_year>:
and    $0x7f,%edi
lea    0x76c(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @extract_year(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 127
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 1999
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1900
store i32 %13, i32* %3
br label %26
14: ; preds = %8, %1
%15 = load i32, i32* %3
%16 = icmp sge i32 %15, 100
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sle i32 %18, 126
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %3
%22 = srem i32 %21, 100
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 2000
store i32 %24, i32* %3
br label %25
25: ; preds = %20, %17, %14
br label %26
26: ; preds = %25, %11
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @extract_year(i32 %0) {
%2 = and i32 %0, 127
%3 = add nuw nsw i32 %2, 1900
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ glWindowPos4f(int, int, int, int);
void glWindowPos4i(int x, int y, int z, int w) { glWindowPos4f(x, y, z, w); }


x86 assembly (clang, -O0):
<glWindowPos4i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <glWindowPos4f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glWindowPos4i>:
jmp    1030 <glWindowPos4f@plt>

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

LLVM IR (-O2):
define void @glWindowPos4i(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @glWindowPos4f(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}