xunge/DecIR huggingface dataset:
/* Type definitions */
struct core_instr_params {
  int dummy;
};
struct core_cpu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ core_cpu_i__jump(struct core_cpu *,
                                    struct core_instr_params *, int);
void core_cpu_i_op_jo(struct core_cpu *cpu, struct core_instr_params *p) {
  core_cpu_i__jump(cpu, p, 0x04);
}


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

x86 assembly (clang, -O2):
<core_cpu_i_op_jo>:
mov    $0x4,%edx
jmp    1030 <core_cpu_i__jump@plt>

LLVM IR (-O0):
%struct.core_cpu = type { i32 }
%struct.core_instr_params = type { i32 }
define void @core_cpu_i_op_jo(%struct.core_cpu* %0, %struct.core_instr_params* %1) {
%3 = alloca %struct.core_cpu*
%4 = alloca %struct.core_instr_params*
store %struct.core_cpu* %0, %struct.core_cpu** %3
store %struct.core_instr_params* %1, %struct.core_instr_params** %4
%5 = load %struct.core_cpu*, %struct.core_cpu** %3
%6 = load %struct.core_instr_params*, %struct.core_instr_params** %4
%7 = call i32 @core_cpu_i__jump(%struct.core_cpu* %5, %struct.core_instr_params* %6, i32 4)
ret void
}

