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

/* Variables and functions */
void nvic_irq_enable(uint8_t n) {
  int i = n / 32;
  volatile uint32_t *nvic_iser = ((volatile uint32_t *)((0xE000E100) + 4 * i));
  *nvic_iser |= (1 << (n % 32));
}


x86 assembly (clang, -O0):
<nvic_irq_enable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
add    $0xe000e100,%eax
mov    %eax,%eax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvic_irq_enable>:
mov    %edi,%ecx
lea    0x1f(%rcx),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x5,%eax
mov    $0x1,%edx
shl    %cl,%edx
lea    -0x1fff1f00(,%rax,4),%eax
or     %edx,(%rax)
ret

LLVM IR (-O0):
define void @nvic_irq_enable(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 32
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = mul nsw i32 4, %7
%9 = add i32 -536813312, %8
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %4
%12 = load i32, i32* %2
%13 = srem i32 %12, 32
%14 = shl i32 1, %13
%15 = load i32*, i32** %4
%16 = load volatile i32, i32* %15
%17 = or i32 %16, %14
store volatile i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @nvic_irq_enable(i32 %0) {
%2 = sdiv i32 %0, 32
%3 = shl nsw i32 %2, 2
%4 = add nsw i32 %3, -536813312
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = and i32 %0, 31
%8 = shl nuw i32 1, %7
%9 = load volatile i32, i32* %6
%10 = or i32 %9, %8
store volatile i32 %10, i32* %6
ret void
}
void rk_send_wakeup_key(void) {}


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

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

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

LLVM IR (-O2):
define void @rk_send_wakeup_key() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_in_between_sq_mask();
int /*<<< orphan*/ gen_king_mask();
int /*<<< orphan*/ gen_knight_mask();
int /*<<< orphan*/ gen_queen_mask();
int /*<<< orphan*/ gen_rook_mask();
int /*<<< orphan*/ occ_mask_gen_diagonal_occupancy_masks();
void occ_mask_init(void) {
  gen_in_between_sq_mask();
  gen_knight_mask();
  gen_king_mask();
  occ_mask_gen_diagonal_occupancy_masks();
  gen_rook_mask();
  gen_queen_mask();
}


x86 assembly (clang, -O0):
<occ_mask_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_in_between_sq_mask@plt>
mov    $0x0,%al
call   1080 <gen_knight_mask@plt>
mov    $0x0,%al
call   1040 <gen_king_mask@plt>
mov    $0x0,%al
call   1070 <occ_mask_gen_diagonal_occupancy_masks@plt>
mov    $0x0,%al
call   1050 <gen_rook_mask@plt>
mov    $0x0,%al
call   1060 <gen_queen_mask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<occ_mask_init>:
push   %rax
xor    %eax,%eax
call   1030 <gen_in_between_sq_mask@plt>
xor    %eax,%eax
call   1080 <gen_knight_mask@plt>
xor    %eax,%eax
call   1040 <gen_king_mask@plt>
xor    %eax,%eax
call   1070 <occ_mask_gen_diagonal_occupancy_masks@plt>
xor    %eax,%eax
call   1050 <gen_rook_mask@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <gen_queen_mask@plt>

LLVM IR (-O0):
define void @occ_mask_init() {
%1 = call i32 (...) @gen_in_between_sq_mask()
%2 = call i32 (...) @gen_knight_mask()
%3 = call i32 (...) @gen_king_mask()
%4 = call i32 (...) @occ_mask_gen_diagonal_occupancy_masks()
%5 = call i32 (...) @gen_rook_mask()
%6 = call i32 (...) @gen_queen_mask()
ret void
}

LLVM IR (-O2):
define void @occ_mask_init() {
%1 = tail call i32 (...) @gen_in_between_sq_mask()
%2 = tail call i32 (...) @gen_knight_mask()
%3 = tail call i32 (...) @gen_king_mask()
%4 = tail call i32 (...) @occ_mask_gen_diagonal_occupancy_masks()
%5 = tail call i32 (...) @gen_rook_mask()
%6 = tail call i32 (...) @gen_queen_mask()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(int argc, const char *argv[]) {
  float r = 1;
  float area;
  area = 3.14 * r * r;
  printf("Area of circle is: %f", area);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Area of circle is: %f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 1.000000e+00, float* %6
%8 = load float, float* %6
%9 = fpext float %8 to double
%10 = fmul double 3.140000e+00, %9
%11 = load float, float* %6
%12 = fpext float %11 to double
%13 = fmul double %10, %12
%14 = fptrunc double %13 to float
store float %14, float* %7
%15 = load float, float* %7
%16 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Area of circle is: %f\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float 0x40091EB860000000)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __builtin_arm_rsr64(char *);
uint64_t rsr64(void) { return __builtin_arm_rsr64("1:2:3:4:5"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"1:2:3:4:5\00"
define i32 @rsr64() {
%1 = call i32 @__builtin_arm_rsr64(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [10 x i8] c"1:2:3:4:5\00"
define i32 @rsr64() {
%1 = tail call i32 @__builtin_arm_rsr64(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, int);
void memcpy9() {
  int a[4] = {0};
  memcpy(a + 2, a + 1, 4);
  memcpy(a + 1, a + 2, 4);
}


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

x86 assembly (clang, -O2):
<memcpy9>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @memcpy9() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = call i32 @memcpy(i32* %4, i32* %6, i32 4)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%11 = getelementptr inbounds i32, i32* %10, i64 2
%12 = call i32 @memcpy(i32* %9, i32* %11, i32 4)
ret void
}

LLVM IR (-O2):
define void @memcpy9() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%5 = call i32 @memcpy(i32* %3, i32* %4, i32 4)
%6 = call i32 @memcpy(i32* %4, i32* %3, i32 4)
ret void
}
/* Type definitions */
struct tbst_table {
  int dummy;
};

/* Variables and functions */
void **tbst_probe(struct tbst_table *, void *);
void *tbst_replace(struct tbst_table *table, void *item) {
  void **p = tbst_probe(table, item);
  if (p == NULL || *p == item)
    return NULL;
  else {
    void *r = *p;
    *p = item;
    return r;
  }
}


x86 assembly (clang, -O0):
<tbst_replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <tbst_probe@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     114d <tbst_replace+0x3d>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    115a <tbst_replace+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    1178 <tbst_replace+0x68>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tbst_replace>:
push   %rbx
mov    %rsi,%rbx
call   1030 <tbst_probe@plt>
test   %rax,%rax
je     112e <tbst_replace+0x1e>
mov    %rax,%rcx
mov    (%rax),%rax
cmp    %rbx,%rax
je     112e <tbst_replace+0x1e>
mov    %rbx,(%rcx)
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tbst_table = type { i32 }
define i8* @tbst_replace(%struct.tbst_table* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca %struct.tbst_table*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
store %struct.tbst_table* %0, %struct.tbst_table** %4
store i8* %1, i8** %5
%8 = load %struct.tbst_table*, %struct.tbst_table** %4
%9 = load i8*, i8** %5
%10 = call i8** @tbst_probe(%struct.tbst_table* %8, i8* %9)
store i8** %10, i8*** %6
%11 = load i8**, i8*** %6
%12 = icmp eq i8** %11, null
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = load i8*, i8** %5
%17 = icmp eq i8* %15, %16
br i1 %17, label %18, label %19
18: ; preds = %13, %2
store i8* null, i8** %3
br label %25
19: ; preds = %13
%20 = load i8**, i8*** %6
%21 = load i8*, i8** %20
store i8* %21, i8** %7
%22 = load i8*, i8** %5
%23 = load i8**, i8*** %6
store i8* %22, i8** %23
%24 = load i8*, i8** %7
store i8* %24, i8** %3
br label %25
25: ; preds = %19, %18
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
%struct.tbst_table = type { i32 }
define i8* @tbst_replace(%struct.tbst_table* %0, i8* %1) {
%3 = tail call i8** @tbst_probe(%struct.tbst_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
br i1 %7, label %9, label %8
8: ; preds = %5
store i8* %1, i8** %3
br label %9
9: ; preds = %2, %5, %8
%10 = phi i8* [ %6, %8 ], [ null, %5 ], [ null, %2 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int setsockopt_timeout(int sockfd, int timeout_ms) {
  return setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout_ms,
                    sizeof(int));
}


x86 assembly (clang, -O0):
<setsockopt_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setsockopt_timeout>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @setsockopt_timeout(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* @SOL_SOCKET
%7 = load i32, i32* @SO_RCVTIMEO
%8 = bitcast i32* %4 to i8*
%9 = call i32 @setsockopt(i32 %5, i32 %6, i32 %7, i8* %8, i32 4)
ret i32 %9
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @setsockopt_timeout(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_RCVTIMEO
%6 = bitcast i32* %3 to i8*
%7 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %6, i32 4)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ str_ret0();
int main() { str_ret0(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @str_ret0()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @str_ret0()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ decrypt_block(void *, void const *);
void aes_decrypt(void *out, const void *in, size_t sz) {
  for (size_t i = 0; i < sz; i += 8) {
    decrypt_block(out, in);
    out += 8;
    in += 8;
  }
}


x86 assembly (clang, -O0):
<aes_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1170 <aes_decrypt+0x60>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <decrypt_block@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <aes_decrypt+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_decrypt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1146 <aes_decrypt+0x36>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%rdi
lea    (%r14,%rbx,1),%rsi
call   1030 <decrypt_block@plt>
add    $0x8,%rbx
cmp    %r12,%rbx
jb     1130 <aes_decrypt+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @aes_decrypt(i8* %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i64 [ %13, %6 ], [ 0, %3 ]
%8 = phi i8* [ %11, %6 ], [ %0, %3 ]
%9 = phi i8* [ %12, %6 ], [ %1, %3 ]
%10 = tail call i32 @decrypt_block(i8* %8, i8* %9)
%11 = getelementptr i8, i8* %8, i64 8
%12 = getelementptr i8, i8* %9, i64 8
%13 = add i64 %7, 8
%14 = icmp ult i64 %13, %2
br i1 %14, label %6, label %5
}
/* Variables and functions */
int /*<<< orphan*/ outb(int /*<<< orphan*/, unsigned long);
void outsb(unsigned long port, const void *src, unsigned long count) {
  const unsigned char *p = src;
  while (count--)
    outb(*p++, port);
}


x86 assembly (clang, -O0):
<outsb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1165 <outsb+0x55>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <outb@plt>
jmp    112c <outsb+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsb>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1146 <outsb+0x36>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%edi
mov    %r15,%rsi
call   1030 <outb@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <outsb+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @outsb(i64 %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %5
%6 = phi i8* [ %9, %5 ], [ %1, %3 ]
%7 = phi i64 [ %8, %5 ], [ %2, %3 ]
%8 = add i64 %7, -1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = tail call i32 @outb(i32 %11, i64 %0)
%13 = icmp eq i64 %8, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %3
ret void
}
void t20(void) { __builtin_abort(); }


x86 assembly (clang, -O0):
<t20>:
push   %rbp
mov    %rsp,%rbp
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<t20>:
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @t20() {
unreachable
}

LLVM IR (-O2):
define void @t20() {
tail call void @abort()
unreachable
}
void g_main_context_get_poll_func() {}


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

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

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

LLVM IR (-O2):
define void @g_main_context_get_poll_func() {
ret void
}
/* Variables and functions */
int lrand48();
int myrandom_limit(int max) {
  int value = lrand48() % max;
  return value;
}


x86 assembly (clang, -O0):
<myrandom_limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lrand48@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrandom_limit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <lrand48@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @myrandom_limit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @lrand48()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @myrandom_limit(i32 %0) {
%2 = tail call i32 (...) @lrand48()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ firstFunction();
void main() { firstFunction(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @firstFunction()
ret void
}
int xjosc_initialize(int osc_port) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @xjosc_initialize(i32 %0) {
ret i32 1
}
int getPriority(char letter) {
  switch (letter) {
  case '(':
    return 1;
  case '+':
  case '-':
    return 2;
  case '*':
  case '/':
    return 3;
  }
  return 4;
}


x86 assembly (clang, -O0):
<getPriority>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1158 <getPriority+0x58>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    115f <getPriority+0x5f>
movl   $0x2,-0x4(%rbp)
jmp    115f <getPriority+0x5f>
movl   $0x3,-0x4(%rbp)
jmp    115f <getPriority+0x5f>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPriority>:
add    $0xffffffd8,%edi
mov    $0x4,%eax
cmp    $0x7,%edi
ja     111a <getPriority+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getPriority(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 40, label %6
i32 43, label %7
i32 45, label %7
i32 42, label %8
i32 47, label %8
]
6: ; preds = %1
store i32 1, i32* %2
br label %10
7: ; preds = %1, %1
store i32 2, i32* %2
br label %10
8: ; preds = %1, %1
store i32 3, i32* %2
br label %10
9: ; preds = %1
store i32 4, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.getPriority = [8 x i32] [i32 1, i32 4, i32 3, i32 2, i32 4, i32 2, i32 4, i32 3]
define i32 @getPriority(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -40
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.getPriority, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 4, %1 ]
ret i32 %10
}
void BSEG_ClearLogging(void) {}


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

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

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

LLVM IR (-O2):
define void @BSEG_ClearLogging() {
ret void
}
int bgzf_min(int x, int y) { return (x < y) ? x : y; }


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

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

LLVM IR (-O0):
define i32 @bgzf_min(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 slt 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 @bgzf_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
size_t writen(int, void *, size_t);
void Writen(int fd, void *ptr, size_t nbytes) {
  if (writen(fd, ptr, nbytes) != nbytes) {
    printf("writen error\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<Writen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <writen@plt>
cmp    -0x18(%rbp),%rax
je     1173 <Writen+0x43>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Writen>:
push   %rbx
mov    %rdx,%rbx
call   1040 <writen@plt>
cmp    %rbx,%rax
jne    1140 <Writen+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@str = [13 x i8] c"writen error\00"
define void @Writen(i32 %0, i8* %1, i64 %2) {
%4 = tail call i64 @writen(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret void
}
void LedsP$Led2$makeOutput(void) { HplAtm128GeneralIOPinP$0$IO$makeOutput(); }


x86 assembly (clang, -O0):
<LedsP$Led2$makeOutput>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HplAtm128GeneralIOPinP$0$IO$makeOutput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LedsP$Led2$makeOutput>:
xor    %eax,%eax
jmp    1030 <HplAtm128GeneralIOPinP$0$IO$makeOutput@plt>

LLVM IR (-O0):
define void @"LedsP$Led2$makeOutput"() {
%1 = call i32 (...) @"HplAtm128GeneralIOPinP$0$IO$makeOutput"()
ret void
}

LLVM IR (-O2):
define void @"LedsP$Led2$makeOutput"() {
%1 = tail call i32 (...) @"HplAtm128GeneralIOPinP$0$IO$makeOutput"()
ret void
}
int freeze(int motor) {}


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

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

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

LLVM IR (-O2):
define i32 @freeze(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int dep(int param) {
  printf("real dep param %d\n", param);
  return 1;
}


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

x86 assembly (clang, -O2):
<dep>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"real dep param %d\0A\00"
define i32 @dep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 1
}

LLVM IR (-O2):
@.str = [19 x i8] c"real dep param %d\0A\00"
define i32 @dep(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 1
}
/* Variables and functions */
int strcmp(char *, char *);
int main(int argc, char const *argv[]) { return strcmp("hello", "olleh"); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 -1
}
int test_imm_81int64_lowword_mem(long long *val) {
  return ((*val) & (0x81 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_81int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 129
%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_81int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 129
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
double unifrnd() { return (double)rand() / RAND_MAX; }


x86 assembly (clang, -O0):
<unifrnd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<unifrnd>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @unifrnd() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @unifrnd() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}
void __set_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = (1UL << ((nr) % 32));
  unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);
  *p |= mask;
}


x86 assembly (clang, -O0):
<__set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_bit>:
mov    %edi,%ecx
lea    0x1f(%rcx),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%edx
and    $0xffffffe0,%edx
sub    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%rdx
sar    $0x5,%eax
cltq
or     %rdx,(%rsi,%rax,8)
ret

LLVM IR (-O0):
define void @__set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%7 = load i32, i32* %3
%8 = srem i32 %7, 32
%9 = zext i32 %8 to i64
%10 = shl i64 1, %9
store i64 %10, i64* %5
%11 = load i64*, i64** %4
%12 = load i32, i32* %3
%13 = sdiv i32 %12, 32
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i64, i64* %11, i64 %14
store i64* %15, i64** %6
%16 = load i64, i64* %5
%17 = load i64*, i64** %6
%18 = load i64, i64* %17
%19 = or i64 %18, %16
store i64 %19, i64* %17
ret void
}

LLVM IR (-O2):
define void @__set_bit(i32 %0, i64* nocapture %1) {
%3 = srem i32 %0, 32
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = sdiv i32 %0, 32
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = or i64 %9, %5
store i64 %10, i64* %8
ret void
}
void foo180(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo180(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int foo(int i, int j) {
  printf("%d\n", j);
  return j;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %esi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @foo(i32 %0, i32 returned %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %1
}
/* Variables and functions */
int half(int);
int scalar(int a, int b) {
  a *= -b;
  b++;
  return (half(a * a + b + (b - a) * b) + 3) / 2;
}


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

x86 assembly (clang, -O2):
<scalar>:
push   %rax
imul   %esi,%edi
lea    (%rsi,%rdi,1),%eax
add    $0x1,%eax
imul   %edi,%edi
lea    0x1(%rsi),%ecx
lea    (%rdi,%rsi,1),%edx
add    $0x1,%edx
imul   %ecx,%eax
add    %edx,%eax
mov    %eax,%edi
call   1030 <half@plt>
mov    %eax,%ecx
add    $0x3,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0x3,%eax
sar    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @scalar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sub nsw i32 0, %5
%7 = load i32, i32* %3
%8 = mul nsw i32 %7, %6
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = add nsw i32 %15, %20
%22 = call i32 @half(i32 %21)
%23 = add nsw i32 %22, 3
%24 = sdiv i32 %23, 2
ret i32 %24
}

LLVM IR (-O2):
define i32 @scalar(i32 %0, i32 %1) {
%3 = mul i32 %1, %0
%4 = add nsw i32 %1, 1
%5 = mul i32 %3, %3
%6 = add nsw i32 %5, %4
%7 = add i32 %4, %3
%8 = mul nsw i32 %7, %4
%9 = add nsw i32 %6, %8
%10 = tail call i32 @half(i32 %9)
%11 = add nsw i32 %10, 3
%12 = sdiv i32 %11, 2
ret i32 %12
}
char *fun1(void) {
  char *s = "haha";
  return s;
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"haha\00"
define i8* @fun1() {
%1 = alloca i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [5 x i8] c"haha\00"
define i8* @fun1() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
void display_hex_message(unsigned char *msg, int len) {
  int i;
  for (i = 0; i < len; ++i) {
    printf("\\x%02x", msg[i]);
  }
}


x86 assembly (clang, -O0):
<display_hex_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <display_hex_message+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xebf(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <display_hex_message+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_hex_message>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <display_hex_message+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <display_hex_message+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"\\x%02x\00"
define void @display_hex_message(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\x%02x\00"
define void @display_hex_message(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
int f(int x) {}


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_245() {
  Assert_real((isqrt(245) == 15),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              1230, ("Integer square root of 245 should be 15"));
}


x86 assembly (clang, -O0):
<t_sqrt_245>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf5,%edi
call   1030 <isqrt@plt>
cmp    $0xf,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x4ce,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_245>:
push   %rax
mov    $0xf5,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x4ce,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 245 should be 15\00"
define void @t_sqrt_245() {
%1 = call i32 @isqrt(i32 245)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1230, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 245 should be 15\00"
define void @t_sqrt_245() {
%1 = tail call i32 @isqrt(i32 245)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1230, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
double IncompleteGamma(double, double, int /*<<< orphan*/);
int /*<<< orphan*/ LnGamma(double);
double PGamma(double x, double alpha) {
  return IncompleteGamma(x * alpha, alpha, LnGamma(alpha));
}


x86 assembly (clang, -O0):
<PGamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <LnGamma@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    %eax,%edi
call   1030 <IncompleteGamma@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PGamma>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
call   1040 <LnGamma@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%edi
add    $0x18,%rsp
jmp    1030 <IncompleteGamma@plt>

LLVM IR (-O0):
define double @PGamma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
%8 = load double, double* %4
%9 = load double, double* %4
%10 = call i32 @LnGamma(double %9)
%11 = call double @IncompleteGamma(double %7, double %8, i32 %10)
ret double %11
}

LLVM IR (-O2):
define double @PGamma(double %0, double %1) {
%3 = fmul double %0, %1
%4 = tail call i32 @LnGamma(double %1)
%5 = tail call double @IncompleteGamma(double %3, double %1, i32 %4)
ret double %5
}
/* Variables and functions */
double cos(double);
int /*<<< orphan*/ sin(double);
double sincos_cos(double x) {
  (void)sin(x);
  return cos(x);
}


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

x86 assembly (clang, -O2):
<sincos_cos>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <cos@plt>

LLVM IR (-O0):
define double @sincos_cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @sin(double %3)
%5 = load double, double* %2
%6 = call double @cos(double %5)
ret double %6
}

LLVM IR (-O2):
define double @sincos_cos(double %0) {
%2 = tail call i32 @sin(double %0)
%3 = tail call double @cos(double %0)
ret double %3
}
/* Variables and functions */
int foo();
int printf(char *, int, int);
int main(void) {
  int t1 = ((1 ? -1 : 1u) < 0), t2 = ((0 ? 0u : -1) < 0);
  return foo() + printf("%d, %d\n", t1, t2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %eax,%ebx
lea    0xecf(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fun5() {
  printf("\nin fun5\n");
  return 6;
}


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

x86 assembly (clang, -O2):
<fun5>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0Ain fun5\0A\00"
define i32 @fun5() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 6
}

LLVM IR (-O2):
@str = [9 x i8] c"\0Ain fun5\00"
define i32 @fun5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 6
}
/* Type definitions */
typedef int /*<<< orphan*/ XFontStruct;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XFontStruct(void) {
  XFontStruct *_p = (XFontStruct *)malloc(sizeof(XFontStruct));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XFontStruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XFontStruct+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XFontStruct>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XFontStruct+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XFontStruct() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XFontStruct() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}