xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int UINT32_C(int);
void fiat_p256_mulx_u32(uint32_t *out1, uint32_t *out2, uint32_t arg1,
                        uint32_t arg2) {
  uint64_t x1 = ((uint64_t)arg1 * arg2);
  uint32_t x2 = (uint32_t)(x1 & UINT32_C(0xffffffff));
  uint32_t x3 = (uint32_t)(x1 >> 32);
  *out1 = x2;
  *out2 = x3;
}


x86 assembly (clang, -O0):
<fiat_p256_mulx_u32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT32_C@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_p256_mulx_u32>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
imul   %ecx,%ebx
mov    $0xffffffff,%edi
call   1030 <UINT32_C@plt>
and    %ebx,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @fiat_p256_mulx_u32(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = call i32 @UINT32_C(i32 -1)
%17 = and i32 %15, %16
store i32 %17, i32* %10
%18 = load i32, i32* %9
%19 = ashr i32 %18, 32
store i32 %19, i32* %11
%20 = load i32, i32* %10
%21 = load i32*, i32** %5
store i32 %20, i32* %21
%22 = load i32, i32* %11
%23 = load i32*, i32** %6
store i32 %22, i32* %23
ret void
}

LLVM IR (-O2):
define void @fiat_p256_mulx_u32(i32* nocapture writeonly %0, i32* nocapture readnone %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %3, %2
%6 = tail call i32 @UINT32_C(i32 -1)
%7 = and i32 %6, %5
store i32 %7, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned int fread(char *, int, int, int /*<<< orphan*/ *);
void get4k(FILE *file, char *buf) {
  unsigned j;
  unsigned num = fread(buf, 1, 4096, file);
  for (j = num; j < 4096; ++j)
    buf[j] = 0;
}


x86 assembly (clang, -O0):
<get4k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1000,-0x14(%rbp)
jae    1166 <get4k+0x56>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <get4k+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get4k>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
cmp    $0xfff,%eax
ja     115a <get4k+0x3a>
mov    %eax,%ecx
add    %rcx,%rbx
mov    $0xfff,%edx
sub    %eax,%edx
add    $0x1,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @get4k(i32* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @fread(i8* %1, i32 1, i32 4096, i32* %0)
%4 = icmp ult i32 %3, 4096
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = getelementptr i8, i8* %1, i64 %6
%8 = sub nuw nsw i32 4095, %3
%9 = zext i32 %8 to i64
%10 = add nuw nsw i64 %9, 1
br label %11
11: ; preds = %5, %2
ret void
}
int isinff(float x) { return __builtin_isinf_sign(x); }


x86 assembly (clang, -O0):
<isinff>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movaps %xmm1,%xmm0
movaps 0xef8(%rip),%xmm2
pand   %xmm2,%xmm0
movd   %xmm1,%edx
mov    $0x1,%ecx
mov    $0xffffffff,%eax
cmp    $0x0,%edx
cmovl  %eax,%ecx
movss  0xec8(%rip),%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
setnp  %sil
sete   %dl
test   %sil,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinff>:
movmskps %xmm0,%ecx
andps  0xef6(%rip),%xmm0
and    $0x1,%ecx
neg    %ecx
or     $0x1,%ecx
xor    %eax,%eax
ucomiss 0xef5(%rip),%xmm0
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @isinff(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.fabs.f32(float %3)
%5 = fcmp oeq float %4, 0x7FF0000000000000
%6 = bitcast float %3 to i32
%7 = icmp slt i32 %6, 0
%8 = select i1 %7, i32 -1, i32 1
%9 = select i1 %5, i32 %8, i32 0
ret i32 %9
}

LLVM IR (-O2):
define i32 @isinff(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = fcmp oeq float %2, 0x7FF0000000000000
%4 = bitcast float %0 to i32
%5 = icmp sgt i32 %4, -1
%6 = select i1 %5, i32 1, i32 -1
%7 = select i1 %3, i32 %6, i32 0
ret i32 %7
}
int sif_platform_is_irq_occur(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sif_platform_is_irq_occur() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ vlsi_ampli(int);
int /*<<< orphan*/ vlsi_write_sci(int, int);
void set_vlsi_volume(uint8_t volume) {
  vlsi_write_sci(0x0B, (volume << 8) | volume);
  vlsi_ampli(volume < 0x7f);
}


x86 assembly (clang, -O0):
<set_vlsi_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
shl    $0x8,%esi
or     -0x4(%rbp),%esi
mov    $0xb,%edi
call   1040 <vlsi_write_sci@plt>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <vlsi_ampli@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_vlsi_volume>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%esi
shl    $0x8,%esi
or     %edi,%esi
mov    $0xb,%edi
call   1040 <vlsi_write_sci@plt>
xor    %edi,%edi
cmp    $0x7f,%ebx
setl   %dil
pop    %rbx
jmp    1030 <vlsi_ampli@plt>

LLVM IR (-O0):
define void @set_vlsi_volume(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = load i32, i32* %2
%6 = or i32 %4, %5
%7 = call i32 @vlsi_write_sci(i32 11, i32 %6)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 127
%10 = zext i1 %9 to i32
%11 = call i32 @vlsi_ampli(i32 %10)
ret void
}

LLVM IR (-O2):
define void @set_vlsi_volume(i32 %0) {
%2 = shl i32 %0, 8
%3 = or i32 %2, %0
%4 = tail call i32 @vlsi_write_sci(i32 11, i32 %3)
%5 = icmp slt i32 %0, 127
%6 = zext i1 %5 to i32
%7 = tail call i32 @vlsi_ampli(i32 %6)
ret void
}
void foo_1_1_1_1_2_1_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_1_1_2_1_2_1_2() {
ret void
}
void mdp4_lcdc_overlay(struct msm_fb_data_type *mfd) {}


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_lcdc_overlay(%struct.msm_fb_data_type* nocapture %0) {
ret void
}
void set_bit(int nr, unsigned long *addr) {
  addr[nr / (8 * sizeof(long))] |= 1UL << (nr % (8 * sizeof(long)));
}


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rcx
and    $0x3f,%rcx
mov    $0x1,%edx
shl    %cl,%rdx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
shr    $0x6,%rcx
or     (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
movslq %edi,%rcx
mov    $0x1,%eax
shl    %cl,%rax
shr    $0x6,%rcx
or     %rax,(%rsi,%rcx,8)
ret

LLVM IR (-O0):
define void @set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = urem i64 %6, 64
%8 = shl i64 1, %7
%9 = load i64*, i64** %4
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = udiv i64 %11, 64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = or i64 %14, %8
store i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @set_bit(i32 %0, i64* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = and i64 %3, 63
%5 = shl nuw i64 1, %4
%6 = lshr i64 %3, 6
%7 = getelementptr inbounds i64, i64* %1, i64 %6
%8 = load i64, i64* %7
%9 = or i64 %8, %5
store i64 %9, i64* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRBC_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


x86 assembly (clang, -O0):
<U_WMRBC_swap>:
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 <U_WMRNOTIMPLEMENTED_swap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMRBC_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

LLVM IR (-O0):
define void @U_WMRBC_swap(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 @U_WMRNOTIMPLEMENTED_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_WMRBC_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
int ilog2(int x) {
  int l;
  l = -1;
  while (x != 0) {
    x >>= 1;
    ++l;
  }
  return (l);
}


x86 assembly (clang, -O0):
<ilog2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <ilog2+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <ilog2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ilog2>:
mov    $0xffffffff,%eax
test   %edi,%edi
je     111c <ilog2+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
sar    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <ilog2+0x10>
ret

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

LLVM IR (-O2):
define i32 @ilog2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ -1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = ashr i32 %5, 1
%7 = add nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ -1, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *Hello(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Hello World! from thread %d\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<Hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hello>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Hello World! from thread %d\0A\00"
define i8* @Hello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [29 x i8] c"Hello World! from thread %d\0A\00"
define noalias i8* @Hello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
int get_numleases(currentpool, poolfile)
struct pool_decl *currentpool;
char *poolfile;
{ return 0; }


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

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

LLVM IR (-O0):
%struct.pool_decl = type opaque
define i32 @get_numleases(%struct.pool_decl* %0, i8* %1) {
%3 = alloca %struct.pool_decl*
%4 = alloca i8*
store %struct.pool_decl* %0, %struct.pool_decl** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.pool_decl = type opaque
define i32 @get_numleases(%struct.pool_decl* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
int test_imm_21int8_reg(signed char val) {
  return ((val) & (0x21 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_21int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x21,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_21int8_reg>:
test   $0x21,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_21int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 33
%6 = icmp ne i32 %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_21int8_reg(i8 signext %0) {
%2 = and i8 %0, 33
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int printf(char *);
int print_unknown() { return printf("(variable of unknown type)"); }


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"(variable of unknown type)\00"
define i32 @print_unknown() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [27 x i8] c"(variable of unknown type)\00"
define i32 @print_unknown() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int h_sort_sizet(const void *p, const void *q) {
  const size_t *a = p, *b = q;
  return (*a < *b) ? -1 : (*a > *b);
}


x86 assembly (clang, -O0):
<h_sort_sizet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
jae    113d <h_sort_sizet+0x3d>
mov    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1156 <h_sort_sizet+0x56>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_sort_sizet>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @h_sort_sizet(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ult i64 %5, %6
%8 = icmp ugt i64 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void loas_set_sync(uint8_t *p) {
  p[0] = 0x56;
  p[1] = 0xe0;
  p[2] = 0x0;
}


x86 assembly (clang, -O0):
<loas_set_sync>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x56,(%rax)
mov    -0x8(%rbp),%rax
movl   $0xe0,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<loas_set_sync>:
movabs $0xe000000056,%rax
mov    %rax,(%rdi)
movl   $0x0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @loas_set_sync(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 86, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 224, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 0, i32* %8
ret void
}

LLVM IR (-O2):
define void @loas_set_sync(i32* nocapture writeonly %0) {
store i32 86, i32* %0
%2 = getelementptr inbounds i32, i32* %0, i64 1
store i32 224, i32* %2
%3 = getelementptr inbounds i32, i32* %0, i64 2
store i32 0, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cmt_wait(int);
int /*<<< orphan*/ printf(char *, ...);
void routineX(void *data) {
  int i;
  printf("<X: %p>", &i);
  i = 0;
  while (1) {
    printf("[X: %d]", i++);
    cmt_wait(120);
  }
  printf("[X: end]");
}


x86 assembly (clang, -O0):
<routineX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x78,%edi
call   1040 <cmt_wait@plt>
jmp    1145 <routineX+0x25>

x86 assembly (clang, -O2):
<routineX>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rbx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rsi),%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x78,%edi
call   1040 <cmt_wait@plt>
mov    0xc(%rsp),%esi
jmp    1150 <routineX+0x30>

LLVM IR (-O0):
@.str = [8 x i8] c"<X: %p>\00"
@.str.1 = [8 x i8] c"[X: %d]\00"
define void @routineX(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %3
br label %5
5: ; preds = %1, %5
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%9 = call i32 @cmt_wait(i32 120)
br label %5
}

LLVM IR (-O2):
@.str = [8 x i8] c"<X: %p>\00"
@.str.1 = [8 x i8] c"[X: %d]\00"
define void @routineX(i8* nocapture readnone %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %5
5: ; preds = %5, %1
%6 = phi i32 [ %10, %5 ], [ 0, %1 ]
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%9 = call i32 @cmt_wait(i32 120)
%10 = load i32, i32* %2
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(
      stderr, "usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
              " [file ...]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [76 x i8] c"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [76 x i8] c"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void foo308() {}


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

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

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

LLVM IR (-O2):
define void @foo308() {
ret void
}
void troca(int *a, int b, int y) {
  int f;
  f = a[b];
  a[b] = a[y];
  a[y] = f;
}


x86 assembly (clang, -O0):
<troca>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<troca>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @troca(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** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @troca(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(char *, int /*<<< orphan*/);
void write_str(char *buf) { write(buf, strlen(buf)); }


x86 assembly (clang, -O0):
<write_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_str>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @write_str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @write_str(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
long rand();
float uniformfloatrand() {
  float result;
  long a;
  a = rand();
  result = (float)((a - 1073741824) >> 6);
  return result;
}


x86 assembly (clang, -O0):
<uniformfloatrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x40000000,%rax
sar    $0x6,%rax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniformfloatrand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
add    $0xffffffffc0000000,%rax
sar    $0x6,%rax
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @uniformfloatrand() {
%1 = alloca float
%2 = alloca i64
%3 = call i64 (...) @rand()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = sub nsw i64 %4, 1073741824
%6 = ashr i64 %5, 6
%7 = sitofp i64 %6 to float
store float %7, float* %1
%8 = load float, float* %1
ret float %8
}

LLVM IR (-O2):
define float @uniformfloatrand() {
%1 = tail call i64 (...) @rand()
%2 = add nsw i64 %1, -1073741824
%3 = ashr i64 %2, 6
%4 = sitofp i64 %3 to float
ret float %4
}
int(isblank)(int c) { return isblank(c); }


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

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

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

LLVM IR (-O2):
define i32 @isblank(i32 %0) {
ret i32 undef
}
unsigned long rdtsc(void) {
  unsigned long th, tl;
  asm volatile("rdtsc" : "=a"(tl), "=d"(th));
  return (th << 32) + tl;
}


x86 assembly (clang, -O0):
<rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %rax,-0x10(%rbp)
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x20,%rax
add    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdtsc>:
rdtsc
shl    $0x20,%rdx
add    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @rdtsc() {
%1 = alloca i64
%2 = alloca i64
%3 = call { i64, i64 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i64, i64 } %3, 0
%5 = extractvalue { i64, i64 } %3, 1
store i64 %4, i64* %2
store i64 %5, i64* %1
%6 = load i64, i64* %1
%7 = shl i64 %6, 32
%8 = load i64, i64* %2
%9 = add i64 %7, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @rdtsc() {
%1 = tail call { i64, i64 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i64, i64 } %1, 0
%3 = extractvalue { i64, i64 } %1, 1
%4 = shl i64 %3, 32
%5 = add i64 %4, %2
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_and_pd(int /*<<< orphan*/, int /*<<< orphan*/);
__m128d test_mm_and_pd(__m128d A, __m128d B) { return _mm_and_pd(A, B); }


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

x86 assembly (clang, -O2):
<test_mm_and_pd>:
jmp    1030 <_mm_and_pd@plt>

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

LLVM IR (-O2):
define i32 @test_mm_and_pd(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_and_pd(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
double sindg(double);
int main() {
  double x;
  double y;
  x = 30.0;
  y = sindg(30.0);
  printf("sin( %lf ) = %lf\n", x, y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec3(%rip),%xmm0
call   1040 <sindg@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
call   1040 <sindg@plt>
movaps %xmm0,%xmm1
lea    0xed0(%rip),%rdi
movsd  0xec0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"sin( %lf ) = %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
store double 3.000000e+01, double* %1
%3 = call double @sindg(double 3.000000e+01)
store double %3, double* %2
%4 = load double, double* %1
%5 = load double, double* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %4, double %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"sin( %lf ) = %lf\0A\00"
define i32 @main() {
%1 = tail call double @sindg(double 3.000000e+01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double 3.000000e+01, double %1)
ret i32 0
}
/* Variables and functions */
int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned int);
int /*<<< orphan*/ test_and_set_bit(int, void *);
__attribute__((always_)) int
wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) {
  if (!test_and_set_bit(bit, word))
    return 0;
  return out_of_line_wait_on_bit_lock(word, bit, action, mode);
}


x86 assembly (clang, -O0):
<wait_on_bit_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_and_set_bit@plt>
cmp    $0x0,%eax
jne    1157 <wait_on_bit_lock+0x37>
movl   $0x0,-0x4(%rbp)
jmp    116d <wait_on_bit_lock+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <out_of_line_wait_on_bit_lock@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_on_bit_lock>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
mov    %rbx,%rsi
call   1030 <test_and_set_bit@plt>
test   %eax,%eax
je     115a <wait_on_bit_lock+0x3a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <out_of_line_wait_on_bit_lock@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @wait_on_bit_lock(i8* %0, i32 %1, i32 (i8*)* %2, i32 %3) {
%5 = tail call i32 @test_and_set_bit(i32 %1, i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @out_of_line_wait_on_bit_lock(i8* %0, i32 %1, i32 (i8*)* %2, i32 %3)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ %8, %7 ], [ 0, %4 ]
ret i32 %10
}
int catalan(int n) {
  if (n == 0)
    return 1;
  return 2 * (2 * n - 1) * catalan(n - 1) / (n + 1);
}


x86 assembly (clang, -O0):
<catalan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <catalan+0x21>
movl   $0x1,-0x4(%rbp)
jmp    115f <catalan+0x4f>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <catalan@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catalan>:
test   %edi,%edi
je     1138 <catalan+0x28>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x2(,%rbx,4),%ebp
lea    -0x1(%rbx),%edi
call   1030 <catalan@plt>
imul   %ebp,%eax
add    $0x1,%ebx
cltd
idiv   %ebx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @catalan(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %12, %5 ], [ 1, %1 ]
ret i32 %4
5: ; preds = %1
%6 = shl i32 %0, 2
%7 = add i32 %6, -2
%8 = add nsw i32 %0, -1
%9 = tail call i32 @catalan(i32 %8)
%10 = mul nsw i32 %9, %7
%11 = add nsw i32 %0, 1
%12 = sdiv i32 %10, %11
br label %3
}
void XSetStandardProperties() {}


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

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

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

LLVM IR (-O2):
define void @XSetStandardProperties() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int unlink(char *);
void operation_cache_delete(char *path) {
  int rv = unlink(path);
  if (rv != 0) {
    char line[4096];
    snprintf(line, 4096, "unlink %s", path);
    perror(line);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<operation_cache_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1197 <operation_cache_delete+0x57>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1000,%esi
lea    0xe84(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x1010(%rbp),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_cache_delete>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %eax,%eax
jne    1161 <operation_cache_delete+0x21>
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe98(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1000,%esi
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %r14,%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"unlink %s\00"
define void @operation_cache_delete(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [4096 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @unlink(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%11 = load i8*, i8** %2
%12 = call i32 @snprintf(i8* %10, i32 4096, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%14 = call i32 @perror(i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"unlink %s\00"
define void @operation_cache_delete(i8* %0) {
%2 = alloca [4096 x i8]
%3 = tail call i32 @unlink(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 4096, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = call i32 @perror(i8* %6)
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t w8rev(uint64_t const x) {
  return ((0xff & (x >> (0 * 8))) << (7 * 8)) |
         ((0xff & (x >> (1 * 8))) << (6 * 8)) |
         ((0xff & (x >> (2 * 8))) << (5 * 8)) |
         ((0xff & (x >> (3 * 8))) << (4 * 8)) |
         ((0xff & (x >> (4 * 8))) << (3 * 8)) |
         ((0xff & (x >> (5 * 8))) << (2 * 8)) |
         ((0xff & (x >> (6 * 8))) << (1 * 8)) |
         ((0xff & (x >> (7 * 8))) << (0 * 8));
}


x86 assembly (clang, -O0):
<w8rev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
sar    $0x10,%edx
and    $0xff,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
sar    $0x18,%edx
and    $0xff,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x28,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x30,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    $0x38,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
shl    $0x0,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @w8rev(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 0
%5 = and i32 255, %4
%6 = shl i32 %5, 56
%7 = load i32, i32* %2
%8 = ashr i32 %7, 8
%9 = and i32 255, %8
%10 = shl i32 %9, 48
%11 = or i32 %6, %10
%12 = load i32, i32* %2
%13 = ashr i32 %12, 16
%14 = and i32 255, %13
%15 = shl i32 %14, 40
%16 = or i32 %11, %15
%17 = load i32, i32* %2
%18 = ashr i32 %17, 24
%19 = and i32 255, %18
%20 = shl i32 %19, 32
%21 = or i32 %16, %20
%22 = load i32, i32* %2
%23 = ashr i32 %22, 32
%24 = and i32 255, %23
%25 = shl i32 %24, 24
%26 = or i32 %21, %25
%27 = load i32, i32* %2
%28 = ashr i32 %27, 40
%29 = and i32 255, %28
%30 = shl i32 %29, 16
%31 = or i32 %26, %30
%32 = load i32, i32* %2
%33 = ashr i32 %32, 48
%34 = and i32 255, %33
%35 = shl i32 %34, 8
%36 = or i32 %31, %35
%37 = load i32, i32* %2
%38 = ashr i32 %37, 56
%39 = and i32 255, %38
%40 = shl i32 %39, 0
%41 = or i32 %36, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @w8rev(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int DynamicLibrary1Function(char);
int DynamicLibrary2Function(char c) { return DynamicLibrary1Function(c) + 42; }


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

x86 assembly (clang, -O2):
<DynamicLibrary2Function>:
push   %rax
call   1030 <DynamicLibrary1Function@plt>
add    $0x2a,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @DynamicLibrary2Function(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @DynamicLibrary1Function(i8 signext %3)
%5 = add nsw i32 %4, 42
ret i32 %5
}

LLVM IR (-O2):
define i32 @DynamicLibrary2Function(i8 signext %0) {
%2 = tail call i32 @DynamicLibrary1Function(i8 signext %0)
%3 = add nsw i32 %2, 42
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void set_enable_sr(int mask) {
  outb(1, 0x3ce);
  outb(mask, 0x3cf);
}


x86 assembly (clang, -O0):
<set_enable_sr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x3ce,%esi
call   1030 <outb@plt>
mov    -0x4(%rbp),%edi
mov    $0x3cf,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_enable_sr>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
mov    $0x3ce,%esi
call   1030 <outb@plt>
mov    %ebx,%edi
mov    $0x3cf,%esi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @set_enable_sr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @outb(i32 1, i32 974)
%4 = load i32, i32* %2
%5 = call i32 @outb(i32 %4, i32 975)
ret void
}

LLVM IR (-O2):
define void @set_enable_sr(i32 %0) {
%2 = tail call i32 @outb(i32 1, i32 974)
%3 = tail call i32 @outb(i32 %0, i32 975)
ret void
}
/* Variables and functions */
int no_instrument();
int main(void) { return no_instrument(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @no_instrument()
ret i32 %1
}
void cam_interrupt_disable(const int c) {}


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

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

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

LLVM IR (-O2):
define void @cam_interrupt_disable(i32 %0) {
ret void
}
/* Variables and functions */
int yaffs_symlink_reldir(int /*<<< orphan*/, char const *, char const *);
int yaffs_symlink(const char *oldpath, const char *newpath) {
  return yaffs_symlink_reldir((0), oldpath, newpath);
}


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

x86 assembly (clang, -O2):
<yaffs_symlink>:
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <yaffs_symlink_reldir@plt>

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

LLVM IR (-O2):
define i32 @yaffs_symlink(i8* %0, i8* %1) {
%3 = tail call i32 @yaffs_symlink_reldir(i32 0, i8* %0, i8* %1)
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t USBDMAChannelCountGet(uint32_t ui32Base, uint32_t ui32Channel) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT(ui32Channel < 8);
  return (
      (*((volatile uint32_t *)(ui32Base + 0x0000020C + (0x10 * ui32Channel)))));
}


x86 assembly (clang, -O0):
<USBDMAChannelCountGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x8,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x20c,%eax
mov    -0x8(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDMAChannelCountGet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x8,%ebx
setl   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
movslq %ebx,%rcx
shl    $0x4,%rcx
mov    0x20c(%rax,%rcx,1),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @USBDMAChannelCountGet(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 = icmp eq i32 %5, 1074069504
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 8
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 524
%15 = load i32, i32* %4
%16 = mul nsw i32 16, %15
%17 = add nsw i32 %14, %16
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @USBDMAChannelCountGet(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074069504
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = icmp slt i32 %1, 8
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = add nsw i32 %0, 524
%10 = shl nsw i32 %1, 4
%11 = add nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
ret i32 %14
}
const char *app_dataroot(void) { return "./"; }


x86 assembly (clang, -O0):
<app_dataroot>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<app_dataroot>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"./\00"
define i8* @app_dataroot() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [3 x i8] c"./\00"
define i8* @app_dataroot() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}