xunge/DecIR huggingface dataset:
void swap(int *a, int i, int j) {
  int tmp = a[i];
  a[i] = a[j];
  a[j] = tmp;
}


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

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

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
void VIDDummyVdp1PolylineDraw(void) {}


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

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

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

LLVM IR (-O2):
define void @VIDDummyVdp1PolylineDraw() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ CopyToVRAM(int /*<<< orphan*/ volatile *,
                              int /*<<< orphan*/ const *, int);
void LoadScreenblock(int screenblock, const uint16_t screenblock_data[1024]) {
  CopyToVRAM(((volatile uint16_t *)(0x6000000)) + (screenblock * 1024),
             screenblock_data, 1024);
}


x86 assembly (clang, -O0):
<LoadScreenblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xa,%eax
cltq
mov    $0x6000000,%edi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
call   1030 <CopyToVRAM@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadScreenblock>:
shl    $0xa,%edi
movslq %edi,%rax
lea    0x6000000(,%rax,4),%rdi
06
mov    $0x400,%edx
jmp    1030 <CopyToVRAM@plt>

LLVM IR (-O0):
define void @LoadScreenblock(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 = mul nsw i32 %5, 1024
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* inttoptr (i64 100663296 to i32*), i64 %7
%9 = load i32*, i32** %4
%10 = call i32 @CopyToVRAM(i32* %8, i32* %9, i32 1024)
ret void
}

LLVM IR (-O2):
define void @LoadScreenblock(i32 %0, i32* %1) {
%3 = shl nsw i32 %0, 10
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* inttoptr (i64 100663296 to i32*), i64 %4
%6 = tail call i32 @CopyToVRAM(i32* %5, i32* %1, i32 1024)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_imm(int);
int /*<<< orphan*/ write_instr(int);
int menu_handler(char **save) {
  write_instr(0x00);
  write_imm(0x76);
  write_instr(0x28);
  return 0;
}


x86 assembly (clang, -O0):
<menu_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x76,%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):
<menu_handler>:
push   %rax
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x76,%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 @menu_handler(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @write_instr(i32 0)
%4 = call i32 @write_imm(i32 118)
%5 = call i32 @write_instr(i32 40)
ret i32 0
}

