xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fnMerge(int *, int, int, int);
void fnMergeSort(int a[], int low, int high) {
  int mid;
  if (low < high) {
    mid = (low + high) / 2;
    fnMergeSort(a, low, mid);
    fnMergeSort(a, mid + 1, high);
    fnMerge(a, low, mid, high);
  }
}


x86 assembly (clang, -O0):
<fnMergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <fnMergeSort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <fnMergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <fnMergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <fnMerge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnMergeSort>:
cmp    %edx,%esi
jge    1172 <fnMergeSort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1030 <fnMergeSort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <fnMergeSort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fnMerge@plt>
ret

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

LLVM IR (-O2):
define void @fnMergeSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @fnMergeSort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @fnMergeSort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @fnMerge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ ASYNC_pause_job();
int only_pause(void *args) {
  ASYNC_pause_job();
  return 1;
}


x86 assembly (clang, -O0):
<only_pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <ASYNC_pause_job@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<only_pause>:
push   %rax
xor    %eax,%eax
call   1030 <ASYNC_pause_job@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @only_pause(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @ASYNC_pause_job()
ret i32 1
}
unsigned xrop3_84_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | S;
  stk2 = ~stk2;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_84_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_84_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = xor i32 %25, -1
store i32 %26, i32* %9
%27 = load i32, i32* %5
%28 = load i32, i32* %9
%29 = or i32 %27, %28
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = xor i32 %30, -1
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %7
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = or i32 %38, %41
%43 = load i32, i32* %5
%44 = load i32, i32* %7
%45 = and i32 %43, %44
%46 = or i32 %42, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @xrop3_84_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ convert_int_to_ascii(int /*<<< orphan*/, char *,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ register_data(int, int);
int /*<<< orphan*/ register_size(int);
void collect_register_as_string(int n, char *buf) {
  convert_int_to_ascii(register_data(n, 1), buf, register_size(n));
}


x86 assembly (clang, -O0):
<collect_register_as_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <register_data@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <register_size@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <convert_int_to_ascii@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collect_register_as_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x1,%esi
call   1050 <register_data@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <register_size@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <convert_int_to_ascii@plt>

LLVM IR (-O0):
define void @collect_register_as_string(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = call i32 @register_data(i32 %5, i32 1)
%7 = load i8*, i8** %4
%8 = load i32, i32* %3
%9 = call i32 @register_size(i32 %8)
%10 = call i32 @convert_int_to_ascii(i32 %6, i8* %7, i32 %9)
ret void
}

LLVM IR (-O2):
define void @collect_register_as_string(i32 %0, i8* %1) {
%3 = tail call i32 @register_data(i32 %0, i32 1)
%4 = tail call i32 @register_size(i32 %0)
%5 = tail call i32 @convert_int_to_ascii(i32 %3, i8* %1, i32 %4)
ret void
}
/* Variables and functions */
char *date_now19(int);
char *date_get_now19(int utc_offset) { return date_now19(utc_offset); }


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

x86 assembly (clang, -O2):
<date_get_now19>:
jmp    1030 <date_now19@plt>

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

LLVM IR (-O2):
define i8* @date_get_now19(i32 %0) {
%2 = tail call i8* @date_now19(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ testGetDayOfWeek();
int /*<<< orphan*/ testGetDoomsday();
int /*<<< orphan*/ testIsLeapYear();
void testDoomsday() {
  testIsLeapYear();
  testGetDoomsday();
  testGetDayOfWeek();
}


x86 assembly (clang, -O0):
<testDoomsday>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <testIsLeapYear@plt>
mov    $0x0,%al
call   1030 <testGetDoomsday@plt>
mov    $0x0,%al
call   1040 <testGetDayOfWeek@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDoomsday>:
push   %rax
xor    %eax,%eax
call   1050 <testIsLeapYear@plt>
xor    %eax,%eax
call   1030 <testGetDoomsday@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <testGetDayOfWeek@plt>

LLVM IR (-O0):
define void @testDoomsday() {
%1 = call i32 (...) @testIsLeapYear()
%2 = call i32 (...) @testGetDoomsday()
%3 = call i32 (...) @testGetDayOfWeek()
ret void
}

LLVM IR (-O2):
define void @testDoomsday() {
%1 = tail call i32 (...) @testIsLeapYear()
%2 = tail call i32 (...) @testGetDoomsday()
%3 = tail call i32 (...) @testGetDayOfWeek()
ret void
}
void foo267() {}


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

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

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

LLVM IR (-O2):
define void @foo267() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void app_error(char *msg) {
  fprintf(stdout, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<app_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<app_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @app_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @app_error(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int sum(int, int);
int main(int argc, const char *argv[]) {
  int a = 1;
  int b = 2;
  int ans = sum(a, b);
  printf("sum(%d,%d) = %d\n", a, b, ans);
  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)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <sum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <sum@plt>
lea    0xec9(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"sum(%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
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 2, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @sum(i32 %9, i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"sum(%d,%d) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sum(i32 1, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 %3)
ret i32 0
}
void test_firstprivate() {
  int i;
#pragma omp simd firstprivate(
  for (i = 0; i < 16; ++i)
    ;
}


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

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

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

LLVM IR (-O2):
define void @test_firstprivate() {
ret void
}
void sysLed(int led, int col) {}


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

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

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

LLVM IR (-O2):
define void @sysLed(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
void *peek_r_unsafe(void *stack, const size_t *count, size_t size) {
  if (stack == NULL || count == NULL)
    return NULL;
  if (*count == 0)
    return NULL;
  return stack + (*count - 1) * size;
}


x86 assembly (clang, -O0):
<peek_r_unsafe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1126 <peek_r_unsafe+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1133 <peek_r_unsafe+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1169 <peek_r_unsafe+0x69>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    114e <peek_r_unsafe+0x4e>
movq   $0x0,-0x8(%rbp)
jmp    1169 <peek_r_unsafe+0x69>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
sub    $0x1,%rcx
imul   -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek_r_unsafe>:
xor    %eax,%eax
test   %rdi,%rdi
je     1122 <peek_r_unsafe+0x22>
test   %rsi,%rsi
je     1122 <peek_r_unsafe+0x22>
mov    (%rsi),%rax
test   %rax,%rax
je     1123 <peek_r_unsafe+0x23>
add    $0xffffffffffffffff,%rax
imul   %rdx,%rax
add    %rax,%rdi
mov    %rdi,%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @peek_r_unsafe(i8* %0, i64* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64
store i8* %0, i8** %5
store i64* %1, i64** %6
store i64 %2, i64* %7
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i64*, i64** %6
%12 = icmp eq i64* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10, %3
store i8* null, i8** %4
br label %27
14: ; preds = %10
%15 = load i64*, i64** %6
%16 = load i64, i64* %15
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i8* null, i8** %4
br label %27
19: ; preds = %14
%20 = load i8*, i8** %5
%21 = load i64*, i64** %6
%22 = load i64, i64* %21
%23 = sub i64 %22, 1
%24 = load i64, i64* %7
%25 = mul i64 %23, %24
%26 = getelementptr i8, i8* %20, i64 %25
store i8* %26, i8** %4
br label %27
27: ; preds = %19, %18, %13
%28 = load i8*, i8** %4
ret i8* %28
}

LLVM IR (-O2):
define i8* @peek_r_unsafe(i8* readnone %0, i64* %1, i64 %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i64* %1, null
%6 = or i1 %4, %5
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = load i64, i64* %1
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = add i64 %8, -1
%12 = mul i64 %11, %2
%13 = getelementptr i8, i8* %0, i64 %12
br label %14
14: ; preds = %7, %3, %10
%15 = phi i8* [ %13, %10 ], [ null, %3 ], [ null, %7 ]
ret i8* %15
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ addr_to_bytes(unsigned char *, int /*<<< orphan*/ const *);
int /*<<< orphan*/ haraka256_sk(unsigned char *, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
void prf_addr(unsigned char *out, const unsigned char *key,
              const uint32_t addr[8]) {
  unsigned char buf[32];
  unsigned char outbuf[32];
  (void)key;
  addr_to_bytes(buf, addr);
  haraka256_sk(outbuf, buf);
  memcpy(out, outbuf, 16);
}


x86 assembly (clang, -O0):
<prf_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <addr_to_bytes@plt>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <haraka256_sk@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x10,%edx
call   1050 <memcpy@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prf_addr>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rdx,%rsi
call   1040 <addr_to_bytes@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <haraka256_sk@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1050 <memcpy@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @prf_addr(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [32 x i8]
%8 = alloca [32 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%11 = load i32*, i32** %6
%12 = call i32 @addr_to_bytes(i8* %10, i32* %11)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%15 = call i32 @haraka256_sk(i8* %13, i8* %14)
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%18 = call i32 @memcpy(i8* %16, i8* %17, i32 16)
ret void
}

LLVM IR (-O2):
define void @prf_addr(i8* %0, i8* nocapture readnone %1, i32* %2) {
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%8 = call i32 @addr_to_bytes(i8* %6, i32* %2)
%9 = call i32 @haraka256_sk(i8* %7, i8* %6)
%10 = call i32 @memcpy(i8* %0, i8* %7, i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
char *ta_strndup(void *, char const *, int /*<<< orphan*/);
char *ta_strdup(void *ta_parent, const char *str) {
  return ta_strndup(ta_parent, str, str ? strlen(str) : 0);
}


x86 assembly (clang, -O0):
<ta_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <ta_strdup+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
jmp    1166 <ta_strdup+0x46>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    1166 <ta_strdup+0x46>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
call   1040 <ta_strndup@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
je     113b <ta_strdup+0x1b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
jmp    113d <ta_strdup+0x1d>
xor    %edx,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ta_strndup@plt>

LLVM IR (-O0):
define i8* @ta_strdup(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %9
%14 = phi i32 [ %11, %9 ], [ 0, %12 ]
%15 = call i8* @ta_strndup(i8* %5, i8* %6, i32 %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @ta_strdup(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
%8 = tail call i8* @ta_strndup(i8* %0, i8* %1, i32 %7)
ret i8* %8
}
void gdk_visual_type_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gdk_visual_type_get_type() {
ret void
}
void cygwin_premain2(int argc __attribute__((unused)),
                     char **argv __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @cygwin_premain2(i32 %0, i8** nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void Warning(const char *fmt, va_list ap) {
  printf("%6d Warning callback:\n");
  vprintf(fmt, ap);
}


x86 assembly (clang, -O0):
<Warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <vprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Warning>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <vprintf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"%6d Warning callback:\0A\00"
define void @Warning(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vprintf(i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"%6d Warning callback:\0A\00"
define void @Warning(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @vprintf(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isalnum(char);
void string2resname(char *s) {
  while (*s) {
    if (!isalnum(*s))
      *s = '_';
    ++s;
  }
}


x86 assembly (clang, -O0):
<string2resname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <string2resname+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    1145 <string2resname+0x35>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <string2resname+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string2resname>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     113d <string2resname+0x2d>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    112b <string2resname+0x1b>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     113d <string2resname+0x2d>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1120 <string2resname+0x10>
movb   $0x5f,-0x1(%rbx)
jmp    1120 <string2resname+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @string2resname(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %10
%5 = phi i8 [ %12, %10 ], [ %2, %1 ]
%6 = phi i8* [ %11, %10 ], [ %0, %1 ]
%7 = tail call i32 @isalnum(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 95, i8* %6
br label %10
10: ; preds = %9, %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %10, %1
ret void
}
void kol_wnd_move(unsigned x, unsigned y) {
  asm volatile("int $0x40" ::"a"(67), "b"(x), "c"(y), "d"(-1), "S"(-1));
}


x86 assembly (clang, -O0):
<kol_wnd_move>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%ebx
mov    -0x10(%rbp),%ecx
mov    $0x43,%eax
mov    $0xffffffff,%esi
mov    %esi,%edx
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_wnd_move>:
push   %rbx
mov    %esi,%ecx
mov    %edi,%ebx
mov    $0x43,%eax
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define void @kol_wnd_move(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
ret void
}

LLVM IR (-O2):
define void @kol_wnd_move(i32 %0, i32 %1) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},{dx},{si},~{dirflag},~{fpsr},~{flags}"(i32 67, i32 %0, i32 %1, i32 -1, i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void mdns_socket_close(int sock) { close(sock); }


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

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

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

LLVM IR (-O2):
define void @mdns_socket_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
char *getprogname();
int main(void) {
  const char *progname;
  progname = getprogname();
  return progname == NULL;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getprogname@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* (...) @getprogname()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* (...) @getprogname()
%2 = icmp eq i8* %1, null
%3 = zext i1 %2 to i32
ret i32 %3
}
void test1_ptr_arith_bad(int x) {
  int buf[100];
  int *p = buf;
  p = p + 99;
  p[1] = 1;
}


x86 assembly (clang, -O0):
<test1_ptr_arith_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
add    $0x18c,%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
movl   $0x1,0x4(%rax)
add    $0x130,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test1_ptr_arith_bad(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca i32*
store i32 %0, i32* %2
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
store i32* %5, i32** %4
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 99
store i32* %7, i32** %4
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 1, i32* %9
ret void
}

LLVM IR (-O2):
define void @test1_ptr_arith_bad(i32 %0) {
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ sleep(int);
int cmdPause(int argc, char *argv[]) {
  int x;
  if (argc >= 2)
    x = (atoi(argv[1]) > 0) ? atoi(argv[1]) : 1;
  else
    x = 1;
  sleep(x);
  return (0);
}


x86 assembly (clang, -O0):
<cmdPause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     117c <cmdPause+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
cmp    $0x0,%eax
jle    1164 <cmdPause+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1171 <cmdPause+0x51>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <cmdPause+0x51>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <cmdPause+0x63>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdPause>:
push   %rax
mov    %edi,%eax
mov    $0x1,%edi
cmp    $0x2,%eax
jl     1140 <cmdPause+0x20>
mov    0x8(%rsi),%rdi
call   1030 <atoi@plt>
test   %eax,%eax
mov    $0x1,%edi
cmovg  %eax,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @cmdPause(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp sgt i32 %7, 1
%9 = select i1 %8, i32 %7, i32 1
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %9, %4 ], [ 1, %2 ]
%12 = tail call i32 @sleep(i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
void func(void) {
  char buf[8];
  gets(buf);
  printf(buf);
}


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

x86 assembly (clang, -O2):
<func>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @func() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* %4)
ret void
}

LLVM IR (-O2):
define void @func() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @printf(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putenv(char *);
void set_preload(void) { putenv("LD_PRELOAD=libmat.so"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"LD_PRELOAD=libmat.so\00"
define void @set_preload() {
%1 = call i32 @putenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"LD_PRELOAD=libmat.so\00"
define void @set_preload() {
%1 = tail call i32 @putenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
int test(unsigned char iov_len, int count, int i) {
  unsigned char bytes = 0;
  if ((unsigned char)((char)127 - bytes) < iov_len)
    return 22;
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movzbl -0x11(%rbp),%ecx
mov    $0x7f,%eax
sub    %ecx,%eax
movzbl %al,%eax
movzbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jge    113a <test+0x3a>
movl   $0x16,-0x4(%rbp)
jmp    1141 <test+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
xor    %ecx,%ecx
test   %dil,%dil
mov    $0x16,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8 %0, i8* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 0, i8* %8
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = sub nsw i32 127, %10
%12 = trunc i32 %11 to i8
%13 = zext i8 %12 to i32
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 22, i32* %4
br label %19
18: ; preds = %3
store i32 0, i32* %4
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @test(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp slt i8 %0, 0
%5 = select i1 %4, i32 22, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
const char *cJSON_Version(void) {
  static char version[15];
  sprintf(version, "%i.%i.%i", 1, 4, 3);
  return version;
}


x86 assembly (clang, -O0):
<cJSON_Version>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x1,%edx
mov    $0x4,%ecx
mov    $0x3,%r8d
call   1030 <sprintf@plt>
lea    0x2eeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSON_Version>:
push   %rbx
lea    0x2f11(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
mov    $0x4,%ecx
mov    $0x3,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 4, i32 3)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}

LLVM IR (-O2):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 4, i32 3)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ sort(char *, char *);
int main(int argc, char *argv[]) {
  sort("input.txt", "output.txt");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [11 x i8] c"output.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @sort(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [11 x i8] c"output.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sort(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int pRec4p(int argc) { return (argc >= 4); }


x86 assembly (clang, -O0):
<pRec4p>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pRec4p>:
xor    %eax,%eax
cmp    $0x4,%edi
setge  %al
ret

LLVM IR (-O0):
define i32 @pRec4p(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 4
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @pRec4p(i32 %0) {
%2 = icmp sgt i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
int __attribute__((no)) ngeu(unsigned a, unsigned b) { return -(a >= b); }


x86 assembly (clang, -O0):
<ngeu>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ngeu>:
xor    %eax,%eax
cmp    %esi,%edi
adc    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @ngeu(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 = icmp uge i32 %5, %6
%8 = zext i1 %7 to i32
%9 = sub nsw i32 0, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @ngeu(i32 %0, i32 %1) {
%3 = icmp uge i32 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _hmt_register_covercase(char *, char *);
void _hmt_covercase_HMM_DivideVec3_init(void) {
  _hmt_register_covercase("HMM_DivideVec3", "1");
}


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

x86 assembly (clang, -O2):
<_hmt_covercase_HMM_DivideVec3_init>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
jmp    1030 <_hmt_register_covercase@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"HMM_DivideVec3\00"
@.str.1 = [2 x i8] c"1\00"
define void @_hmt_covercase_HMM_DivideVec3_init() {
%1 = tail call i32 @_hmt_register_covercase(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int at_client_rejected() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @at_client_rejected() {
ret i32 0
}
/* Variables and functions */
int bar(int);
int foo(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", foo(8));
  printf("%d\n", bar(5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8,%edi
call   1050 <foo@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1030 <bar@plt>
mov    %eax,%esi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x8,%edi
call   1050 <foo@plt>
lea    0xebe(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1030 <bar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @bar(i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ findPalind(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char arr[100001];
  scanf("%s", arr);
  findPalind(arr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x186b0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x186b0(%rbp),%rdi
call   1030 <findPalind@plt>
xor    %eax,%eax
add    $0x186b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x186b0,%rsp
lea    0xed1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <findPalind@plt>
xor    %eax,%eax
add    $0x186b0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100001 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%6 = call i32 @findPalind(i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100001 x i8]
%2 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @findPalind(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(int argc, char **argv) {
  printf("%i %i %i %i\n", sizeof(char), sizeof(short), sizeof(int),
         sizeof(long));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
mov    $0x8,%r8d
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    $0x1,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
mov    $0x8,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%i %i %i %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 4, i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
bool same(char *strA, char *strB) { return !strcmp(strA, strB); }


x86 assembly (clang, -O0):
<same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @same(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %5, i8* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @same(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ wait();
void main() {
  *((volatile unsigned int *)0x2009C020) = (1 << 18);
  while (1) {
    *((volatile unsigned int *)0x2009C034) = (1 << 18);
    wait();
    *((volatile unsigned int *)0x2009C034) = 0;
    wait();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2009c020,%eax
movl   $0x40000,(%rax)
mov    $0x2009c034,%eax
movl   $0x40000,(%rax)
mov    $0x0,%al
call   1030 <wait@plt>
mov    $0x2009c034,%eax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <wait@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x40000,0x2009c020
nopl   0x0(%rax)
movl   $0x40000,0x2009c034
xor    %eax,%eax
call   1030 <wait@plt>
movl   $0x0,0x2009c034
xor    %eax,%eax
call   1030 <wait@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define void @main() {
store volatile i32 262144, i32* inttoptr (i64 537509920 to i32*)
br label %1
1: ; preds = %0, %1
store volatile i32 262144, i32* inttoptr (i64 537509940 to i32*)
%2 = call i32 (...) @wait()
store volatile i32 0, i32* inttoptr (i64 537509940 to i32*)
%3 = call i32 (...) @wait()
br label %1
}

LLVM IR (-O2):
define void @main() {
store volatile i32 262144, i32* inttoptr (i64 537509920 to i32*)
br label %1
1: ; preds = %0, %1
store volatile i32 262144, i32* inttoptr (i64 537509940 to i32*)
%2 = tail call i32 (...) @wait()
store volatile i32 0, i32* inttoptr (i64 537509940 to i32*)
%3 = tail call i32 (...) @wait()
br label %1
}
void xmlInitThreads(void) {}


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

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

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

LLVM IR (-O2):
define void @xmlInitThreads() {
ret void
}