xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
scalar_t__ malloc(int);
__attribute__((visibility("hidden"))) int16_t *
osmo_conv_gen_vdec_malloc(size_t n) {
  return (int16_t *)malloc(sizeof(int16_t) * n);
}


x86 assembly (clang, -O0):
<osmo_conv_gen_vdec_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osmo_conv_gen_vdec_malloc>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define hidden i32* @osmo_conv_gen_vdec_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 4, %3
%5 = trunc i64 %4 to i32
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i32*
ret i32* %7
}

LLVM IR (-O2):
define hidden i32* @osmo_conv_gen_vdec_malloc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = shl i32 %2, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ init_auto_mark_appoint(long);
void ver_up_auto_mark_1_1_1(long ls_mbr_n) { init_auto_mark_appoint(ls_mbr_n); }


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

x86 assembly (clang, -O2):
<ver_up_auto_mark_1_1_1>:
jmp    1030 <init_auto_mark_appoint@plt>

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

LLVM IR (-O2):
define void @ver_up_auto_mark_1_1_1(i64 %0) {
%2 = tail call i32 @init_auto_mark_appoint(i64 %0)
ret void
}
void mtarch_exec(struct mtarch_thread *thread) {}


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

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

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

LLVM IR (-O2):
%struct.mtarch_thread = type opaque
define void @mtarch_exec(%struct.mtarch_thread* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MAP_HUGETLB;
int /*<<< orphan*/ mmap_chunks_higher(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void alloc_16m_above_hint() {
  printf("Allocating 16M chunks > 128TB \n");
  mmap_chunks_higher(64, MAP_HUGETLB);
}


x86 assembly (clang, -O0):
<alloc_16m_above_hint>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    $0x40,%edi
call   1040 <mmap_chunks_higher@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_16m_above_hint>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    $0x40,%edi
pop    %rax
jmp    1040 <mmap_chunks_higher@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Allocating 16M chunks > 128TB \0A\00"
@MAP_HUGETLB = global i32 0
define void @alloc_16m_above_hint() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @MAP_HUGETLB
%3 = call i32 @mmap_chunks_higher(i32 64, i32 %2)
ret void
}

LLVM IR (-O2):
@MAP_HUGETLB = global i32 0
@str = [31 x i8] c"Allocating 16M chunks > 128TB \00"
define void @alloc_16m_above_hint() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @MAP_HUGETLB
%3 = tail call i32 @mmap_chunks_higher(i32 64, i32 %2)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t __get_unaligned_le16(const uint8_t *p) { return p[0] | p[1] << 8; }


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

x86 assembly (clang, -O2):
<__get_unaligned_le16>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @__get_unaligned_le16(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @__get_unaligned_le16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames,
                         int compression, int snapshot) {
  return -1;
}


x86 assembly (clang, -O0):
<set_video_mode_Timon>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pwc_device = type opaque
define i32 @set_video_mode_Timon(%struct.pwc_device* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.pwc_device*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.pwc_device* %0, %struct.pwc_device** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 -1
}

LLVM IR (-O2):
%struct.pwc_device = type opaque
define i32 @set_video_mode_Timon(%struct.pwc_device* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret i32 -1
}
int is_any_bit_equals_1(int x) { return !(!x); }


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

x86 assembly (clang, -O2):
<is_any_bit_equals_1>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @is_any_bit_equals_1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_any_bit_equals_1(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int read_byte();
int next_marker(void) {
  int c;
  for (;;) {
    c = read_byte();
    while (c != 0xff)
      c = read_byte();
    do {
      c = read_byte();
    } while (c == 0xff);
    if (c != 0)
      break;
  }
  return c;
}


x86 assembly (clang, -O0):
<next_marker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <read_byte@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
je     113e <next_marker+0x2e>
mov    $0x0,%al
call   1030 <read_byte@plt>
mov    %eax,-0x4(%rbp)
jmp    1122 <next_marker+0x12>
jmp    1143 <next_marker+0x33>
mov    $0x0,%al
call   1030 <read_byte@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
je     1143 <next_marker+0x33>
cmpl   $0x0,-0x4(%rbp)
je     1169 <next_marker+0x59>
jmp    116e <next_marker+0x5e>
jmp    1118 <next_marker+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_marker>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <read_byte@plt>
cmp    $0xff,%eax
jne    1120 <next_marker+0x10>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <read_byte@plt>
cmp    $0xff,%eax
je     1130 <next_marker+0x20>
test   %eax,%eax
je     1120 <next_marker+0x10>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @next_marker() {
br label %1
1: ; preds = %8, %0
%2 = tail call i32 (...) @read_byte()
%3 = icmp eq i32 %2, 255
br i1 %3, label %7, label %4
4: ; preds = %1, %4
%5 = tail call i32 (...) @read_byte()
%6 = icmp eq i32 %5, 255
br i1 %6, label %7, label %4
7: ; preds = %4, %1
br label %8
8: ; preds = %7, %8
%9 = tail call i32 (...) @read_byte()
switch i32 %9, label %10 [
i32 255, label %8
i32 0, label %1
]
10: ; preds = %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
int gcd(int y, int z) {
l:
  if (z) {
    y = y % z;
    swap(&y, &z);
    goto l;
  }
  return y;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <gcd+0x34>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <swap@plt>
jmp    111e <gcd+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
mov    %esi,(%rsp)
test   %esi,%esi
je     114d <gcd+0x3d>
lea    0x4(%rsp),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cltd
idiv   %esi
mov    %edx,0x4(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <swap@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%eax
test   %esi,%esi
jne    1130 <gcd+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %1, i32* %4
%5 = icmp eq i32 %1, 0
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %13, %6 ], [ %0, %2 ]
%8 = phi i32 [ %11, %6 ], [ %1, %2 ]
%9 = srem i32 %7, %8
store i32 %9, i32* %3
%10 = call i32 @swap(i32* %3, i32* %4)
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 0
%13 = load i32, i32* %3
br i1 %12, label %14, label %6
14: ; preds = %6, %2
%15 = phi i32 [ %0, %2 ], [ %13, %6 ]
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
uint32_t sext16to32(uint16_t val) { return (int16_t)val; }


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

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

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

LLVM IR (-O2):
define i32 @sext16to32(i32 returned %0) {
ret i32 %0
}
int tlv_id(unsigned char *outp) { return *outp >> 1; }


x86 assembly (clang, -O0):
<tlv_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlv_id>:
movzbl (%rdi),%eax
shr    %eax
ret

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

LLVM IR (-O2):
define i32 @tlv_id(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = lshr i8 %2, 1
%4 = zext i8 %3 to i32
ret i32 %4
}
void uninit_timer() {}


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

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

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

LLVM IR (-O2):
define void @uninit_timer() {
ret void
}
int int_pos(void *iptr) {
  int *i = iptr;
  return *i > 0;
}


x86 assembly (clang, -O0):
<int_pos>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_pos>:
xor    %eax,%eax
cmpl   $0x0,(%rdi)
setg   %al
ret

LLVM IR (-O0):
define i32 @int_pos(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @int_pos(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void XListDepths() {}


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

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

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

LLVM IR (-O2):
define void @XListDepths() {
ret void
}
void bin16_to_8(int a, unsigned char *b) {
  unsigned short temp = a;
  b[0] = (unsigned char)(temp >> 8);
  b[1] = (unsigned char)temp;
}


x86 assembly (clang, -O0):
<bin16_to_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x12(%rbp),%ax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin16_to_8>:
rol    $0x8,%di
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @bin16_to_8(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i16
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = trunc i32 %6 to i16
store i16 %7, i16* %5
%8 = load i16, i16* %5
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i16, i16* %5
%15 = trunc i16 %14 to i8
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
ret void
}

LLVM IR (-O2):
define void @bin16_to_8(i32 %0, i8* nocapture writeonly %1) {
%3 = lshr i32 %0, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = trunc i32 %0 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int modulo(int, int);
int ADD_mod79(int ip1, int ip2, int ip3, int ip4) {
  return modulo((ip1 & 0x1f) + (ip2 & 0x7f) + (ip3 & 0x7f) + (ip4 & 0x3f), 79) &
         0x7f;
}


x86 assembly (clang, -O0):
<ADD_mod79>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0x1f,%edi
mov    -0x8(%rbp),%eax
and    $0x7f,%eax
add    %eax,%edi
mov    -0xc(%rbp),%eax
and    $0x7f,%eax
add    %eax,%edi
mov    -0x10(%rbp),%eax
and    $0x3f,%eax
add    %eax,%edi
mov    $0x4f,%esi
call   1030 <modulo@plt>
and    $0x7f,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADD_mod79>:
push   %rax
and    $0x1f,%edi
and    $0x7f,%esi
add    %esi,%edi
and    $0x7f,%edx
add    %edx,%edi
and    $0x3f,%ecx
add    %ecx,%edi
mov    $0x4f,%esi
call   1030 <modulo@plt>
and    $0x7f,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ADD_mod79(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = and i32 %9, 31
%11 = load i32, i32* %6
%12 = and i32 %11, 127
%13 = add nsw i32 %10, %12
%14 = load i32, i32* %7
%15 = and i32 %14, 127
%16 = add nsw i32 %13, %15
%17 = load i32, i32* %8
%18 = and i32 %17, 63
%19 = add nsw i32 %16, %18
%20 = call i32 @modulo(i32 %19, i32 79)
%21 = and i32 %20, 127
ret i32 %21
}

LLVM IR (-O2):
define i32 @ADD_mod79(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %0, 31
%6 = and i32 %1, 127
%7 = add nuw nsw i32 %6, %5
%8 = and i32 %2, 127
%9 = add nuw nsw i32 %7, %8
%10 = and i32 %3, 63
%11 = add nuw nsw i32 %9, %10
%12 = tail call i32 @modulo(i32 %11, i32 79)
%13 = and i32 %12, 127
ret i32 %13
}
void CANRegWrite(unsigned long ulRegAddress, unsigned long ulRegValue) {
  volatile int iDelay;
  (*((volatile unsigned long *)(ulRegAddress))) = ulRegValue;
  for (iDelay = 0; iDelay < 5; iDelay++) {
  }
}


x86 assembly (clang, -O0):
<CANRegWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0x5,%eax
jge    113d <CANRegWrite+0x3d>
jmp    112f <CANRegWrite+0x2f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111e <CANRegWrite+0x1e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CANRegWrite>:
mov    %rsi,(%rdi)
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x4,%eax
jg     112e <CANRegWrite+0x2e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x5,%eax
jl     1120 <CANRegWrite+0x20>
ret

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

LLVM IR (-O2):
define void @CANRegWrite(i64 %0, i64 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = inttoptr i64 %0 to i64*
store volatile i64 %1, i64* %5
store volatile i32 0, i32* %3
%6 = load volatile i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %13
8: ; preds = %2, %8
%9 = load volatile i32, i32* %3
%10 = add nsw i32 %9, 1
store volatile i32 %10, i32* %3
%11 = load volatile i32, i32* %3
%12 = icmp slt i32 %11, 5
br i1 %12, label %8, label %13
13: ; preds = %8, %2
ret void
}
long generate_id(char *str) {
  long sum = 0, i;
  for (i = 0; str[i] != '\0'; i++) {
    sum = (sum + str[i]) % 2147483647;
  }
  return sum % 2147483647;
}


x86 assembly (clang, -O0):
<generate_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <generate_id+0x60>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movsbq (%rcx,%rdx,1),%rcx
add    %rcx,%rax
mov    $0x7fffffff,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <generate_id+0x18>
mov    -0x10(%rbp),%rax
mov    $0x7fffffff,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_id>:
mov    (%rdi),%al
test   %al,%al
je     115a <generate_id+0x5a>
add    $0x1,%rdi
xor    %edx,%edx
movabs $0x8000000100000003,%rsi
cs nopw 0x0(%rax,%rax,1)
movsbq %al,%rcx
add    %rdx,%rcx
mov    %rcx,%rax
imul   %rsi
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x1e,%rdx
add    %rax,%rdx
mov    %rdx,%rax
shl    $0x1f,%rax
sub    %rax,%rdx
add    %rcx,%rdx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1120 <generate_id+0x20>
mov    %rdx,%rax
ret
xor    %edx,%edx
mov    %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @generate_id(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i64 [ %10, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i64
%9 = add nsw i64 %7, %8
%10 = srem i64 %9, 2147483647
%11 = add nuw nsw i64 %6, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i64 [ 0, %1 ], [ %10, %4 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
scalar_t__ putenv(char *);
void setEnviron(char *param) {
  if (0 > putenv(param)) {
    perror("Cannot set or add env variable");
  }
}


x86 assembly (clang, -O0):
<setEnviron>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <putenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    114f <setEnviron+0x2f>
lea    0xeb6(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setEnviron>:
push   %rax
call   1030 <putenv@plt>
test   %rax,%rax
js     112d <setEnviron+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Cannot set or add env variable\00"
define void @setEnviron(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @putenv(i8* %3)
%5 = icmp sgt i64 0, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Cannot set or add env variable\00"
define void @setEnviron(i8* %0) {
%2 = tail call i64 @putenv(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
struct game {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ print(struct game const *);
int /*<<< orphan*/ refresh();
void draw(const struct game *g) {
  move(0, 0);
  print(g);
  refresh();
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1050 <move@plt>
mov    -0x8(%rbp),%rdi
call   1030 <print@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1050 <move@plt>
mov    %rbx,%rdi
call   1030 <print@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <refresh@plt>

LLVM IR (-O0):
%struct.game = type { i32 }
define void @draw(%struct.game* %0) {
%2 = alloca %struct.game*
store %struct.game* %0, %struct.game** %2
%3 = call i32 @move(i32 0, i32 0)
%4 = load %struct.game*, %struct.game** %2
%5 = call i32 @print(%struct.game* %4)
%6 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
%struct.game = type { i32 }
define void @draw(%struct.game* %0) {
%2 = tail call i32 @move(i32 0, i32 0)
%3 = tail call i32 @print(%struct.game* %0)
%4 = tail call i32 (...) @refresh()
ret void
}
__attribute__((no)) int divby3(int i) { return i % 3 == 0; }


x86 assembly (clang, -O0):
<divby3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divby3>:
imul   $0xaaaaaaab,%edi,%ecx
add    $0x2aaaaaaa,%ecx
xor    %eax,%eax
cmp    $0x55555555,%ecx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @divby3(i32 %0) {
%2 = srem i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_UD_INPUT() { clear_io_bit(0x36, 1); }


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

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

LLVM IR (-O0):
define void @TOSH_MAKE_UD_INPUT() {
%1 = call i32 @clear_io_bit(i32 54, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_UD_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 54, i32 1)
ret void
}
void g_queue_peek_nth_link() {}


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

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

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

LLVM IR (-O2):
define void @g_queue_peek_nth_link() {
ret void
}
/* Variables and functions */
scalar_t__ tolower(char);
char *strlwr(char *s) {
  while (*s) {
    *s = (char)tolower(*s);
    ++s;
  }
  return s;
}


x86 assembly (clang, -O0):
<strlwr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <strlwr+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <strlwr+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlwr>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <strlwr+0x26>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strlwr+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @strlwr(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i64 @tolower(i8 signext %5)
%8 = trunc i64 %7 to i8
store i8 %8, i8* %6
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i8* [ %0, %1 ], [ %9, %4 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ nop();
void FP_loop_once_intentional_good() {
  do {
    nop();
  } while (0);
}


x86 assembly (clang, -O0):
<FP_loop_once_intentional_good>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <FP_loop_once_intentional_good+0x9>
mov    $0x0,%al
call   1030 <nop@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @FP_loop_once_intentional_good() {
br label %1
1: ; preds = %0
%2 = call i32 (...) @nop()
br label %3
3: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @FP_loop_once_intentional_good() {
%1 = tail call i32 (...) @nop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_imm(int);
int /*<<< orphan*/ write_instr(int);
int up_handler(char **save) {
  write_instr(0x00);
  write_imm(0x52);
  write_instr(0x28);
  return 0;
}


x86 assembly (clang, -O0):
<up_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x52,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<up_handler>:
push   %rax
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x52,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @up_handler(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @write_instr(i32 0)
%4 = call i32 @write_imm(i32 82)
%5 = call i32 @write_instr(i32 40)
ret i32 0
}

LLVM IR (-O2):
define i32 @up_handler(i8** nocapture readnone %0) {
%2 = tail call i32 @write_instr(i32 0)
%3 = tail call i32 @write_imm(i32 82)
%4 = tail call i32 @write_instr(i32 40)
ret i32 0
}
/* Variables and functions */
char *strcat(char *, char const *);
char *test_strcat(char *str1, const char *str2) { return strcat(str1, str2); }


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

x86 assembly (clang, -O2):
<test_strcat>:
jmp    1030 <strcat@plt>

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

LLVM IR (-O2):
define i8* @test_strcat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
scalar_t__ CallBack3(int, void *, void *, void *);
int StoreNumVar(const char *varName, const double *doublePtr1,
                const double *doublePtr2) {
  return (int)CallBack3(5, (void *)varName, (void *)doublePtr1,
                        (void *)doublePtr2);
}


x86 assembly (clang, -O0):
<StoreNumVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x5,%edi
call   1030 <CallBack3@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StoreNumVar>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x5,%edi
jmp    1030 <CallBack3@plt>

LLVM IR (-O0):
define i32 @StoreNumVar(i8* %0, double* %1, double* %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
store i8* %0, i8** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load i8*, i8** %4
%8 = load double*, double** %5
%9 = bitcast double* %8 to i8*
%10 = load double*, double** %6
%11 = bitcast double* %10 to i8*
%12 = call i64 @CallBack3(i32 5, i8* %7, i8* %9, i8* %11)
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @StoreNumVar(i8* %0, double* %1, double* %2) {
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = tail call i64 @CallBack3(i32 5, i8* %0, i8* %4, i8* %5)
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ initifs();
void init() { initifs(); }


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

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

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

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @initifs()
ret void
}
signed int f36(signed int v_foo) {
  signed int v_and = v_foo & -25;
  signed int v_shl = ((unsigned int)v_and) >> 1;
  return v_shl;
}


x86 assembly (clang, -O0):
<f36>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffe7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f36>:
mov    %edi,%eax
shr    %eax
and    $0xfffffff3,%eax
ret

LLVM IR (-O0):
define i32 @f36(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, -25
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = lshr i32 %7, 1
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @f36(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 2147483635
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runTests();
int main(int argc, char **argv) {
  printf("/------- testrun ----------\\\n\n");
  runTests();
  printf("\n\\__________________________/\n\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <runTests@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [30 x i8] c"/------- testrun ----------\\\0A\00"
@str.2 = [31 x i8] c"\0A\\__________________________/\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @runTests()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void gtk_drag_dest_set_proxy() {}


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

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

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

LLVM IR (-O2):
define void @gtk_drag_dest_set_proxy() {
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
ptimeval(struct timeval *tv) { printf("%d:%d\n", tv->tv_sec, tv->tv_usec); }


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

x86 assembly (clang, -O2):
<ptimeval>:
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [7 x i8] c"%d:%d\0A\00"
define i32 @ptimeval(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  open("/bin", O_RDONLY);
  printf("Leaking a file...\n");
  _exit(1);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1050 <open@plt>
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1050 <open@plt>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/bin\00"
@O_RDONLY = global i32 0
@.str.1 = [19 x i8] c"Leaking a file...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @O_RDONLY
%7 = call i32 @open(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"/bin\00"
@O_RDONLY = global i32 0
@str = [18 x i8] c"Leaking a file...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @_exit(i32 1)
unreachable
}
/* Variables and functions */
int which_bit(unsigned int const);
unsigned face_index(const unsigned x) { return which_bit(x) - 1; }


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

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

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

LLVM IR (-O2):
define i32 @face_index(i32 %0) {
%2 = tail call i32 @which_bit(i32 %0)
%3 = add nsw i32 %2, -1
ret i32 %3
}
int lt_dlexit(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @lt_dlexit() {
ret i32 0
}
int symbol_init(struct kvm *kvm) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.kvm = type opaque
define i32 @symbol_init(%struct.kvm* nocapture readnone %0) {
ret i32 0
}
void fun(int n, int a[]) {
  int i;
  for (i = 0; i < 20; i++)
    a[i] = -1;
  for (i = 0; n; i++) {
    a[i] = n % 10;
    n = n / 10;
  }
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    1139 <fun+0x39>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <fun+0x12>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     117c <fun+0x7c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <fun+0x40>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,0x40(%rsi)
movdqu %xmm0,0x30(%rsi)
movdqu %xmm0,0x20(%rsi)
movdqu %xmm0,0x10(%rsi)
movdqu %xmm0,(%rsi)
test   %edi,%edi
je     114f <fun+0x4f>
movslq %edi,%rax
imul   $0x66666667,%rax,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
lea    (%rdi,%rdi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
mov    %edx,(%rsi)
add    $0x9,%eax
add    $0x4,%rsi
cmp    $0x12,%eax
ja     1120 <fun+0x20>
ret

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

LLVM IR (-O2):
define void @fun(i32 %0, i32* nocapture writeonly %1) {
%3 = bitcast i32* %1 to i8*
%4 = icmp eq i32 %0, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %11, %5 ], [ 0, %2 ]
%7 = phi i32 [ %10, %5 ], [ %0, %2 ]
%8 = srem i32 %7, 10
%9 = getelementptr inbounds i32, i32* %1, i64 %6
store i32 %8, i32* %9
%10 = sdiv i32 %7, 10
%11 = add nuw i64 %6, 1
%12 = add i32 %7, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %5
14: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dequeuing_all_items_will_result_in_empty_queue();
int /*<<< orphan*/ empty_queue_should_be_empty();
int /*<<< orphan*/ enqueue_dequeue_cancels_out();
int /*<<< orphan*/ enqueue_to_queue_makes_it_non_empty();
int /*<<< orphan*/ insertion_order_is_preserved();
int /*<<< orphan*/ non_empty_queue_is_not_empty();
int /*<<< orphan*/ repeated_enque_deque_cancels_out();
void queue_tests(void) {
  empty_queue_should_be_empty();
  non_empty_queue_is_not_empty();
  enqueue_to_queue_makes_it_non_empty();
  enqueue_dequeue_cancels_out();
  repeated_enque_deque_cancels_out();
  dequeuing_all_items_will_result_in_empty_queue();
  insertion_order_is_preserved();
}


x86 assembly (clang, -O0):
<queue_tests>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1090 <empty_queue_should_be_empty@plt>
mov    $0x0,%al
call   1050 <non_empty_queue_is_not_empty@plt>
mov    $0x0,%al
call   1040 <enqueue_to_queue_makes_it_non_empty@plt>
mov    $0x0,%al
call   1070 <enqueue_dequeue_cancels_out@plt>
mov    $0x0,%al
call   1060 <repeated_enque_deque_cancels_out@plt>
mov    $0x0,%al
call   1080 <dequeuing_all_items_will_result_in_empty_queue@plt>
mov    $0x0,%al
call   1030 <insertion_order_is_preserved@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<queue_tests>:
push   %rax
xor    %eax,%eax
call   1090 <empty_queue_should_be_empty@plt>
xor    %eax,%eax
call   1050 <non_empty_queue_is_not_empty@plt>
xor    %eax,%eax
call   1040 <enqueue_to_queue_makes_it_non_empty@plt>
xor    %eax,%eax
call   1070 <enqueue_dequeue_cancels_out@plt>
xor    %eax,%eax
call   1060 <repeated_enque_deque_cancels_out@plt>
xor    %eax,%eax
call   1080 <dequeuing_all_items_will_result_in_empty_queue@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <insertion_order_is_preserved@plt>

LLVM IR (-O0):
define void @queue_tests() {
%1 = call i32 (...) @empty_queue_should_be_empty()
%2 = call i32 (...) @non_empty_queue_is_not_empty()
%3 = call i32 (...) @enqueue_to_queue_makes_it_non_empty()
%4 = call i32 (...) @enqueue_dequeue_cancels_out()
%5 = call i32 (...) @repeated_enque_deque_cancels_out()
%6 = call i32 (...) @dequeuing_all_items_will_result_in_empty_queue()
%7 = call i32 (...) @insertion_order_is_preserved()
ret void
}

LLVM IR (-O2):
define void @queue_tests() {
%1 = tail call i32 (...) @empty_queue_should_be_empty()
%2 = tail call i32 (...) @non_empty_queue_is_not_empty()
%3 = tail call i32 (...) @enqueue_to_queue_makes_it_non_empty()
%4 = tail call i32 (...) @enqueue_dequeue_cancels_out()
%5 = tail call i32 (...) @repeated_enque_deque_cancels_out()
%6 = tail call i32 (...) @dequeuing_all_items_will_result_in_empty_queue()
%7 = tail call i32 (...) @insertion_order_is_preserved()
ret void
}
/* Variables and functions */
int strlen(char ch[]) {
  int i;
  for (i = 0; ch[i] != '\0'; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <strlen+0x37>
jmp    1129 <strlen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}