LLVM IR (-O2):
define i32 @menu_handler(i8** nocapture readnone %0) {
%2 = tail call i32 @write_instr(i32 0)
%3 = tail call i32 @write_imm(i32 118)
%4 = tail call i32 @write_instr(i32 40)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
uint8_t *get_nth_rfid(int32_t i) {}


x86 assembly (clang, -O0):
<get_nth_rfid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i32* @get_nth_rfid(i32 %0) {
ret i32* undef
}
long *LoadAcquirePointer(long *volatile *ptr) {
  long *value = *ptr;
  CompilerReadFence();
  return value;
}


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

x86 assembly (clang, -O2):
<LoadAcquirePointer>:
push   %rbx
mov    (%rdi),%rbx
xor    %eax,%eax
call   1030 <CompilerReadFence@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64* @LoadAcquirePointer(i64** %0) {
%2 = load volatile i64*, i64** %0
%3 = tail call i32 (...) @CompilerReadFence()
ret i64* %2
}
int _start() {
  printf("\n %s: \n", __func__);
  printf("in start routine\n");
  xyz();
  _fini();
  exit(0);
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <xyz@plt>
mov    $0x0,%al
call   116c <_fini>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<_start>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <xyz@plt>
xor    %eax,%eax
call   1178 <_fini>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__._start = [7 x i8] c"_start\00"
@.str.1 = [18 x i8] c"in start routine\0A\00"
define i32 @_start() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__._start, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @xyz()
%4 = call i32 (...) @_fini()
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__._start = [7 x i8] c"_start\00"
@str = [17 x i8] c"in start routine\00"
define i32 @_start() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__._start, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @xyz()
%4 = tail call i32 (...) @_fini()
tail call void @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ug_io_transaction(int);
void ug_raw_putc(char ch) { ug_io_transaction(0xb0000000 | (ch << 20)); }


x86 assembly (clang, -O0):
<ug_raw_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
shl    $0x14,%edi
or     $0xb0000000,%edi
call   1030 <ug_io_transaction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ug_raw_putc>:
shl    $0x14,%edi
or     $0xb0000000,%edi
jmp    1030 <ug_io_transaction@plt>

LLVM IR (-O0):
define void @ug_raw_putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = shl i32 %4, 20
%6 = or i32 -1342177280, %5
%7 = call i32 @ug_io_transaction(i32 %6)
ret void
}

LLVM IR (-O2):
define void @ug_raw_putc(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = shl nsw i32 %2, 20
%4 = or i32 %3, -1342177280
%5 = tail call i32 @ug_io_transaction(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_stream_set_suspended_callback() {
  printf("NOT IMPLEMENTED:"
         "pa_stream_set_suspended_callback"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [50 x i8] c"NOT IMPLEMENTED:pa_stream_set_suspended_callback\0A\00"
define i32 @pa_stream_set_suspended_callback() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [49 x i8] c"NOT IMPLEMENTED:pa_stream_set_suspended_callback\00"
define i32 @pa_stream_set_suspended_callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
scalar_t__ rand();
void fillbuf(float *buf, int len) {
  for (int idx = 0; idx < len; idx++)
    buf[idx] = (float)(rand());
}


x86 assembly (clang, -O0):
<fillbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <fillbuf+0x49>
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <fillbuf+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillbuf>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114e <fillbuf+0x3e>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <fillbuf+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @fillbuf(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = tail call i64 (...) @rand()
%10 = sitofp i64 %9 to float
%11 = getelementptr inbounds float, float* %0, i64 %8
store float %10, float* %11
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *visual;
};
typedef TYPE_1__ XEDataObject;
typedef int /*<<< orphan*/ Visual;

/* Variables and functions */
void set_XEDataObject_visual(void *_p, void *_v) {
  ((XEDataObject *)_p)->visual = (Visual *)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XEDataObject_visual(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XEDataObject_visual(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
long main(void) {
  unsigned int cmd;
  int __cil_tmp12;
  if ((unsigned int)((int)cmd) == (unsigned int)__cil_tmp12) {
    cmd = 17;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1117 <main+0x17>
movl   $0x11,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 17, i32* %1
br label %7
7: ; preds = %6, %0
ret i64 0
}

LLVM IR (-O2):
define i64 @main() {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void fff(void) {
  int a = 1;
  a++;
  printf("ORIGINAL:a is:%d\n", a);
}


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

x86 assembly (clang, -O2):
<fff>:
lea    0xee9(%rip),%rdi
mov    $0x2,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"ORIGINAL:a is:%d\0A\00"
define void @fff() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 2)
ret void
}
/* Variables and functions */
scalar_t__ pthread_self();
unsigned long thread_id_cb(void) { return (unsigned long)pthread_self(); }


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

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

LLVM IR (-O0):
define i64 @thread_id_cb() {
%1 = call i64 (...) @pthread_self()
ret i64 %1
}

LLVM IR (-O2):
define i64 @thread_id_cb() {
%1 = tail call i64 (...) @pthread_self()
ret i64 %1
}
void a_and(volatile int *p, int v) {
  __asm__("lock ; and %1, %0" : "=m"(*p) : "r"(v) : "memory");
}


x86 assembly (clang, -O0):
<a_and>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
lock and %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_and>:
lock and %esi,(%rdi)
ret

LLVM IR (-O0):
define void @a_and(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
ret void
}

LLVM IR (-O2):
define void @a_and(i32* %0, i32 %1) {
tail call void asm "lock ; and $1, $0", "=*m,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1)
ret void
}
int test_ft_memcmp() {
  char s1[10];
  char s2[10];
  printf("%s\n", __func__ + 5);
  _it("should not crash with len 0");
  ft_memcmp(s1, s2, 0);
  do {
    _close_pending();
    printf("\n");
    return (0);
  } while (0);
}


x86 assembly (clang, -O0):
<test_ft_memcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeae(%rip),%rsi
add    $0x5,%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <_it@plt>
lea    -0xa(%rbp),%rdi
lea    -0x14(%rbp),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1060 <ft_memcmp@plt>
mov    $0x0,%al
call   1030 <_close_pending@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ft_memcmp>:
sub    $0x18,%rsp
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1060 <_it@plt>
lea    0xe(%rsp),%rdi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1070 <ft_memcmp@plt>
xor    %eax,%eax
call   1050 <_close_pending@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@__func__.test_ft_memcmp = [15 x i8] c"test_ft_memcmp\00"
@.str.1 = [28 x i8] c"should not crash with len 0\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @test_ft_memcmp() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_ft_memcmp, i64 0, i64 5))
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @_it to i32 (i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ft_memcmp to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* %6, i32 0)
br label %8
8: ; preds = %0
%9 = call i32 (...) @_close_pending()
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@__func__.test_ft_memcmp = [15 x i8] c"test_ft_memcmp\00"
@.str.1 = [28 x i8] c"should not crash with len 0\00"
define i32 @test_ft_memcmp() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_ft_memcmp, i64 0, i64 5))
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @_it to i32 (i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ft_memcmp to i32 (i8*, i8*, i32, ...)*)(i8* %3, i8* %4, i32 0)
%8 = call i32 (...) @_close_pending()
%9 = call i32 @putchar(i32 10)
ret i32 0
}
int testBit_fun_ushort(unsigned short x, unsigned i) {
  return (x & 1 << i) != 0;
}


x86 assembly (clang, -O0):
<testBit_fun_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<testBit_fun_ushort>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @testBit_fun_ushort(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i32, i32* %4
%8 = shl i32 1, %7
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @testBit_fun_ushort(i16 zeroext %0, i32 %1) {
%3 = zext i16 %0 to i32
%4 = lshr i32 %3, %1
%5 = and i32 %4, 1
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
void _d_gnu_fd_set(int n, fd_set *p) { FD_SET(n, p); }


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

x86 assembly (clang, -O2):
<_d_gnu_fd_set>:
jmp    1030 <FD_SET@plt>

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

LLVM IR (-O2):
define void @_d_gnu_fd_set(i32 %0, i32* %1) {
%3 = tail call i32 @FD_SET(i32 %0, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int input;
  char output[30];
  scanf("%d", &input);
  void handle(int, char output[], int);
  handle(input, output, 4);
  puts(output);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1040 <handle@plt>
lea    -0x30(%rbp),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <handle@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @puts(i8* %4)
ret void
}
double my_min(double a, double b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<my_min>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <my_min+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <my_min+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_min>:
minsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @my_min(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
double RadToDeg(double rad) { return rad * 180. / 3.14159265358979323846; }


x86 assembly (clang, -O0):
<RadToDeg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @RadToDeg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB54442D18
ret double %5
}

LLVM IR (-O2):
define double @RadToDeg(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB54442D18
ret double %3
}
/* Variables and functions */
int assert_enc_len(int, char *, size_t, char *, size_t);
size_t strlen(char *);
int assert_enc(int flags, char *src, char *dst) {
  size_t srclen = strlen(src);
  size_t dstlen = strlen(dst);
  return assert_enc_len(flags, src, srclen, dst, dstlen);
}


x86 assembly (clang, -O0):
<assert_enc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <assert_enc_len@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_enc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <assert_enc_len@plt>

LLVM IR (-O0):
define i32 @assert_enc(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %7
%11 = load i8*, i8** %6
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %8
%13 = load i32, i32* %4
%14 = load i8*, i8** %5
%15 = load i64, i64* %7
%16 = load i8*, i8** %6
%17 = load i64, i64* %8
%18 = call i32 @assert_enc_len(i32 %13, i8* %14, i64 %15, i8* %16, i64 %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @assert_enc(i32 %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%6 = tail call i32 @assert_enc_len(i32 %0, i8* %1, i64 %4, i8* %2, i64 %5)
ret i32 %6
}
float dotProduct3f(float x1, float y1, float z1, float x2, float y2, float z2) {
  return x1 * x2 + y1 * y2 + z1 * z2;
}


x86 assembly (clang, -O0):
<dotProduct3f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotProduct3f>:
mulss  %xmm4,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm5,%xmm2
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @dotProduct3f(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load float, float* %7
%14 = load float, float* %10
%15 = load float, float* %8
%16 = load float, float* %11
%17 = fmul float %15, %16
%18 = call float @llvm.fmuladd.f32(float %13, float %14, float %17)
%19 = load float, float* %9
%20 = load float, float* %12
%21 = call float @llvm.fmuladd.f32(float %19, float %20, float %18)
ret float %21
}

LLVM IR (-O2):
define float @dotProduct3f(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fmul float %1, %4
%8 = tail call float @llvm.fmuladd.f32(float %0, float %3, float %7)
%9 = tail call float @llvm.fmuladd.f32(float %2, float %5, float %8)
ret float %9
}
/* Type definitions */
typedef unsigned int volatile uint32_t;
typedef unsigned int uint16_t;

/* Variables and functions */
__attribute__((always_)) uint32_t
mchp_espi_sram_bar_size_get(uintptr_t bar_addr) {
  return (*((volatile uint16_t *)(uintptr_t)(bar_addr)) >> 4u) & 0x0Ful;
}


x86 assembly (clang, -O0):
<mchp_espi_sram_bar_size_get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shr    $0x4,%eax
mov    %eax,%eax
and    $0xf,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mchp_espi_sram_bar_size_get>:
mov    (%rdi),%eax
shr    $0x4,%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @mchp_espi_sram_bar_size_get(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = lshr i32 %5, 4
%7 = zext i32 %6 to i64
%8 = and i64 %7, 15
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @mchp_espi_sram_bar_size_get(i64 %0) {
%2 = inttoptr i64 %0 to i32*
%3 = load volatile i32, i32* %2
%4 = lshr i32 %3, 4
%5 = and i32 %4, 15
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char const *);
char *strerror(int);
int globerr(const char *path, int errno) {
  printf("ERROR '%s' reading files in: %s\n", strerror(errno), path);
  exit(0);
}


x86 assembly (clang, -O0):
<globerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<globerr>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1050 <strerror@plt>
lea    0xebe(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"ERROR '%s' reading files in: %s\0A\00"
define i32 @globerr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i8* @strerror(i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"ERROR '%s' reading files in: %s\0A\00"
define i32 @globerr(i8* %0, i32 %1) {
%3 = tail call i8* @strerror(i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %0)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ test_FSM_erase_first();
int /*<<< orphan*/ test_FSM_erase_last();
int /*<<< orphan*/ test_FSM_ffind();
int /*<<< orphan*/ test_FSM_insert();
int /*<<< orphan*/ test_FSM_iterate();
int /*<<< orphan*/ test_FSM_order();
void test_FSM(void) {
  test_FSM_insert();
  test_FSM_iterate();
  test_FSM_ffind();
  test_FSM_order();
  test_FSM_erase_first();
  test_FSM_erase_last();
}


x86 assembly (clang, -O0):
<test_FSM>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_FSM_insert@plt>
mov    $0x0,%al
call   1080 <test_FSM_iterate@plt>
mov    $0x0,%al
call   1070 <test_FSM_ffind@plt>
mov    $0x0,%al
call   1050 <test_FSM_order@plt>
mov    $0x0,%al
call   1040 <test_FSM_erase_first@plt>
mov    $0x0,%al
call   1060 <test_FSM_erase_last@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_FSM>:
push   %rax
xor    %eax,%eax
call   1030 <test_FSM_insert@plt>
xor    %eax,%eax
call   1080 <test_FSM_iterate@plt>
xor    %eax,%eax
call   1070 <test_FSM_ffind@plt>
xor    %eax,%eax
call   1050 <test_FSM_order@plt>
xor    %eax,%eax
call   1040 <test_FSM_erase_first@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <test_FSM_erase_last@plt>

LLVM IR (-O0):
define void @test_FSM() {
%1 = call i32 (...) @test_FSM_insert()
%2 = call i32 (...) @test_FSM_iterate()
%3 = call i32 (...) @test_FSM_ffind()
%4 = call i32 (...) @test_FSM_order()
%5 = call i32 (...) @test_FSM_erase_first()
%6 = call i32 (...) @test_FSM_erase_last()
ret void
}

LLVM IR (-O2):
define void @test_FSM() {
%1 = tail call i32 (...) @test_FSM_insert()
%2 = tail call i32 (...) @test_FSM_iterate()
%3 = tail call i32 (...) @test_FSM_ffind()
%4 = tail call i32 (...) @test_FSM_order()
%5 = tail call i32 (...) @test_FSM_erase_first()
%6 = tail call i32 (...) @test_FSM_erase_last()
ret void
}
int test_imm_51int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x51 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_51int64_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, 81
%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_51int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 5308416
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_memory(void *pointer) { free(pointer); }


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

x86 assembly (clang, -O2):
<free_memory>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_memory(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int rrd_create_r(char const *, unsigned long, int /*<<< orphan*/, int,
                 char const **);
char const *rrd_strerror(int);
const char *rrdCreate(const char *filename, unsigned long step, time_t start,
                      int argc, const char **argv) {
  int ret;
  ret = rrd_create_r(filename, step, start, argc, argv);
  return rrd_strerror(ret);
}


x86 assembly (clang, -O0):
<rrdCreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <rrd_create_r@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <rrd_strerror@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @rrdCreate(i8* %0, i64 %1, i32 %2, i32 %3, i8** %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8** %4, i8*** %10
%12 = load i8*, i8** %6
%13 = load i64, i64* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i8**, i8*** %10
%17 = call i32 @rrd_create_r(i8* %12, i64 %13, i32 %14, i32 %15, i8** %16)
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = call i8* @rrd_strerror(i32 %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @rrdCreate(i8* %0, i64 %1, i32 %2, i32 %3, i8** %4) {
%6 = tail call i32 @rrd_create_r(i8* %0, i64 %1, i32 %2, i32 %3, i8** %4)
%7 = tail call i8* @rrd_strerror(i32 %6)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ sub(int /*<<< orphan*/);
main() {
  if (sub(0) != 0)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <sub@plt>
cmp    $0x0,%rax
je     1157 <main+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <sub@plt>
test   %rax,%rax
jne    1144 <main+0x14>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @sub(i32 0)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @sub(i32 0)
%2 = icmp eq i64 %1, 0
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
}
int main(void) {
  double reate[5] = {12.0, 150, 100, 99, 66.01};
  const double lock[4] = {0.1, 0.2, 0.3, 0.4};
  const double *pc = reate;
  pc = lock;
  pc = &reate[3];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xed4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x58(%rbp)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.lock = [4 x double] [double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x double]
%3 = alloca [4 x double]
%4 = alloca double*
store i32 0, i32* %1
%5 = bitcast [5 x double]* %2 to i8*
%6 = bitcast i8* %5 to [5 x double]*
%7 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 0
store double 1.200000e+01, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 1
store double 1.500000e+02, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 2
store double 1.000000e+02, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 3
store double 9.900000e+01, double* %10
%11 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 4
store double 6.601000e+01, double* %11
%12 = bitcast [4 x double]* %3 to i8*
%13 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
store double* %13, double** %4
%14 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
store double* %14, double** %4
%15 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 3
store double* %15, double** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
float nvClampf(float a, float min, float max) {
  return (a < min) ? min : ((a > max) ? max : a);
}


x86 assembly (clang, -O0):
<nvClampf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <nvClampf+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1167 <nvClampf+0x67>
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1153 <nvClampf+0x53>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    115d <nvClampf+0x5d>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvClampf>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @nvClampf(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* %4
%8 = load float, float* %5
%9 = fcmp olt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
br label %22
12: ; preds = %3
%13 = load float, float* %4
%14 = load float, float* %6
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %6
br label %20
18: ; preds = %12
%19 = load float, float* %4
br label %20
20: ; preds = %18, %16
%21 = phi float [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi float [ %11, %10 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @nvClampf(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
/* Variables and functions */
scalar_t__ compal_get_lcd_brightness();
int /*<<< orphan*/ compal_set_lcd_brightness(scalar_t__);
void Compal_lcdBrightness_UpOneStep(void) {
  compal_set_lcd_brightness(compal_get_lcd_brightness() + 1);
}


x86 assembly (clang, -O0):
<Compal_lcdBrightness_UpOneStep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <compal_get_lcd_brightness@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1040 <compal_set_lcd_brightness@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Compal_lcdBrightness_UpOneStep>:
push   %rax
xor    %eax,%eax
call   1030 <compal_get_lcd_brightness@plt>
lea    0x1(%rax),%rdi
pop    %rax
jmp    1040 <compal_set_lcd_brightness@plt>

LLVM IR (-O0):
define void @Compal_lcdBrightness_UpOneStep() {
%1 = call i64 (...) @compal_get_lcd_brightness()
%2 = add nsw i64 %1, 1
%3 = call i32 @compal_set_lcd_brightness(i64 %2)
ret void
}

LLVM IR (-O2):
define void @Compal_lcdBrightness_UpOneStep() {
%1 = tail call i64 (...) @compal_get_lcd_brightness()
%2 = add nsw i64 %1, 1
%3 = tail call i32 @compal_set_lcd_brightness(i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rm(char *);
int /*<<< orphan*/ sm(char *);
void decarm(int flag) {
  if (flag)
    sm("?8");
  else
    rm("?8");
}


x86 assembly (clang, -O0):
<decarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <decarm+0x26>
lea    0xec4(%rip),%rdi
call   1040 <sm@plt>
jmp    1152 <decarm+0x32>
lea    0xeb3(%rip),%rdi
call   1030 <rm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decarm>:
test   %edi,%edi
je     1130 <decarm+0x10>
lea    0xed5(%rip),%rdi
jmp    1040 <sm@plt>
lea    0xec9(%rip),%rdi
jmp    1030 <rm@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"?8\00"
define void @decarm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @sm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @rm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"?8\00"
define void @decarm(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @sm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @rm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
/* Type definitions */
struct node {
  int dummy;
};
struct list {
  int dummy;
};

/* Variables and functions */
struct node *list_first(struct list *);
struct node *node_next(struct node *);
int list_length(struct list *list) {
  int len = 0;
  struct node *node = list_first(list);
  while (node) {
    len++;
    node = node_next(node);
  }
  return len;
}


x86 assembly (clang, -O0):
<list_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <list_first@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1166 <list_length+0x46>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <node_next@plt>
mov    %rax,-0x18(%rbp)
jmp    1140 <list_length+0x20>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_length>:
push   %rbx
call   1030 <list_first@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1140 <list_length+0x20>
nopl   (%rax)
add    $0x1,%ebx
mov    %rax,%rdi
call   1040 <node_next@plt>
test   %rax,%rax
jne    1130 <list_length+0x10>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
%struct.node = type { i32 }
define i32 @list_length(%struct.list* %0) {
%2 = alloca %struct.list*
%3 = alloca i32
%4 = alloca %struct.node*
store %struct.list* %0, %struct.list** %2
store i32 0, i32* %3
%5 = load %struct.list*, %struct.list** %2
%6 = call %struct.node* @list_first(%struct.list* %5)
store %struct.node* %6, %struct.node** %4
br label %7
7: ; preds = %10, %1
%8 = load %struct.node*, %struct.node** %4
%9 = icmp ne %struct.node* %8, null
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = load %struct.node*, %struct.node** %4
%14 = call %struct.node* @node_next(%struct.node* %13)
store %struct.node* %14, %struct.node** %4
br label %7
15: ; preds = %7
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.node = type { i32 }
define i32 @list_length(%struct.list* %0) {
%2 = tail call %struct.node* @list_first(%struct.list* %0)
%3 = icmp eq %struct.node* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi %struct.node* [ %8, %4 ], [ %2, %1 ]
%6 = phi i32 [ %7, %4 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = tail call %struct.node* @node_next(%struct.node* %5)
%9 = icmp eq %struct.node* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4, %1
%11 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %11
}