xunge/DecIR huggingface dataset:
/* Variables and functions */
int myStrLen(char *);
int /*<<< orphan*/ printf(char *, int);
main(void) {
  int a;
  char str[8] = "gopal";
  a = myStrLen(str);
  printf("length = %d\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <myStrLen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x6c61706f67,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1040 <myStrLen@plt>
lea    0xec2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"length = %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 465491226471, i64* %1
%3 = call i32 @myStrLen(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_ivector(int *Array, int Lo, int High) {
  int ArrayLength;
  ArrayLength = High - Lo + 1;
  free((char *)(Array + Lo - 1));
}


x86 assembly (clang, -O0):
<free_ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_ivector>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
add    $0xfffffffffffffffc,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_ivector(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* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %8, %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = getelementptr inbounds i32, i32* %15, i64 -1
%17 = bitcast i32* %16 to i8*
%18 = call i32 @free(i8* %17)
ret void
}

LLVM IR (-O2):
define void @free_ivector(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 = bitcast i32* %6 to i8*
%8 = tail call i32 @free(i8* %7)
ret void
}
int do_018() { return 18; }


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

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

LLVM IR (-O0):
define i32 @do_018() {
ret i32 18
}

LLVM IR (-O2):
define i32 @do_018() {
ret i32 18
}
/* Variables and functions */
int /*<<< orphan*/ check();
int /*<<< orphan*/ foo();
int /*<<< orphan*/ init();
int main(void) {
  init();
  foo();
  check();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @check()
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t set_trail_0s(uint64_t u) { return (u - 1) | u; }


x86 assembly (clang, -O0):
<set_trail_0s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
or     -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_trail_0s>:
lea    -0x1(%rdi),%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @set_trail_0s(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = load i32, i32* %2
%6 = or i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @set_trail_0s(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = or i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ foo(int *);
int main() {
  int arr[3];
  int overflow = 1000;
  arr[0] = 10;
  arr[1] = 20;
  arr[2] = 30;
  foo(arr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x14(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0x1e,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x140000000a,%rax
mov    %rax,0xc(%rsp)
movl   $0x1e,0x14(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 1000, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 10, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 20, i32* %5
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 30, i32* %6
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%8 = call i32 @foo(i32* %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 10, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 20, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 30, i32* %5
%6 = call i32 @foo(i32* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ goodG2B();
void CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_good() { goodG2B(); }


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

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

LLVM IR (-O0):
define void @CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_good() {
%1 = call i32 (...) @goodG2B()
ret void
}

LLVM IR (-O2):
define void @CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_good() {
%1 = tail call i32 (...) @goodG2B()
ret void
}
int is_in_bound(int *arr, int size, int *ptr) {
  if (ptr < arr || ptr > arr + size)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1139 <is_in_bound+0x39>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jbe    1145 <is_in_bound+0x45>
movl   $0x0,-0x4(%rbp)
jmp    114c <is_in_bound+0x4c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
cmp    %rdi,%rdx
setae  %al
movslq %esi,%rcx
lea    (%rdi,%rcx,4),%rcx
cmp    %rdx,%rcx
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_in_bound(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = icmp uge i32* %2, %0
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = icmp uge i32* %6, %2
%8 = select i1 %4, i1 %7, i1 false
%9 = zext i1 %8 to i32
ret i32 %9
}
unsigned int getForce(unsigned char boardNumber, unsigned char rowNumber,
                      unsigned char pinNumber) {
  unsigned short value = getValueInternal((unsigned int)(boardNumber)*32 +
                                          rowNumber * 8 + pinNumber);
  unsigned long intermediate = ((unsigned long)10000) * 1024 / value - 10000;
  unsigned long forceInGrams = (unsigned long)2000000 / intermediate;
  return (unsigned int)forceInGrams;
}


x86 assembly (clang, -O0):
<getForce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%edi
shl    $0x5,%edi
movzbl -0x2(%rbp),%eax
shl    $0x3,%eax
add    %eax,%edi
movzbl -0x3(%rbp),%eax
add    %eax,%edi
mov    $0x0,%al
call   1030 <getValueInternal@plt>
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
mov    %eax,%ecx
mov    $0x9c4000,%eax
xor    %edx,%edx
div    %rcx
sub    $0x2710,%rax
mov    %rax,-0x10(%rbp)
mov    $0x1e8480,%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getForce>:
push   %rbx
shl    $0x5,%edi
lea    (%rdi,%rsi,8),%edi
add    %edx,%edi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getValueInternal@plt>
movzwl %ax,%ecx
mov    $0x9c4000,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ecx
add    $0xffffffffffffd8f0,%rcx
cmp    $0x1e8480,%rcx
ja     114b <getForce+0x3b>
mov    $0x1e8480,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getForce(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i16
%8 = alloca i64
%9 = alloca i64
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = mul i32 %11, 32
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = mul nsw i32 %14, 8
%16 = add i32 %12, %15
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = add i32 %16, %18
%20 = call i32 (i32, ...) bitcast (i32 (...)* @getValueInternal to i32 (i32, ...)*)(i32 %19)
%21 = trunc i32 %20 to i16
store i16 %21, i16* %7
%22 = load i16, i16* %7
%23 = zext i16 %22 to i64
%24 = udiv i64 10240000, %23
%25 = sub i64 %24, 10000
store i64 %25, i64* %8
%26 = load i64, i64* %8
%27 = udiv i64 2000000, %26
store i64 %27, i64* %9
%28 = load i64, i64* %9
%29 = trunc i64 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
define i32 @getForce(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %0 to i32
%5 = shl nuw nsw i32 %4, 5
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 3
%8 = add nuw nsw i32 %7, %5
%9 = zext i8 %2 to i32
%10 = add nuw nsw i32 %8, %9
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @getValueInternal to i32 (i32, ...)*)(i32 %10)
%12 = and i32 %11, 65535
%13 = udiv i32 10240000, %12
%14 = zext i32 %13 to i64
%15 = add nsw i64 %14, -10000
%16 = udiv i64 2000000, %15
%17 = trunc i64 %16 to i32
ret i32 %17
}
/* Variables and functions */
scalar_t__ input_joystick_available();
char const *lang_get(char *);
const char *f_input_fire1() {
  return lang_get(input_joystick_available() ? "INPUT_JOY_FIRE1"
                                             : "INPUT_KEYB_FIRE1");
}


x86 assembly (clang, -O0):
<f_input_fire1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <input_joystick_available@plt>
mov    %rax,%rcx
lea    0xedb(%rip),%rdi
lea    0xec4(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1030 <lang_get@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_input_fire1>:
push   %rax
xor    %eax,%eax
call   1040 <input_joystick_available@plt>
test   %rax,%rax
lea    0xede(%rip),%rax
lea    0xec7(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <lang_get@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"INPUT_JOY_FIRE1\00"
@.str.1 = [17 x i8] c"INPUT_KEYB_FIRE1\00"
define i8* @f_input_fire1() {
%1 = call i64 (...) @input_joystick_available()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0)
%5 = call i8* @lang_get(i8* %4)
ret i8* %5
}

LLVM IR (-O2):
@.str = [16 x i8] c"INPUT_JOY_FIRE1\00"
@.str.1 = [17 x i8] c"INPUT_KEYB_FIRE1\00"
define i8* @f_input_fire1() {
%1 = tail call i64 (...) @input_joystick_available()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
%4 = tail call i8* @lang_get(i8* %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xb2() {
  Assert_real((isbdigit(178) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              895, ("isbdigit should be 0 for 0xb2"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xb2>:
push   %rax
mov    $0xb2,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x37f,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

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

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xb2\00"
define void @t_isbdigit_0xb2() {
%1 = tail call i64 @isbdigit(i32 178)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 895, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long long __builtin_arm_rbit64(unsigned long long);
unsigned long long rbit64(unsigned long long a) {
  return __builtin_arm_rbit64(a);
}


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

x86 assembly (clang, -O2):
<rbit64>:
jmp    1030 <__builtin_arm_rbit64@plt>

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

LLVM IR (-O2):
define i64 @rbit64(i64 %0) {
%2 = tail call i64 @__builtin_arm_rbit64(i64 %0)
ret i64 %2
}
double __attribute__((no)) not_fabs(double x) { return x >= 0.0 ? x : -x; }


x86 assembly (clang, -O0):
<not_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112a <not_fabs+0x2a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114b <not_fabs+0x4b>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_fabs>:
movapd 0xef8(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmplesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @not_fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load double, double* %2
br label %10
7: ; preds = %1
%8 = load double, double* %2
%9 = fneg double %8
br label %10
10: ; preds = %7, %5
%11 = phi double [ %6, %5 ], [ %9, %7 ]
ret double %11
}

LLVM IR (-O2):
define double @not_fabs(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %0, double %3
ret double %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  char is_hint;
};
typedef TYPE_1__ XMotionEvent;

/* Variables and functions */
void set_XMotionEvent_is_hint(void *_p, char _v) {
  ((XMotionEvent *)_p)->is_hint = (char)_v;
}


x86 assembly (clang, -O0):
<set_XMotionEvent_is_hint>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XMotionEvent_is_hint>:
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i8 }
define void @set_XMotionEvent_is_hint(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i8 %5, i8* %8
ret void
}

LLVM IR (-O2):
define void @set_XMotionEvent_is_hint(i8* nocapture writeonly %0, i8 signext %1) {
store i8 %1, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ start_netlink_monitor();
int main(int argc, char **argv) {
  start_netlink_monitor();
  return 0;
}


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

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

LLVM IR (-O0):
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 (...) @start_netlink_monitor()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @start_netlink_monitor()
ret i32 0
}
char *print_dec_2(val)
unsigned long val;
{
  static char vbuf[32];
  sprintf(vbuf, "%lu", val);
  return vbuf;
}


x86 assembly (clang, -O0):
<print_dec_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0x2f19(%rip),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2f04(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dec_2>:
push   %rbx
mov    %rdi,%rdx
lea    0x2f25(%rip),%rbx
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@print_dec_2.vbuf = internal global [32 x i8] zeroinitializer
@.str = [4 x i8] c"%lu\00"
define i8* @print_dec_2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @print_dec_2.vbuf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %3)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @print_dec_2.vbuf, i64 0, i64 0)
}

LLVM IR (-O2):
@print_dec_2.vbuf = internal global [32 x i8] zeroinitializer
@.str = [4 x i8] c"%lu\00"
define i8* @print_dec_2(i64 %0) {
%2 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @print_dec_2.vbuf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @print_dec_2.vbuf, i64 0, i64 0)
}
/* Variables and functions */
scalar_t__ board_is_bbg1();
scalar_t__ board_is_bone();
scalar_t__ board_is_bone_lt();
int board_is_beaglebonex(void) {
  return board_is_bone() || board_is_bone_lt() || board_is_bbg1();
}


x86 assembly (clang, -O0):
<board_is_beaglebonex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <board_is_bone@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    117b <board_is_beaglebonex+0x4b>
mov    $0x0,%al
call   1050 <board_is_bone_lt@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    117b <board_is_beaglebonex+0x4b>
mov    $0x0,%al
call   1040 <board_is_bbg1@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_is_beaglebonex>:
push   %rbx
xor    %eax,%eax
call   1030 <board_is_bone@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    115d <board_is_beaglebonex+0x2d>
xor    %eax,%eax
call   1050 <board_is_bone_lt@plt>
test   %rax,%rax
jne    115d <board_is_beaglebonex+0x2d>
xor    %eax,%eax
call   1040 <board_is_bbg1@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @board_is_beaglebonex() {
%1 = call i64 (...) @board_is_bone()
%2 = icmp ne i64 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = call i64 (...) @board_is_bone_lt()
%5 = icmp ne i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = call i64 (...) @board_is_bbg1()
%8 = icmp ne i64 %7, 0
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ true, %3 ], [ true, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @board_is_beaglebonex() {
%1 = tail call i64 (...) @board_is_bone()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i64 (...) @board_is_bone_lt()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 (...) @board_is_bbg1()
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %0
%11 = phi i32 [ 1, %3 ], [ 1, %0 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
float logf(float);
float logit(float p) { return logf(p / (1 - p)); }


x86 assembly (clang, -O0):
<logit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
subss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <logf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logit>:
movss  0xee8(%rip),%xmm1
subss  %xmm0,%xmm1
divss  %xmm1,%xmm0
jmp    1030 <logf@plt>

LLVM IR (-O0):
define float @logit(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fsub float 1.000000e+00, %4
%6 = fdiv float %3, %5
%7 = call float @logf(float %6)
ret float %7
}

LLVM IR (-O2):
define float @logit(float %0) {
%2 = fsub float 1.000000e+00, %0
%3 = fdiv float %0, %2
%4 = tail call float @logf(float %3)
ret float %4
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ vwarn(char const *, int /*<<< orphan*/);
void vdie(const char *format, va_list alist) {
  vwarn(format, alist);
  exit(1);
}


x86 assembly (clang, -O0):
<vdie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <vwarn@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<vdie>:
push   %rax
call   1030 <vwarn@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @vdie(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @vwarn(i8* %5, i32 %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @vdie(i8* %0, i32 %1) {
%3 = tail call i32 @vwarn(i8* %0, i32 %1)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
unsigned int time_reference_ticks();
unsigned int time_ticks_passed(unsigned int reference) {
  unsigned int now = time_reference_ticks();
  if (now > reference)
    return now - reference;
  return (unsigned int)(reference - now);
}


x86 assembly (clang, -O0):
<time_ticks_passed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <time_reference_ticks@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    113f <time_ticks_passed+0x2f>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <time_ticks_passed+0x38>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_ticks_passed>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <time_reference_ticks@plt>
mov    %ebx,%ecx
sub    %eax,%ecx
neg    %ecx
sub    %eax,%ebx
cmovb  %ecx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @time_ticks_passed(i32 %0) {
%2 = tail call i32 (...) @time_reference_ticks()
%3 = icmp ugt i32 %2, %0
%4 = sub i32 %2, %0
%5 = sub i32 %0, %2
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int k;
  int n;
  if (!(i == 0 && k == n && n >= 0))
    return 0;
  while (i < n) {
    k--;
    i += 2;
  }
  assert(2 * k >= n - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113f <main+0x2f>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    113f <main+0x2f>
cmpl   $0x0,-0x10(%rbp)
jge    114b <main+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1195 <main+0x85>
jmp    1150 <main+0x40>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1173 <main+0x63>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x40>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %4
%13 = icmp sge i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %11, %7, %0
store i32 0, i32* %1
br label %33
15: ; preds = %11
br label %16
16: ; preds = %20, %15
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32, i32* %3
%22 = add nsw i32 %21, -1
store i32 %22, i32* %3
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 2
store i32 %24, i32* %2
br label %16
25: ; preds = %16
%26 = load i32, i32* %3
%27 = mul nsw i32 2, %26
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 1
%30 = icmp sge i32 %27, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
store i32 0, i32* %1
br label %33
33: ; preds = %25, %14
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hash(int);
void test() {
  int i;
  for (i = -1000; i <= 1000; i++) {
    {
      hash(1);
      hash(i);
    };
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xfffffc18,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jg     114c <test+0x3c>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    $0xfffffc18,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1120 <test+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
store i32 -1000, i32* %1
br label %2
2: ; preds = %9, %0
%3 = load i32, i32* %1
%4 = icmp sle i32 %3, 1000
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = call i32 @hash(i32 1)
%7 = load i32, i32* %1
%8 = call i32 @hash(i32 %7)
br label %9
9: ; preds = %5
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %2
12: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @test() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -1000, %0 ], [ %5, %1 ]
%3 = tail call i32 @hash(i32 1)
%4 = tail call i32 @hash(i32 %2)
%5 = add nsw i32 %2, 1
%6 = icmp eq i32 %5, 1001
br i1 %6, label %7, label %1
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_50(int /*<<< orphan*/);
int gen_50() { handle_50(0); }


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

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

LLVM IR (-O0):
define i32 @gen_50() {
%1 = alloca i32
%2 = call i32 @handle_50(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_50() {
%1 = tail call i32 @handle_50(i32 0)
ret i32 undef
}
/* Variables and functions */
double cos(double);
double sin(double);
double cot(double n) {
  if (sin(n) == 0) {
    return 0. / 0.;
  }
  return cos(n) / sin(n);
}


x86 assembly (clang, -O0):
<cot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115c <cot+0x3c>
jp     115c <cot+0x3c>
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <cot+0x66>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cot>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1148 <cot+0x28>
jp     1148 <cot+0x28>
movsd  0xebd(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @cot(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call double @sin(double %4)
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store double 0x7FF8000000000000, double* %2
br label %14
8: ; preds = %1
%9 = load double, double* %3
%10 = call double @cos(double %9)
%11 = load double, double* %3
%12 = call double @sin(double %11)
%13 = fdiv double %10, %12
store double %13, double* %2
br label %14
14: ; preds = %8, %7
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @cot(double %0) {
%2 = tail call double @sin(double %0)
%3 = fcmp oeq double %2, 0.000000e+00
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call double @cos(double %0)
%6 = tail call double @sin(double %0)
%7 = fdiv double %5, %6
br label %8
8: ; preds = %1, %4
%9 = phi double [ %7, %4 ], [ 0x7FF8000000000000, %1 ]
ret double %9
}
int __attribute__((no)) foo(unsigned short *p) {
  int a = *p;
  asm volatile("nop");
  asm volatile("nop" : : "D"(a));
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
mov    %eax,-0xc(%rbp)
nop
mov    -0xc(%rbp),%edi
nop
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movzwl (%rdi),%edi
nop
nop
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @foo(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @foo(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = zext i16 %2 to i32
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "{di},~{dirflag},~{fpsr},~{flags}"(i32 %3)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int pow_mod_p(int, int);
uint64_t powmodp(uint64_t a, uint64_t b) {
  if (a > 0xffffffffffffffc5ull)
    a %= 0xffffffffffffffc5ull;
  return pow_mod_p(a, b);
}


x86 assembly (clang, -O0):
<powmodp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffffffffffc5,%rax
jbe    1141 <powmodp+0x31>
movslq -0x4(%rbp),%rax
mov    $0xffffffffffffffc5,%rcx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <pow_mod_p@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powmodp>:
lea    0x3b(%rdi),%eax
cmp    $0xffffffc6,%edi
cmovae %eax,%edi
jmp    1030 <pow_mod_p@plt>

LLVM IR (-O0):
define i32 @powmodp(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 = sext i32 %5 to i64
%7 = icmp ugt i64 %6, -59
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = urem i64 %10, -59
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
br label %13
13: ; preds = %8, %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @pow_mod_p(i32 %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @powmodp(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, -59
%4 = add i32 %0, 59
%5 = select i1 %3, i32 %4, i32 %0
%6 = tail call i32 @pow_mod_p(i32 %5, i32 %1)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_rtclock_hrtimer() {
  printf("NOT IMPLEMENTED:"
         "pa_rtclock_hrtimer"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"NOT IMPLEMENTED:pa_rtclock_hrtimer\0A\00"
define i32 @pa_rtclock_hrtimer() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [35 x i8] c"NOT IMPLEMENTED:pa_rtclock_hrtimer\00"
define i32 @pa_rtclock_hrtimer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void f() { char a; }


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

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i8
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
int f3() {
  enum E3 { D = 10, E, F };
  static enum E3 e;
  enum E3 e_which_stays;
}


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

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

LLVM IR (-O0):
@f3.e = internal global i32 0
define i32 @f3() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @f3() {
ret i32 undef
}
/* Variables and functions */
int partitioning(int *, int, int);
void quicksort(int *tab, int p, int r) {
  int q;
  if (p < r) {
    q = partitioning(tab, p, r);
    quicksort(tab, p, q);
    quicksort(tab, q + 1, r);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
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    1171 <quicksort+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <partitioning@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1165 <quicksort+0x45>
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <partitioning@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <quicksort@plt>
add    $0x1,%ebp
mov    %ebp,%ebx
cmp    %r14d,%ebp
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quicksort(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 %23
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partitioning(i32* %12, i32 %13, i32 %14)
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
br label %23
23: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %10
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ %1, %3 ]
%7 = tail call i32 @partitioning(i32* %0, i32 %6, i32 %2)
tail call void @quicksort(i32* %0, i32 %6, i32 %7)
%8 = add nsw i32 %7, 1
%9 = icmp slt i32 %8, %2
br i1 %9, label %5, label %10
10: ; preds = %5, %3
ret void
}
/* Variables and functions */
scalar_t__ handle_char(char);
int /*<<< orphan*/ promt();
scalar_t__ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ wait_jobs();
void zhsh_interactive_mode_start(void) {
  char c;
  for (;;) {
    wait_jobs();
    promt();
    while (read(0, &c, 1) && handle_char(c))
      ;
  }
}


x86 assembly (clang, -O0):
<zhsh_interactive_mode_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <wait_jobs@plt>
mov    $0x0,%al
call   1060 <promt@plt>
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
je     118b <zhsh_interactive_mode_start+0x4b>
movsbl -0x1(%rbp),%edi
call   1050 <handle_char@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    119b <zhsh_interactive_mode_start+0x5b>
jmp    11a0 <zhsh_interactive_mode_start+0x60>
jmp    1156 <zhsh_interactive_mode_start+0x16>
jmp    1148 <zhsh_interactive_mode_start+0x8>

x86 assembly (clang, -O2):
<zhsh_interactive_mode_start>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <wait_jobs@plt>
xor    %eax,%eax
call   1060 <promt@plt>
xchg   %ax,%ax
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
je     1150 <zhsh_interactive_mode_start+0x10>
movsbl 0xf(%rsp),%edi
call   1050 <handle_char@plt>
test   %rax,%rax
jne    1160 <zhsh_interactive_mode_start+0x20>
jmp    1150 <zhsh_interactive_mode_start+0x10>

LLVM IR (-O0):
define void @zhsh_interactive_mode_start() {
%1 = alloca i8
br label %2
2: ; preds = %15, %0
%3 = call i32 (...) @wait_jobs()
%4 = call i32 (...) @promt()
br label %5
5: ; preds = %14, %2
%6 = call i64 @read(i32 0, i8* %1, i32 1)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i8, i8* %1
%10 = call i64 @handle_char(i8 signext %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %8, %5
%13 = phi i1 [ false, %5 ], [ %11, %8 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %5
15: ; preds = %12
br label %2
}

LLVM IR (-O2):
define void @zhsh_interactive_mode_start() {
%1 = alloca i8
br label %3
2: ; preds = %6, %9
br label %3
3: ; preds = %2, %0
%4 = tail call i32 (...) @wait_jobs()
%5 = tail call i32 (...) @promt()
br label %6
6: ; preds = %9, %3
%7 = call i64 @read(i32 0, i8* %1, i32 1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %2, label %9
9: ; preds = %6
%10 = load i8, i8* %1
%11 = tail call i64 @handle_char(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %2, label %6
}
adrx0regx1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (((float *)10000000)[x0]) = (p1[x1]); }


x86 assembly (clang, -O0):
<adrx0regx1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x10(%rbp),%rcx
mov    $0x989680,%eax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrx0regx1_set>:
movslq %esi,%rax
movss  (%rcx,%rax,4),%xmm0
movslq %edi,%rax
movss  %xmm0,0x989680(,%rax,4)
ret

LLVM IR (-O0):
define i32 @adrx0regx1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %22
store float %20, float* %23
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
define i32 @adrx0regx1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds float, float* %5, i64 %7
%9 = load float, float* %8
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %10
store float %9, float* %11
ret i32 undef
}
/* Variables and functions */
unsigned short MMCSD_sendCmd(int, int /*<<< orphan*/, int, int);
unsigned short MMCSD_allSendCID(void) {
  return MMCSD_sendCmd((2 | 0x0400), 0, 1, 0x0004);
}


x86 assembly (clang, -O0):
<MMCSD_allSendCID>:
push   %rbp
mov    %rsp,%rbp
mov    $0x402,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1030 <MMCSD_sendCmd@plt>
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMCSD_allSendCID>:
mov    $0x402,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
jmp    1030 <MMCSD_sendCmd@plt>

LLVM IR (-O0):
define zeroext i16 @MMCSD_allSendCID() {
%1 = call zeroext i16 @MMCSD_sendCmd(i32 1026, i32 0, i32 1, i32 4)
ret i16 %1
}

LLVM IR (-O2):
define zeroext i16 @MMCSD_allSendCID() {
%1 = tail call zeroext i16 @MMCSD_sendCmd(i32 1026, i32 0, i32 1, i32 4)
ret i16 %1
}
int Get_grid_rank(void *self, int grid, int *rank) {
  if (grid == 0) {
    *rank = 2;
    return (0);
  } else if (grid == 1) {
    *rank = 0;
    return (0);
  } else {
    *rank = -1;
    return (1);
  }
}


x86 assembly (clang, -O0):
<Get_grid_rank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    112f <Get_grid_rank+0x2f>
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1160 <Get_grid_rank+0x60>
cmpl   $0x1,-0x14(%rbp)
jne    114f <Get_grid_rank+0x4f>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1160 <Get_grid_rank+0x60>
mov    -0x20(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_grid_rank>:
mov    %esi,%eax
test   %esi,%esi
je     1112 <Get_grid_rank+0x12>
cmp    $0x1,%eax
jne    111a <Get_grid_rank+0x1a>
xor    %ecx,%ecx
xor    %eax,%eax
mov    %ecx,(%rdx)
ret
mov    $0x2,%ecx
mov    %ecx,(%rdx)
ret
mov    $0x1,%eax
mov    $0xffffffff,%ecx
mov    %ecx,(%rdx)
ret

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

LLVM IR (-O2):
define i32 @Get_grid_rank(i8* nocapture readnone %0, i32 %1, i32* nocapture writeonly %2) {
switch i32 %1, label %5 [
i32 0, label %6
i32 1, label %4
]
4: ; preds = %3
br label %6
5: ; preds = %3
br label %6
6: ; preds = %3, %5, %4
%7 = phi i32 [ -1, %5 ], [ 0, %4 ], [ 2, %3 ]
%8 = phi i32 [ 1, %5 ], [ 0, %4 ], [ %1, %3 ]
store i32 %7, i32* %2
ret i32 %8
}