LLVM IR (-O2):
%struct.core_cpu = type { i32 }
%struct.core_instr_params = type { i32 }
define void @core_cpu_i_op_jo(%struct.core_cpu* %0, %struct.core_instr_params* %1) {
%3 = tail call i32 @core_cpu_i__jump(%struct.core_cpu* %0, %struct.core_instr_params* %1, i32 4)
ret void
}
unsigned long long int
unsignedlonglongint_ignoring_shortint(unsigned long long int x, short int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedlonglongint_ignoring_shortint>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsignedlonglongint_ignoring_shortint>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @unsignedlonglongint_ignoring_shortint(i64 %0, i16 signext %1) {
%3 = alloca i64
%4 = alloca i16
store i64 %0, i64* %3
store i16 %1, i16* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @unsignedlonglongint_ignoring_shortint(i64 returned %0, i16 signext %1) {
ret i64 %0
}
/* Type definitions */
struct stat {
  unsigned long long st_size;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int get_device_size(int fd, struct stat *st) {
  unsigned long long blksize = 0;
  int ret = 0;
  ret = -1;
  errno = ENOSYS;
  blksize = 0;
  (void)fd;
  st->st_size = blksize;
  return ret;
}


x86 assembly (clang, -O0):
<get_device_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea7(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_device_size>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
movq   $0x0,(%rsi)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @get_device_size(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
store i64 0, i64* %5
store i32 0, i32* %6
store i32 -1, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
store i64 0, i64* %5
%8 = load i32, i32* %3
%9 = load i64, i64* %5
%10 = load %struct.stat*, %struct.stat** %4
%11 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
store i64 %9, i64* %11
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @get_device_size(i32 %0, %struct.stat* nocapture writeonly %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
%4 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
store i64 0, i64* %4
ret i32 -1
}
/* Type definitions */
typedef scalar_t__ __v4hi;
typedef scalar_t__ __m64;

/* Variables and functions */
__m64 __attribute__((__always___, __nodebug__))
_mm_sub_pi16(__m64 __m1, __m64 __m2) {
  return (__m64)((__v4hi)__m1 - (__v4hi)__m2);
}


x86 assembly (clang, -O0):
<_mm_sub_pi16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_sub_pi16>:
mov    %rdi,%rax
sub    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @_mm_sub_pi16(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @_mm_sub_pi16(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
int test_imm_D8int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xD8 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D8int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14155776
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned int hashbits(unsigned int size) {
  unsigned int val = 1, bits = 0;
  while (val < size && bits < 32) {
    val <<= 1;
    bits++;
  }
  return bits ? bits : 1;
}


x86 assembly (clang, -O0):
<hashbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jae    1130 <hashbits+0x30>
cmpl   $0x20,-0xc(%rbp)
setb   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1140 <hashbits+0x40>
jmp    1157 <hashbits+0x57>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <hashbits+0x15>
cmpl   $0x0,-0xc(%rbp)
je     116c <hashbits+0x6c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <hashbits+0x79>
mov    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <hashbits+0x79>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashbits>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1130 <hashbits+0x30>
mov    $0x1,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %ecx,%ecx
lea    0x1(%rdx),%eax
cmp    %edi,%ecx
jae    1130 <hashbits+0x30>
cmp    $0x1f,%edx
mov    %eax,%edx
jb     1120 <hashbits+0x20>
ret

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

LLVM IR (-O2):
define i32 @hashbits(i32 %0) {
%2 = icmp ugt i32 %0, 1
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ 1, %1 ]
%6 = shl i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %6, %0
%9 = icmp ult i32 %4, 31
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %3, label %11
11: ; preds = %3, %1
%12 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %12
}
void foo596(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo596(i32 %0) {
ret void
}
void Int_TYPE_Ops_dummy___() { ; }


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

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

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

LLVM IR (-O2):
define void @Int_TYPE_Ops_dummy___() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hdl_sys2(int n) { printf("hdl_sys2: Signal recu: message2\n"); }


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"hdl_sys2: Signal recu: message2\0A\00"
define void @hdl_sys2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"hdl_sys2: Signal recu: message2\00"
define void @hdl_sys2(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endblock();
void endfuncblock(void) { endblock(); }


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

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

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

LLVM IR (-O2):
define void @endfuncblock() {
%1 = tail call i32 (...) @endblock()
ret void
}
/* Type definitions */
typedef char *ssize_t;

/* Variables and functions */
long errno;
ssize_t sys_llistxattr(const char *p, char *l, size_t s) {
  long __res;
  __asm__ __volatile__("syscall"
                       : "=a"(__res)
                       : "0"(195), "D"((long)(p)), "S"((long)(l)),
                         "d"((long)(s))
                       : "r11", "rcx", "memory");
  do {
    if ((unsigned long)(__res) >= (unsigned long)(-4095)) {
      errno = -(__res);
      __res = -1;
    }
    return (ssize_t)(__res);
  } while (0);
}


x86 assembly (clang, -O0):
<sys_llistxattr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xc3,%eax
syscall
mov    %rax,-0x20(%rbp)
cmpq   $0xfffffffffffff001,-0x20(%rbp)
ff
jb     114f <sys_llistxattr+0x4f>
xor    %eax,%eax
mov    %eax,%ecx
sub    -0x20(%rbp),%rcx
mov    0x2e9c(%rip),%rax
mov    %rcx,(%rax)
movq   $0xffffffffffffffff,-0x20(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_llistxattr>:
mov    $0xc3,%eax
syscall
cmp    $0xfffffffffffff001,%rax
jb     1123 <sys_llistxattr+0x23>
neg    %rax
mov    0x2ec7(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@errno = global i64 0
define i8* @sys_llistxattr(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
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %10 to i64
%12 = load i64, i64* %6
%13 = call i64 asm sideeffect "syscall", "={ax},0,{di},{si},{dx},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 195, i64 %9, i64 %11, i64 %12)
store i64 %13, i64* %7
br label %14
14: ; preds = %3
%15 = load i64, i64* %7
%16 = icmp uge i64 %15, -4095
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i64, i64* %7
%19 = sub nsw i64 0, %18
store i64 %19, i64* @errno
store i64 -1, i64* %7
br label %20
20: ; preds = %17, %14
%21 = load i64, i64* %7
%22 = inttoptr i64 %21 to i8*
br label %23
23: ; preds = %20
ret i8* %22
}

LLVM IR (-O2):
@errno = global i64 0
define i8* @sys_llistxattr(i8* %0, i8* %1, i64 %2) {
%4 = ptrtoint i8* %0 to i64
%5 = ptrtoint i8* %1 to i64
%6 = tail call i64 asm sideeffect "syscall", "={ax},0,{di},{si},{dx},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 195, i64 %4, i64 %5, i64 %2)
%7 = icmp ugt i64 %6, -4096
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = sub nsw i64 0, %6
store i64 %9, i64* @errno
br label %10
10: ; preds = %8, %3
%11 = phi i64 [ -1, %8 ], [ %6, %3 ]
%12 = inttoptr i64 %11 to i8*
ret i8* %12
}
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int ioctl(int, int, void *);
int xioctl(int fd, int request, void *arg) {
  int r;
  do {
    r = ioctl(fd, request, arg);
  } while (-1 == r && EINTR == errno);
  return r;
}


x86 assembly (clang, -O0):
<xioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x15(%rbp)
jne    1161 <xioctl+0x51>
mov    0x2e8a(%rip),%rax
mov    (%rax),%rax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1122 <xioctl+0x12>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xioctl>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x2eb2(%rip),%r15
mov    0x2eb3(%rip),%r12
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    114a <xioctl+0x3a>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <xioctl+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EINTR = global i64 0
@errno = global i64 0
define i32 @xioctl(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = call i32 @ioctl(i32 %9, i32 %10, i8* %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = icmp eq i32 -1, %14
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @EINTR
%18 = load i64, i64* @errno
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@EINTR = global i64 0
@errno = global i64 0
define i32 @xioctl(i32 %0, i32 %1, i8* %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @ioctl(i32 %0, i32 %1, i8* %2)
%6 = icmp eq i32 %5, -1
%7 = load i64, i64* @EINTR
%8 = load i64, i64* @errno
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
int test_imm_59int8_reg(signed char val) {
  return ((val) & (-0x59 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_59int8_reg(i8 signext %0) {
%2 = and i8 %0, -89
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct rb_tree {
  int dummy;
};

/* Variables and functions */
struct rb_tree *rand_tree(int);
int /*<<< orphan*/ rb_assert(struct rb_tree *);
int /*<<< orphan*/ rb_print(struct rb_tree *, int /*<<< orphan*/);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char **argv) {
  srand(time(0));
  struct rb_tree *t = rand_tree(100);
  rb_assert(t);
  rb_print(t, stdout);
  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)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x64,%edi
call   1060 <rand_tree@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <rb_assert@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
call   1030 <rb_print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x64,%edi
call   1060 <rand_tree@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <rb_assert@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <rb_print@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rb_tree = type { i32 }
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.rb_tree*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @time(i32 0)
%8 = call i32 @srand(i32 %7)
%9 = call %struct.rb_tree* @rand_tree(i32 100)
store %struct.rb_tree* %9, %struct.rb_tree** %6
%10 = load %struct.rb_tree*, %struct.rb_tree** %6
%11 = call i32 @rb_assert(%struct.rb_tree* %10)
%12 = load %struct.rb_tree*, %struct.rb_tree** %6
%13 = load i32, i32* @stdout
%14 = call i32 @rb_print(%struct.rb_tree* %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
%struct.rb_tree = type { i32 }
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call %struct.rb_tree* @rand_tree(i32 100)
%6 = tail call i32 @rb_assert(%struct.rb_tree* %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @rb_print(%struct.rb_tree* %5, i32 %7)
ret i32 0
}
/* Variables and functions */
int *dynCastToInt(int /*<<< orphan*/);
void testDynCastOfNull() {
  int *casted = dynCastToInt(0);
  *casted = 1;
}


x86 assembly (clang, -O0):
<testDynCastOfNull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <dynCastToInt@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDynCastOfNull>:
push   %rax
xor    %edi,%edi
call   1030 <dynCastToInt@plt>
movl   $0x1,(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @testDynCastOfNull() {
%1 = tail call i32* @dynCastToInt(i32 0)
store i32 1, i32* %1
ret void
}
void lock_up(void *lock) {}


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

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

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

LLVM IR (-O2):
define void @lock_up(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int rmdir(char const *);
int remove_empty_dir(const char *path) { return rmdir(path); }


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

x86 assembly (clang, -O2):
<remove_empty_dir>:
jmp    1030 <rmdir@plt>

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

LLVM IR (-O2):
define i32 @remove_empty_dir(i8* nocapture %0) {
%2 = tail call i32 @rmdir(i8* %0)
ret i32 %2
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
int test(void) {
  char *buffer;
  struct tm timestruct;
  buffer = asctime(&timestruct);
  return (buffer != NULL);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <asctime@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    %rsp,%rdi
call   1030 <asctime@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @test() {
%1 = alloca i8*
%2 = alloca %struct.tm
%3 = call i8* @asctime(%struct.tm* %2)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp ne i8* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @test() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = call i8* @asctime(%struct.tm* %1)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ acos(int);
int glmComputeVectorLength4d(double const *);
double glmDegd(int /*<<< orphan*/);
int glmDotProduct4d(double const *, double const *);
double glmComputeVectorAngle4dDeg(const double v1[4], const double v2[4]) {
  return glmDegd(
      acos(glmDotProduct4d(v1, v2) /
           (glmComputeVectorLength4d(v1) * glmComputeVectorLength4d(v2))));
}


x86 assembly (clang, -O0):
<glmComputeVectorAngle4dDeg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <glmDotProduct4d@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <glmComputeVectorLength4d@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <glmComputeVectorLength4d@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
call   1060 <glmDegd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeVectorAngle4dDeg>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <glmDotProduct4d@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <glmComputeVectorLength4d@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <glmComputeVectorLength4d@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <glmDegd@plt>

LLVM IR (-O0):
define double @glmComputeVectorAngle4dDeg(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 = call i32 @glmDotProduct4d(double* %5, double* %6)
%8 = load double*, double** %3
%9 = call i32 @glmComputeVectorLength4d(double* %8)
%10 = load double*, double** %4
%11 = call i32 @glmComputeVectorLength4d(double* %10)
%12 = mul nsw i32 %9, %11
%13 = sdiv i32 %7, %12
%14 = call i32 @acos(i32 %13)
%15 = call double @glmDegd(i32 %14)
ret double %15
}

LLVM IR (-O2):
define double @glmComputeVectorAngle4dDeg(double* %0, double* %1) {
%3 = tail call i32 @glmDotProduct4d(double* %0, double* %1)
%4 = tail call i32 @glmComputeVectorLength4d(double* %0)
%5 = tail call i32 @glmComputeVectorLength4d(double* %1)
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = tail call i32 @acos(i32 %7)
%9 = tail call double @glmDegd(i32 %8)
ret double %9
}
char num2base(int num) {
  char *bases = "ACGT", c;
  c = '?';
  if (num < 0)
    return c;
  if (num > 3)
    return c;
  return bases[num];
}


x86 assembly (clang, -O0):
<num2base>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
lea    0xef2(%rip),%rax
mov    %rax,-0x10(%rbp)
movb   $0x3f,-0x11(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    112b <num2base+0x2b>
mov    -0x11(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    114e <num2base+0x4e>
cmpl   $0x3,-0x8(%rbp)
jle    1140 <num2base+0x40>
mov    -0x11(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    114e <num2base+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num2base>:
mov    $0x3f,%al
cmp    $0x3,%edi
ja     1113 <num2base+0x13>
mov    %edi,%eax
lea    0xef0(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"ACGT\00"
define signext i8 @num2base(i32 %0) {
%2 = icmp ugt i32 %0, 3
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = getelementptr inbounds [5 x i8], [5 x i8]* @.str, i64 0, i64 %4
%6 = load i8, i8* %5
br label %7
7: ; preds = %1, %3
%8 = phi i8 [ %6, %3 ], [ 63, %1 ]
ret i8 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun1(int num) { printf("in fun1\n"); }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"in fun1\0A\00"
define void @fun1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [8 x i8] c"in fun1\00"
define void @fun1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
void kol_btn_type(unsigned t) { asm("int $0x40" ::"a"(48), "b"(1), "c"(t)); }


x86 assembly (clang, -O0):
<kol_btn_type>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x30,%eax
mov    $0x1,%ebx
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_btn_type>:
push   %rbx
mov    %edi,%ecx
mov    $0x30,%eax
mov    $0x1,%ebx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define void @kol_btn_type(i32 %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 48, i32 1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_POINTS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor4fv(float const *);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(float, float);
void draw_point(float x, float y, const float color[4]) {
  glColor4fv(color);
  glBegin(GL_POINTS);
  glVertex2f(x, y);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <glColor4fv@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1050 <glVertex2f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_point>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
call   1030 <glColor4fv@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <glVertex2f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glEnd@plt>

LLVM IR (-O0):
@GL_POINTS = global i32 0
define void @draw_point(float %0, float %1, float* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float*
store float %0, float* %4
store float %1, float* %5
store float* %2, float** %6
%7 = load float*, float** %6
%8 = call i32 @glColor4fv(float* %7)
%9 = load i32, i32* @GL_POINTS
%10 = call i32 @glBegin(i32 %9)
%11 = load float, float* %4
%12 = load float, float* %5
%13 = call i32 @glVertex2f(float %11, float %12)
%14 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_POINTS = global i32 0
define void @draw_point(float %0, float %1, float* %2) {
%4 = tail call i32 @glColor4fv(float* %2)
%5 = load i32, i32* @GL_POINTS
%6 = tail call i32 @glBegin(i32 %5)
%7 = tail call i32 @glVertex2f(float %0, float %1)
%8 = tail call i32 (...) @glEnd()
ret void
}
void net_init() {}


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

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

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

LLVM IR (-O2):
define void @net_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strb_imm_test();
int /*<<< orphan*/ strb_test();
int /*<<< orphan*/ strh_imm_test();
int /*<<< orphan*/ strh_test();
void strb_strh_test(void) {
  strb_test();
  strb_imm_test();
  strh_test();
  strh_imm_test();
}


x86 assembly (clang, -O0):
<strb_strh_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <strb_test@plt>
mov    $0x0,%al
call   1040 <strb_imm_test@plt>
mov    $0x0,%al
call   1030 <strh_test@plt>
mov    $0x0,%al
call   1060 <strh_imm_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strb_strh_test>:
push   %rax
xor    %eax,%eax
call   1050 <strb_test@plt>
xor    %eax,%eax
call   1040 <strb_imm_test@plt>
xor    %eax,%eax
call   1030 <strh_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <strh_imm_test@plt>

LLVM IR (-O0):
define void @strb_strh_test() {
%1 = call i32 (...) @strb_test()
%2 = call i32 (...) @strb_imm_test()
%3 = call i32 (...) @strh_test()
%4 = call i32 (...) @strh_imm_test()
ret void
}

LLVM IR (-O2):
define void @strb_strh_test() {
%1 = tail call i32 (...) @strb_test()
%2 = tail call i32 (...) @strb_imm_test()
%3 = tail call i32 (...) @strh_test()
%4 = tail call i32 (...) @strh_imm_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STUB0(int (*)(int));
int setlogmask(int a) {
  (void)a;
  STUB0(setlogmask);
}


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

x86 assembly (clang, -O2):
<setlogmask>:
mov    0x2ed1(%rip),%rdi
jmp    1030 <STUB0@plt>

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

LLVM IR (-O2):
define i32 @setlogmask(i32 %0) {
%2 = tail call i32 @STUB0(i32 (i32)* @setlogmask)
ret i32 undef
}
/* Variables and functions */
int asin(int);
int internal_asin_i(int value) { return asin(value); }


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

x86 assembly (clang, -O2):
<internal_asin_i>:
jmp    1030 <asin@plt>

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

LLVM IR (-O2):
define i32 @internal_asin_i(i32 %0) {
%2 = tail call i32 @asin(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ w5100_writeSn_byte(unsigned int, int, unsigned int);
void w5100_writeSnMSSR(unsigned sock, unsigned data) {
  w5100_writeSn_byte(sock, 0x0012, data >> 8);
  w5100_writeSn_byte(sock, 0x0012 + 1, data & 0xFF);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
shr    $0x8,%edx
mov    $0x12,%esi
call   1030 <w5100_writeSn_byte@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
and    $0xff,%edx
mov    $0x13,%esi
call   1030 <w5100_writeSn_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edx
shr    $0x8,%edx
mov    $0x12,%esi
call   1030 <w5100_writeSn_byte@plt>
movzbl %bl,%edx
mov    %ebp,%edi
mov    $0x13,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <w5100_writeSn_byte@plt>

LLVM IR (-O0):
define void @w5100_writeSnMSSR(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 = lshr i32 %6, 8
%8 = call i32 @w5100_writeSn_byte(i32 %5, i32 18, i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = and i32 %10, 255
%12 = call i32 @w5100_writeSn_byte(i32 %9, i32 19, i32 %11)
ret void
}

LLVM IR (-O2):
define void @w5100_writeSnMSSR(i32 %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = tail call i32 @w5100_writeSn_byte(i32 %0, i32 18, i32 %3)
%5 = and i32 %1, 255
%6 = tail call i32 @w5100_writeSn_byte(i32 %0, i32 19, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *sentRev(char *);
void main() {
  char str[] = "This sentence will be reversed";
  printf("%s\n", sentRev(str));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xebb(%rip),%al
mov    %al,-0x2(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <sentRev@plt>
mov    %rax,%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee4(%rip),%xmm0
movups %xmm0,0xf(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <sentRev@plt>
lea    0xed5(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.str = [31 x i8] c"This sentence will be reversed\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [31 x i8]
%2 = bitcast [31 x i8]* %1 to i8*
%3 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%4 = call i8* @sentRev(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@__const.main.str = [31 x i8] c"This sentence will be reversed\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [31 x i8]
%2 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%3 = call i8* @sentRev(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
double lowest_bit() {
  double t;
  double tt;
  t = 1;
  tt = 0;
  while (1 + t > 1) {
    tt = t;
    t /= 2;
  }
  return tt;
}


x86 assembly (clang, -O0):
<lowest_bit>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xedf(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115d <lowest_bit+0x5d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1119 <lowest_bit+0x19>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @lowest_bit() {
%1 = alloca double
%2 = alloca double
store double 1.000000e+00, double* %1
store double 0.000000e+00, double* %2
br label %3
3: ; preds = %7, %0
%4 = load double, double* %1
%5 = fadd double 1.000000e+00, %4
%6 = fcmp ogt double %5, 1.000000e+00
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load double, double* %1
store double %8, double* %2
%9 = load double, double* %1
%10 = fdiv double %9, 2.000000e+00
store double %10, double* %1
br label %3
11: ; preds = %3
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
define double @lowest_bit() {
ret double 0x3CB0000000000000
}
struct shader_s *R_RegisterPic(const char *name) {
  return ((void *)0);
}


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

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

LLVM IR (-O0):
%struct.shader_s = type opaque
define %struct.shader_s* @R_RegisterPic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret %struct.shader_s* null
}

LLVM IR (-O2):
%struct.shader_s = type opaque
define noalias %struct.shader_s* @R_RegisterPic(i8* nocapture readnone %0) {
ret %struct.shader_s* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void print_nodes(int nodes) { fprintf(stderr, "nodes: %d\n", nodes); }


x86 assembly (clang, -O0):
<print_nodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_nodes>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"nodes: %d\0A\00"
define void @print_nodes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"nodes: %d\0A\00"
define void @print_nodes(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int);
void main() {
  if (foo(0x080000000LL) != -1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80000000,%edi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
je     114e <main+0x1e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80000000,%edi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @foo(i32 -2147483648)
%2 = icmp ne i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @foo(i32 -2147483648)
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
void v3set(float *v, float x, float y, float z) {
  v[0] = x;
  v[1] = y;
  v[2] = z;
}


x86 assembly (clang, -O0):
<v3set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3set>:
movss  %xmm0,(%rdi)
movss  %xmm1,0x4(%rdi)
movss  %xmm2,0x8(%rdi)
ret

LLVM IR (-O0):
define void @v3set(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %6
%10 = load float*, float** %5
%11 = getelementptr inbounds float, float* %10, i64 0
store float %9, float* %11
%12 = load float, float* %7
%13 = load float*, float** %5
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
%15 = load float, float* %8
%16 = load float*, float** %5
%17 = getelementptr inbounds float, float* %16, i64 2
store float %15, float* %17
ret void
}

LLVM IR (-O2):
define void @v3set(float* nocapture writeonly %0, float %1, float %2, float %3) {
store float %1, float* %0
%5 = getelementptr inbounds float, float* %0, i64 1
store float %2, float* %5
%6 = getelementptr inbounds float, float* %0, i64 2
store float %3, float* %6
ret void
}
int test_imm_3Aint8_reg(signed char val) {
  return ((val) & (0x3A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Aint8_reg(i8 signext %0) {
%2 = and i8 %0, 58
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i;
  int var;
  i = 0;
  var = i ? 100 : 200;
  printf("var: %i\n", var);
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"var: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 100, i32 200
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"var: %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 200)
ret i32 0
}
void strip_crlf(char *str) {
  while (*str)
    ++str;
  str -= 2;
  if (*str == '\r')
    *str = *(str + 2);
}


x86 assembly (clang, -O0):
<strip_crlf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1126 <strip_crlf+0x26>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <strip_crlf+0x8>
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    114f <strip_crlf+0x4f>
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_crlf>:
add    $0xfffffffffffffffd,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,0x3(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strip_crlf+0x10>
cmpb   $0xd,(%rdi)
jne    1122 <strip_crlf+0x22>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @strip_crlf(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 %10
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
br label %3
10: ; preds = %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 -2
store i8* %12, i8** %2
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 13
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = load i8*, i8** %2
store i8 %20, i8* %21
br label %22
22: ; preds = %17, %10
ret void
}

LLVM IR (-O2):
define void @strip_crlf(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 -2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 13
br i1 %10, label %11, label %12
11: ; preds = %7
store i8 0, i8* %8
br label %12
12: ; preds = %11, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NETX_PFIFO_BASE(int);
unsigned int readl(int /*<<< orphan*/);
unsigned int pfifo_pop(int no) { return readl(NETX_PFIFO_BASE(no)); }


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

x86 assembly (clang, -O2):
<pfifo_pop>:
push   %rax
call   1040 <NETX_PFIFO_BASE@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <readl@plt>

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

LLVM IR (-O2):
define i32 @pfifo_pop(i32 %0) {
%2 = tail call i32 @NETX_PFIFO_BASE(i32 %0)
%3 = tail call i32 @readl(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sigterm() { exit(0); }


x86 assembly (clang, -O0):
<sigterm>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sigterm>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @sigterm() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sigterm() {
%1 = tail call i32 @exit(i32 0)
unreachable
}