xunge/DecIR huggingface dataset:
int add_three(int x) { return x + 3; }


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

x86 assembly (clang, -O2):
<add_three>:
lea    0x3(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @add_three(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
/* Variables and functions */
int _XMP_gcd(int, int);
int _XMP_lcm(int a, int b) { return (a * b) / _XMP_gcd(a, b); }


x86 assembly (clang, -O0):
<_XMP_lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <_XMP_gcd@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_XMP_lcm>:
push   %rbx
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <_XMP_gcd@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_XMP_lcm(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 = mul nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @_XMP_gcd(i32 %8, i32 %9)
%11 = sdiv i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @_XMP_lcm(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @_XMP_gcd(i32 %0, i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
int has_tcpinfo(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @has_tcpinfo() {
ret i32 0
}
void GetCOMDipole(int max, int tstep, int frame) {
  int i;
  void AnalCOMDipole();
  for (i = 0; i < max; i++)
    AnalCOMDipole(i);
}


x86 assembly (clang, -O0):
<GetCOMDipole>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114c <GetCOMDipole+0x3c>
mov    -0x10(%rbp),%edi
mov    $0x0,%al
call   1030 <AnalCOMDipole@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <GetCOMDipole+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetCOMDipole>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1130 <GetCOMDipole+0x20>
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <AnalCOMDipole@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <GetCOMDipole+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @GetCOMDipole(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ 0, %3 ]
tail call void (i32, ...) bitcast (void (...)* @AnalCOMDipole to void (i32, ...)*)(i32 %6)
%7 = add nuw nsw i32 %6, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %5
9: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float const *, int);
void mlSphereCopy(const float *a, float *result) {
  memcpy(result, a, 4 * sizeof(float));
}


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

x86 assembly (clang, -O2):
<mlSphereCopy>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x10,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @mlSphereCopy(float* %0, float* %1) {
%3 = tail call i32 @memcpy(float* %1, float* %0, i32 16)
ret void
}
char pfio_get_pin_number(char bit_pattern) {
  char pin_number = 1;
  while ((bit_pattern & 1) == 0) {
    bit_pattern >>= 1;
    if (++pin_number > 8) {
      pin_number = 0;
      break;
    }
  }
  return pin_number;
}


x86 assembly (clang, -O0):
<pfio_get_pin_number>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x1,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    114a <pfio_get_pin_number+0x4a>
movsbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
movsbl %al,%eax
cmp    $0x8,%eax
jle    1145 <pfio_get_pin_number+0x45>
movb   $0x0,-0x2(%rbp)
jmp    114a <pfio_get_pin_number+0x4a>
jmp    110e <pfio_get_pin_number+0xe>
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfio_get_pin_number>:
mov    $0x1,%al
test   $0x1,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x2,%al
test   $0x2,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x3,%al
test   $0x4,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x4,%al
test   $0x8,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x5,%al
test   $0x10,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x6,%al
test   $0x20,%dil
jne    1142 <pfio_get_pin_number+0x42>
mov    $0x7,%al
test   $0x40,%dil
jne    1142 <pfio_get_pin_number+0x42>
shr    $0x4,%dil
and    $0x8,%dil
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define signext i8 @pfio_get_pin_number(i8 signext %0) {
%2 = and i8 %0, 1
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %25
4: ; preds = %1
%5 = and i8 %0, 2
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = and i8 %0, 4
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = and i8 %0, 8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = and i8 %0, 16
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = and i8 %0, 32
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = and i8 %0, 64
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = lshr i8 %0, 4
%24 = and i8 %23, 8
br label %25
25: ; preds = %22, %19, %16, %13, %10, %7, %4, %1
%26 = phi i8 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 4, %10 ], [ 5, %13 ], [ 6, %16 ], [ 7, %19 ], [ %24, %22 ]
ret i8 %26
}
/* Variables and functions */
long double floor(long double);
long double fun_floor(long double a) { return floor(a); }


x86 assembly (clang, -O0):
<fun_floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <floor@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_floor>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  (%rsp)
call   1030 <floorl@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define x86_fp80 @fun_floor(x86_fp80 %0) {
%2 = tail call x86_fp80 @llvm.floor.f80(x86_fp80 %0)
ret x86_fp80 %2
}
void t1() {
  struct foo {
    int *a, *b, c, d, *e;
  } s;
  int *a, *z, scalar, **y;
#pragma acc enter data copyin(s) detach(z)
  {
#pragma acc data copy(s.a [0:10]) copy(z [0:10])
    {
      s.e = z;
#pragma acc parallel loop attach(s.e) detach(s.b)
      for (int i = 0; i < 10; i++)
        s.a[i] = s.e[i];
      a = s.e;
#pragma acc enter data attach(a) detach(s.c)
#pragma acc exit data detach(a)
    }
#pragma acc enter data attach(z[:5])
#pragma acc exit data detach(z[:5])
#pragma acc enter data attach(z [1:])
#pragma acc exit data detach(z [1:])
#pragma acc enter data attach(z[:])
#pragma acc exit data detach(z[:])
#pragma acc enter data attach(z[3])
#pragma acc exit data detach(z[3])
#pragma acc acc enter data attach(s.e)
#pragma acc exit data detach(s.e) attach(z)
#pragma acc data attach(s.e)
    {}
#pragma acc exit data delete (a)attach(s.a)
#pragma acc enter data attach(scalar)
#pragma acc exit data detach(scalar)
#pragma acc enter data attach(s)
#pragma acc exit data detach(s)
  }
#pragma acc enter data attach(y[10])
#pragma acc exit data detach(y[10])
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    1141 <t1+0x41>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1113 <t1+0x13>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.foo = type { i32*, i32*, i32, i32, i32* }
define void @t1() {
%1 = alloca %struct.foo
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32
%7 = load i32*, i32** %3
%8 = getelementptr inbounds %struct.foo, %struct.foo* %1, i32 0, i32 4
store i32* %7, i32** %8
store i32 0, i32* %6
br label %9
9: ; preds = %24, %0
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = getelementptr inbounds %struct.foo, %struct.foo* %1, i32 0, i32 4
%14 = load i32*, i32** %13
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.foo, %struct.foo* %1, i32 0, i32 0
%20 = load i32*, i32** %19
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %18, i32* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %9
27: ; preds = %9
%28 = getelementptr inbounds %struct.foo, %struct.foo* %1, i32 0, i32 4
%29 = load i32*, i32** %28
store i32* %29, i32** %2
ret void
}

LLVM IR (-O2):
define void @t1() {
ret void
}
void SendIpcFlag(unsigned long int flag) {
  (*((volatile unsigned long *)(0x400FB700 + 0x000000008))) |= flag;
  return;
}


x86 assembly (clang, -O0):
<SendIpcFlag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x400fb708,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb708,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendIpcFlag>:
or     %rdi,0x400fb708
40
ret

LLVM IR (-O0):
define void @SendIpcFlag(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1074771720 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1074771720 to i64*)
ret void
}

LLVM IR (-O2):
define void @SendIpcFlag(i64 %0) {
%2 = load volatile i64, i64* inttoptr (i64 1074771720 to i64*)
%3 = or i64 %2, %0
store volatile i64 %3, i64* inttoptr (i64 1074771720 to i64*)
ret void
}
void digitalWrite(int pin, int level) {}


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

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

LLVM IR (-O0):
define void @digitalWrite(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 @digitalWrite(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t read_8u(const uint8_t *src) { return src[0]; }


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

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

LLVM IR (-O0):
define i32 @read_8u(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @read_8u(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
unsigned char kernel___Byte_rsh___impl(unsigned char self, long i) {
  return self >> i;
}


x86 assembly (clang, -O0):
<kernel___Byte_rsh___impl>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
sar    %cl,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel___Byte_rsh___impl>:
mov    %rsi,%rcx
mov    %edi,%eax
shr    %cl,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @kernel___Byte_rsh___impl(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = lshr i32 %3, %4
%6 = trunc i32 %5 to i8
ret i8 %6
}
int test_imm_86int16_mem(short *val) {
  return ((*val) & (0x86 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_86int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 134
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int getAbs2(int value) {
  int record;
  record = value;
  if (value < 0) {
    value = ~value + 1;
  }
  printf("abs (v2) of %d is %d\n", record, value);
  return value;
}


x86 assembly (clang, -O0):
<getAbs2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1137 <getAbs2+0x27>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getAbs2>:
push   %rbx
mov    %edi,%esi
mov    %edi,%ebx
neg    %ebx
cmovs  %edi,%ebx
lea    0xedf(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"abs (v2) of %d is %d\0A\00"
define i32 @getAbs2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = xor i32 %8, -1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %11
11: ; preds = %7, %1
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [22 x i8] c"abs (v2) of %d is %d\0A\00"
define i32 @getAbs2(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret i32 %2
}
int func(void) {
  int n = 3;
  sizeof(n);
  sizeof(int);
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @func() {
ret i32 0
}
__attribute__((format(printf, 1, 2))) __attribute__((unused)) void
____empty_printf(char *format, ...) {}


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

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

LLVM IR (-O0):
define void @____empty_printf(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @____empty_printf(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
void memset();
int /*<<< orphan*/ puts(char *);
int main() {
  char asdf[50];
  asdf[0] = 'A';
  asdf[1] = 'B';
  asdf[2] = 'C';
  asdf[3] = 'D';
  asdf[49] = '\0';
  void (*fuckfuck)() = memset;
  fuckfuck(asdf, asdf[1], 49);
  puts(asdf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movb   $0x41,-0x40(%rbp)
movb   $0x42,-0x3f(%rbp)
movb   $0x43,-0x3e(%rbp)
movb   $0x44,-0x3d(%rbp)
movb   $0x0,-0xf(%rbp)
mov    0x2ead(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
lea    -0x40(%rbp),%rdi
movsbl -0x3f(%rbp),%esi
mov    $0x31,%edx
mov    $0x0,%al
call   *%rcx
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movl   $0x44434241,(%rsp)
movb   $0x0,0x31(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x42,%esi
mov    $0x31,%edx
xor    %eax,%eax
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca void (...)*
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
store i8 65, i8* %3
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
store i8 66, i8* %4
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 2
store i8 67, i8* %5
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 3
store i8 68, i8* %6
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 49
store i8 0, i8* %7
store void (...)* @memset, void (...)** %2
%8 = load void (...)*, void (...)** %2
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = bitcast void (...)* %8 to void (i8*, i32, i32, ...)*
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%15 = call i32 @puts(i8* %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
store i8 65, i8* %2
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
store i8 66, i8* %3
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 2
store i8 67, i8* %4
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 3
store i8 68, i8* %5
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 49
store i8 0, i8* %6
%7 = call i32 @puts(i8* %2)
ret i32 0
}
double Cal_Tax(double x) { return x * 0.174; }


x86 assembly (clang, -O0):
<Cal_Tax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cal_Tax>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @Cal_Tax(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.740000e-01
ret double %4
}

LLVM IR (-O2):
define double @Cal_Tax(double %0) {
%2 = fmul double %0, 1.740000e-01
ret double %2
}
/* Variables and functions */
float _expm1f(float);
float expm1f(float vx) { return _expm1f(vx); }


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

x86 assembly (clang, -O2):
<expm1f>:
jmp    1030 <_expm1f@plt>

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

LLVM IR (-O2):
define float @expm1f(float %0) {
%2 = tail call float @_expm1f(float %0)
ret float %2
}
int atomic_add(int *variable, int value) {
  return (int)__sync_fetch_and_add(variable, value);
}


x86 assembly (clang, -O0):
<atomic_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
lock xadd %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_add>:
mov    %esi,%eax
lock xadd %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @atomic_add(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 = atomicrmw add i32* %5, i32 %6 seq_cst
ret i32 %7
}

LLVM IR (-O2):
define i32 @atomic_add(i32* nocapture %0, i32 %1) {
%3 = atomicrmw add i32* %0, i32 %1 seq_cst
ret i32 %3
}
__attribute__((no, noclone)) unsigned __int128 t176_5sub(signed __int128 x) {
  unsigned __int128 r;
  if (__builtin_sub_overflow(x, (signed __int128)(-1), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t176_5sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%r9
sar    $0x3f,%r9
add    $0x1,%rdx
adc    $0x0,%rcx
mov    %r9,%r8
adc    $0x0,%r8
adc    $0x0,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1187 <t176_5sub+0x77>
jmp    118e <t176_5sub+0x7e>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t176_5sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0x1,%r14
mov    %rsi,%rbx
adc    $0x0,%rbx
mov    $0xfffffffffffffffe,%rax
cmp    %rdi,%rax
mov    $0xffffffffffffffff,%rax
sbb    %rsi,%rax
jl     113f <t176_5sub+0x2f>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t176_5sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 %12, i129 -1)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = zext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t176_5sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = add nuw i129 %7, 1
%9 = icmp slt i128 %6, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i129 %8 to i64
%14 = lshr i129 %8, 64
%15 = trunc i129 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/,
                            int /*<<< orphan*/);
char *timenow() {
  static char buffer[64];
  struct timeval tv;
  gettimeofday(&tv, NULL);
  snprintf(buffer, 64, "%ld.%06ld", tv.tv_sec, tv.tv_usec);
  return buffer;
}


x86 assembly (clang, -O0):
<timenow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0x2efd(%rip),%rdi
mov    $0x40,%esi
lea    0xeb1(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ee5(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timenow>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%r8d
mov    0xc(%rsp),%ecx
lea    0x2eff(%rip),%rbx
lea    0xeb8(%rip),%rdx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@timenow.buffer = internal global [64 x i8] zeroinitializer
@.str = [10 x i8] c"%ld.%06ld\00"
define i8* @timenow() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timenow.buffer, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timenow.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@timenow.buffer = internal global [64 x i8] zeroinitializer
@.str = [10 x i8] c"%ld.%06ld\00"
define i8* @timenow() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timenow.buffer, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @timenow.buffer, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
int system(char *);
int open_mp3(const char *path) {
  char cmd[256] = {'\0'};
  sprintf(cmd, "killall mpg123 && mpg123 %s || mpg123 %s", path, path);
  return system(cmd);
}


x86 assembly (clang, -O0):
<open_mp3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe98(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_mp3>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rcx
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe64(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rcx,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"killall mpg123 && mpg123 %s || mpg123 %s\00"
define i32 @open_mp3(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = bitcast [256 x i8]* %3 to i8*
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = call i32 @system(i8* %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [41 x i8] c"killall mpg123 && mpg123 %s || mpg123 %s\00"
define i32 @open_mp3(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%5 = call i32 @system(i8* %3)
ret i32 %5
}
void ADCSequenceUnderflowClear(unsigned long ulBase,
                               unsigned long ulSequenceNum) {
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000018))) = 1 << ulSequenceNum;
}


x86 assembly (clang, -O0):
<ADCSequenceUnderflowClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCSequenceUnderflowClear>:
mov    %rsi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,0x18(%rdi)
ret

LLVM IR (-O0):
define void @ADCSequenceUnderflowClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 1, %6
%8 = sext i32 %7 to i64
%9 = load i64, i64* %3
%10 = add i64 %9, 24
%11 = inttoptr i64 %10 to i64*
store volatile i64 %8, i64* %11
ret void
}

LLVM IR (-O2):
define void @ADCSequenceUnderflowClear(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl nuw i32 1, %3
%5 = sext i32 %4 to i64
%6 = add i64 %0, 24
%7 = inttoptr i64 %6 to i64*
store volatile i64 %5, i64* %7
ret void
}
int unscaled_value(int val, const struct scale_factors_common *sfc) {
  (void)sfc;
  return val;
}


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

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

LLVM IR (-O0):
%struct.scale_factors_common = type opaque
define i32 @unscaled_value(i32 %0, %struct.scale_factors_common* %1) {
%3 = alloca i32
%4 = alloca %struct.scale_factors_common*
store i32 %0, i32* %3
store %struct.scale_factors_common* %1, %struct.scale_factors_common** %4
%5 = load %struct.scale_factors_common*, %struct.scale_factors_common** %4
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.scale_factors_common = type opaque
define i32 @unscaled_value(i32 returned %0, %struct.scale_factors_common* nocapture readnone %1) {
ret i32 %0
}
int max_val(int val1, int val2) { return val1 > val2 ? val1 : val2; }


x86 assembly (clang, -O0):
<max_val>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max_val+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max_val+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_val>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max_val(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 sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @max_val(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ FCEU_DispMessage(char *);
void FCEUD_TurboOn(void) { FCEU_DispMessage("Not implemented."); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Not implemented.\00"
define void @FCEUD_TurboOn() {
%1 = call i32 @FCEU_DispMessage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Not implemented.\00"
define void @FCEUD_TurboOn() {
%1 = tail call i32 @FCEU_DispMessage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_36uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x36 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_36uint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0x36,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_36uint64_highword_reg>:
movabs $0x3600000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_36uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 231928233984
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void tty_audit_tiocsti(struct tty_struct *tty, char ch) {}


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

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

LLVM IR (-O0):
%struct.tty_struct = type opaque
define void @tty_audit_tiocsti(%struct.tty_struct* %0, i8 signext %1) {
%3 = alloca %struct.tty_struct*
%4 = alloca i8
store %struct.tty_struct* %0, %struct.tty_struct** %3
store i8 %1, i8* %4
ret void
}

LLVM IR (-O2):
%struct.tty_struct = type opaque
define void @tty_audit_tiocsti(%struct.tty_struct* nocapture %0, i8 signext %1) {
ret void
}
int get_mem_size(char *p) {
  char *begin;
  begin = p - strlen("_mem_begin_") - 1 - sizeof(int);
  return *(int *)(begin + strlen("_mem_begin_") + 1);
}


x86 assembly (clang, -O0):
<get_mem_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff5,%rax
add    $0xffffffffffffffff,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_mem_size(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -4
%3 = bitcast i8* %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int call_prom(char *, int, int, void *, char const *, void *, int);
int getprop(void *phandle, const char *name, void *buf, int buflen) {
  return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
}


x86 assembly (clang, -O0):
<getprop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x1c(%rbp),%eax
lea    0xec3(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %eax,(%rsp)
call   1030 <call_prom@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getprop>:
push   %rax
mov    %rdx,%r9
mov    %rsi,%r8
mov    %rdi,%rax
mov    %ecx,(%rsp)
lea    0xedc(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1030 <call_prom@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"getprop\00"
define i32 @getprop(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @call_prom(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4, i32 1, i8* %9, i8* %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [8 x i8] c"getprop\00"
define i32 @getprop(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @call_prom(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4, i32 1, i8* %0, i8* %1, i8* %2, i32 %3)
ret i32 %5
}
void crash_post_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @crash_post_resume() {
ret void
}
int compar(const void *pa, const void *pb) {
  unsigned long a, b;
  a = *((unsigned long *)pa) & 0xffffffff;
  b = *((unsigned long *)pb) & 0xffffffff;
  if (a < b) {
    return (-1);
  }
  if (a == b) {
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<compar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
movabs $0xffffffff,%rax
and    (%rcx),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
movabs $0xffffffff,%rax
and    (%rcx),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1150 <compar+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <compar+0x71>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    116a <compar+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1171 <compar+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
mov    $0xffffffff,%eax
cmovae %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compar(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = and i64 %4, 4294967295
%6 = bitcast i8* %1 to i64*
%7 = load i64, i64* %6
%8 = and i64 %7, 4294967295
%9 = icmp ult i64 %5, %8
%10 = icmp ne i64 %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
/* Variables and functions */
int f284(int *);
int f285(int *p) { return f284(p); }


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

x86 assembly (clang, -O2):
<f285>:
jmp    1030 <f284@plt>

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

LLVM IR (-O2):
define i32 @f285(i32* %0) {
%2 = tail call i32 @f284(i32* %0)
ret i32 %2
}
/* Variables and functions */
int bdos(int, int);
getchar() { return (bdos(1, 1)); }


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

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

LLVM IR (-O0):
define i32 @getchar() {
%1 = call i32 @bdos(i32 1, i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @getchar() {
%1 = tail call i32 @bdos(i32 1, i32 1)
ret i32 %1
}
int h(__attribute__((type_annotate("tainted"))) int p) { return p; }


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

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

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

LLVM IR (-O2):
define i32 @h(i32 returned %0) {
ret i32 %0
}
double map(double value, double in_min, double in_max, double out_min,
           double out_max) {
  return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


x86 assembly (clang, -O0):
<map>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<map>:
subsd  %xmm1,%xmm0
subsd  %xmm3,%xmm4
mulsd  %xmm4,%xmm0
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @map(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %6
%12 = load double, double* %7
%13 = fsub double %11, %12
%14 = load double, double* %10
%15 = load double, double* %9
%16 = fsub double %14, %15
%17 = fmul double %13, %16
%18 = load double, double* %8
%19 = load double, double* %7
%20 = fsub double %18, %19
%21 = fdiv double %17, %20
%22 = load double, double* %9
%23 = fadd double %21, %22
ret double %23
}

LLVM IR (-O2):
define double @map(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %0, %1
%7 = fsub double %4, %3
%8 = fmul double %6, %7
%9 = fsub double %2, %1
%10 = fdiv double %8, %9
%11 = fadd double %10, %3
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128GeneralIOPinP__6__IO__makeOutput();
void CC2420ControlP__RSTN__makeOutput(void) {
  HplAtm128GeneralIOPinP__6__IO__makeOutput();
}


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

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

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

LLVM IR (-O2):
define void @CC2420ControlP__RSTN__makeOutput() {
%1 = tail call i32 (...) @HplAtm128GeneralIOPinP__6__IO__makeOutput()
ret void
}
int test_imm_59int16_mem(short *val) {
  return ((*val) & (0x59 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_59int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 89
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ tfile_write_16(int);
int /*<<< orphan*/ tfile_write_8(char);
int /*<<< orphan*/ tfile_write_addr(char *);
int /*<<< orphan*/ tfile_write_buf(char *, int);
void add_memory_block(char *addr, int size) {
  tfile_write_8('M');
  tfile_write_addr(addr);
  tfile_write_16(size);
  tfile_write_buf(addr, size);
}


x86 assembly (clang, -O0):
<add_memory_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x4d,%edi
call   1040 <tfile_write_8@plt>
mov    -0x8(%rbp),%rdi
call   1060 <tfile_write_addr@plt>
mov    -0xc(%rbp),%edi
call   1030 <tfile_write_16@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <tfile_write_buf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_memory_block>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x4d,%edi
call   1040 <tfile_write_8@plt>
mov    %rbx,%rdi
call   1060 <tfile_write_addr@plt>
mov    %ebp,%edi
call   1030 <tfile_write_16@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <tfile_write_buf@plt>

LLVM IR (-O0):
define void @add_memory_block(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @tfile_write_8(i8 signext 77)
%6 = load i8*, i8** %3
%7 = call i32 @tfile_write_addr(i8* %6)
%8 = load i32, i32* %4
%9 = call i32 @tfile_write_16(i32 %8)
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @tfile_write_buf(i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @add_memory_block(i8* %0, i32 %1) {
%3 = tail call i32 @tfile_write_8(i8 signext 77)
%4 = tail call i32 @tfile_write_addr(i8* %0)
%5 = tail call i32 @tfile_write_16(i32 %1)
%6 = tail call i32 @tfile_write_buf(i8* %0, i32 %1)
ret void
}