xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *ummap_addr_alloc(int, size_t);
void *u_mmap(void *addr, size_t len, ...) {
  assert(addr == 0);
  if (len % 4096)
    len = (1 + len / 4096) * 4096;
  return ummap_addr_alloc(4096, len);
}


x86 assembly (clang, -O0):
<u_mmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
and    $0xfff,%rax
cmp    $0x0,%rax
je     116a <u_mmap+0x4a>
mov    -0x10(%rbp),%rax
shr    $0xc,%rax
add    $0x1,%rax
shl    $0xc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x1000,%edi
call   1040 <ummap_addr_alloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_mmap>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
lea    0x1000(%rbx),%rsi
and    $0xfffffffffffff000,%rsi
test   $0xfff,%ebx
cmove  %rbx,%rsi
mov    $0x1000,%edi
pop    %rbx
jmp    1040 <ummap_addr_alloc@plt>

LLVM IR (-O0):
define i8* @u_mmap(i8* %0, i64 %1, ...) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %4
%10 = urem i64 %9, 4096
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i64, i64* %4
%14 = udiv i64 %13, 4096
%15 = add i64 1, %14
%16 = mul i64 %15, 4096
store i64 %16, i64* %4
br label %17
17: ; preds = %12, %2
%18 = load i64, i64* %4
%19 = call i8* @ummap_addr_alloc(i32 4096, i64 %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @u_mmap(i8* readnone %0, i64 %1, ...) {
%3 = icmp eq i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = and i64 %1, 4095
%7 = icmp eq i64 %6, 0
%8 = add i64 %1, 4096
%9 = and i64 %8, -4096
%10 = select i1 %7, i64 %1, i64 %9
%11 = tail call i8* @ummap_addr_alloc(i32 4096, i64 %10)
ret i8* %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char getc(int /*<<< orphan*/ *);
int field_size(FILE *f) {
  int size = 0;
  while (getc(f) != '\0')
    size++;
  return (size);
}


x86 assembly (clang, -O0):
<field_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
movsbl %al,%eax
cmp    $0x0,%eax
je     1146 <field_size+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <field_size+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<field_size>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xffffffff,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <getc@plt>
add    $0x1,%ebx
test   %al,%al
jne    1120 <field_size+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @field_size(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %6, %2 ]
%4 = tail call signext i8 @getc(i32* %0)
%5 = icmp eq i8 %4, 0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t usb_hi(uint16_t val) { return (val >> 8) & 0xff; }


x86 assembly (clang, -O0):
<usb_hi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @usb_hi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = and i32 %4, 255
ret i32 %5
}

LLVM IR (-O2):
define i32 @usb_hi(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
ret i32 %3
}
/* Type definitions */
struct VFile {
  int dummy;
};

/* Variables and functions */
struct VFile *VFileFromFD(int);
int open(char const *, int, int);
struct VFile *VFileOpen(const char *path, int flags) {
  if (!path) {
    return 0;
  }
  int fd = open(path, flags, 0666);
  return VFileFromFD(fd);
}


x86 assembly (clang, -O0):
<VFileOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <VFileOpen+0x27>
movq   $0x0,-0x8(%rbp)
jmp    1167 <VFileOpen+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1b6,%edx
call   1030 <open@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <VFileFromFD@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VFileOpen>:
test   %rdi,%rdi
je     1138 <VFileOpen+0x18>
push   %rax
mov    $0x1b6,%edx
call   1030 <open@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <VFileFromFD@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.VFile = type { i32 }
define %struct.VFile* @VFileOpen(i8* %0, i32 %1) {
%3 = alloca %struct.VFile*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store %struct.VFile* null, %struct.VFile** %3
br label %16
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 @open(i8* %11, i32 %12, i32 438)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call %struct.VFile* @VFileFromFD(i32 %14)
store %struct.VFile* %15, %struct.VFile** %3
br label %16
16: ; preds = %10, %9
%17 = load %struct.VFile*, %struct.VFile** %3
ret %struct.VFile* %17
}

LLVM IR (-O2):
%struct.VFile = type { i32 }
define %struct.VFile* @VFileOpen(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @open(i8* %0, i32 %1, i32 438)
%6 = tail call %struct.VFile* @VFileFromFD(i32 %5)
br label %7
7: ; preds = %2, %4
%8 = phi %struct.VFile* [ %6, %4 ], [ null, %2 ]
ret %struct.VFile* %8
}
void gtk_adjustment_clamp_page() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ IntEnable(int /*<<< orphan*/);
int /*<<< orphan*/ IntRegister(int /*<<< orphan*/, void (*)());
int /*<<< orphan*/ _USBIntNumberGet(int /*<<< orphan*/);
void USBIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)) {
  uint32_t ui32Int;
  ;
  ui32Int = _USBIntNumberGet(ui32Base);
  ;
  IntRegister(ui32Int, pfnHandler);
  IntEnable(ui32Int);
}


x86 assembly (clang, -O0):
<USBIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <_USBIntNumberGet@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <IntRegister@plt>
mov    -0x14(%rbp),%edi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntRegister>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <_USBIntNumberGet@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <IntRegister@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @USBIntRegister(i32 %0, void ()* %1) {
%3 = alloca i32
%4 = alloca void ()*
%5 = alloca i32
store i32 %0, i32* %3
store void ()* %1, void ()** %4
%6 = load i32, i32* %3
%7 = call i32 @_USBIntNumberGet(i32 %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load void ()*, void ()** %4
%10 = bitcast void ()* %9 to void (...)*
%11 = call i32 @IntRegister(i32 %8, void (...)* %10)
%12 = load i32, i32* %5
%13 = call i32 @IntEnable(i32 %12)
ret void
}

LLVM IR (-O2):
define void @USBIntRegister(i32 %0, void ()* %1) {
%3 = tail call i32 @_USBIntNumberGet(i32 %0)
%4 = bitcast void ()* %1 to void (...)*
%5 = tail call i32 @IntRegister(i32 %3, void (...)* %4)
%6 = tail call i32 @IntEnable(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy_s(char *, size_t, char const *, size_t);
char *platform_strncpy(char *dest, const char *src, size_t num) {
  strncpy_s(dest, num, src, num);
  return dest;
}


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

x86 assembly (clang, -O2):
<platform_strncpy>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rcx,%rsi
call   1030 <strncpy_s@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @platform_strncpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %6
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @strncpy_s(i8* %7, i64 %8, i8* %9, i64 %10)
%12 = load i8*, i8** %4
ret i8* %12
}

LLVM IR (-O2):
define i8* @platform_strncpy(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i32 @strncpy_s(i8* %0, i64 %2, i8* %1, i64 %2)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ set_carry_flag(int);
void handle_carry_flag_sub(const int value1, const int value2) {
  set_carry_flag((value1 - value2) < 0);
}


x86 assembly (clang, -O0):
<handle_carry_flag_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <set_carry_flag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_carry_flag_sub>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
mov    %eax,%edi
jmp    1030 <set_carry_flag@plt>

LLVM IR (-O0):
define void @handle_carry_flag_sub(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 = sub nsw i32 %5, %6
%8 = icmp slt i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @set_carry_flag(i32 %9)
ret void
}

LLVM IR (-O2):
define void @handle_carry_flag_sub(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @set_carry_flag(i32 %4)
ret void
}
void lh_doall_arg(void) {}


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

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

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

LLVM IR (-O2):
define void @lh_doall_arg() {
ret void
}
/* Variables and functions */
int close(int);
int cerrarLock(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<cerrarLock>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @cerrarLock(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
void spi_init(void) {}


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

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

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

LLVM IR (-O2):
define void @spi_init() {
ret void
}
int integer_power(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret *= x;
    }
    x *= x;
    n >>= 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<integer_power>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    114c <integer_power+0x4c>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1134 <integer_power+0x34>
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <integer_power+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer_power>:
test   %esi,%esi
jle    113a <integer_power+0x3a>
mov    $0x1,%r8d
mov    $0x1,%eax
mov    %esi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   $0x1,%sil
mov    %edi,%ecx
cmove  %r8d,%ecx
imul   %ecx,%eax
imul   %edi,%edi
shr    %edx
cmp    $0x1,%esi
mov    %edx,%esi
ja     1120 <integer_power+0x20>
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @integer_power(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %4
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = mul nsw i32 %15, %14
store i32 %16, i32* %5
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %4
%22 = ashr i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %6
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
define i32 @integer_power(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 1, %2 ]
%6 = phi i32 [ %13, %4 ], [ %1, %2 ]
%7 = phi i32 [ %12, %4 ], [ %0, %2 ]
%8 = and i32 %6, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 1, i32 %7
%11 = mul nsw i32 %10, %5
%12 = mul nsw i32 %7, %7
%13 = lshr i32 %6, 1
%14 = icmp ult i32 %6, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i32 [ 1, %2 ], [ %11, %4 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ CMP1_DriverIRQHandler();
__attribute__((weak)) void CMP1_IRQHandler(void) { CMP1_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @CMP1_IRQHandler() {
%1 = call i32 (...) @CMP1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @CMP1_IRQHandler() {
%1 = tail call i32 (...) @CMP1_DriverIRQHandler()
ret void
}
__attribute__((no, noclone)) int f0(unsigned char x, unsigned char y) {
  return (x + y) & 0x2ff;
}


x86 assembly (clang, -O0):
<f0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
add    %ecx,%eax
and    $0x2ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f0>:
add    %esi,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @f0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = add nsw i32 %6, %8
%10 = and i32 %9, 767
ret i32 %10
}

LLVM IR (-O2):
define i32 @f0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = add nuw nsw i32 %4, %3
%6 = and i32 %5, 255
ret i32 %6
}
unsigned long insert_rbs(unsigned long insn, long value, const char **errmsg) {
  return insn | (((insn >> 21) & 0x1f) << 11);
}


x86 assembly (clang, -O0):
<insert_rbs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x15,%rcx
and    $0x1f,%rcx
shl    $0xb,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_rbs>:
mov    %rdi,%rax
shr    $0xa,%rax
and    $0xf800,%eax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @insert_rbs(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %4
%9 = lshr i64 %8, 21
%10 = and i64 %9, 31
%11 = shl i64 %10, 11
%12 = or i64 %7, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @insert_rbs(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = lshr i64 %0, 10
%5 = and i64 %4, 63488
%6 = or i64 %5, %0
ret i64 %6
}
/* Variables and functions */
int get_max(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int x, y, z, m;
  scanf("%d %d %d", &x, &y, &z);
  m = get_max(x, y, z);
  printf("max(%d, %d, %d) = %d\n", x, y, z, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <get_max@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1040 <get_max@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe96(%rip),%rdi
mov    %eax,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [22 x i8] c"max(%d, %d, %d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @get_max(i32 %7, i32 %8, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [22 x i8] c"max(%d, %d, %d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @get_max(i32 %8, i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13, i32 %14, i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void startItFunVerbose(const char *descr) { printf("   - it %s\n", descr); }


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

x86 assembly (clang, -O2):
<startItFunVerbose>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c" - it %s\0A\00"
define void @startItFunVerbose(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int uwsgi_str4_num(char *str) {
  int num = 0;
  num = 1000 * (str[0] - 48);
  num += 100 * (str[1] - 48);
  num += 10 * (str[2] - 48);
  num += str[3] - 48;
  return num;
}


x86 assembly (clang, -O0):
<uwsgi_str4_num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
imul   $0x64,%eax,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
sub    $0x30,%eax
imul   $0xa,%eax,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_str4_num>:
movsbl (%rdi),%eax
imul   $0x3e8,%eax,%eax
movsbl 0x1(%rdi),%ecx
imul   $0x64,%ecx,%ecx
add    %eax,%ecx
movsbl 0x2(%rdi),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x3(%rdi),%edx
lea    (%rcx,%rax,2),%eax
add    %edx,%eax
add    $0xffff2fb0,%eax
ret

LLVM IR (-O0):
define i32 @uwsgi_str4_num(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 48
%9 = mul nsw i32 1000, %8
store i32 %9, i32* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = mul nsw i32 100, %14
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 48
%23 = mul nsw i32 10, %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, %23
store i32 %25, i32* %3
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 48
%31 = load i32, i32* %3
%32 = add nsw i32 %31, %30
store i32 %32, i32* %3
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @uwsgi_str4_num(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = mul nsw i32 %3, 1000
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = mul nsw i32 %7, 100
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = mul nsw i32 %11, 10
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add nsw i32 %4, -53328
%17 = add nsw i32 %16, %8
%18 = add nsw i32 %17, %12
%19 = add nsw i32 %18, %15
ret i32 %19
}
void error_msg(const char *message) {
  __asm__ __volatile__("xor %%ah , %%ah\n"
                       "mov $0x02, %%al\n"
                       "mov $0x20, %%bh\n"
                       "int $0x10\n"
                       :);
  puts(message);
  puts("Press any key to reboot");
  getch();
  __asm__ __volatile__("int $0x19");
}


x86 assembly (clang, -O0):
<error_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %ah,%ah
mov    $0x2,%al
mov    $0x20,%bh
int    $0x10
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <getch@plt>
int    $0x19
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_msg>:
push   %rax
xor    %ah,%ah
mov    $0x2,%al
mov    $0x20,%bh
int    $0x10
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getch@plt>
int    $0x19
pop    %rax
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Press any key to reboot\00"
define void @error_msg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %3)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Press any key to reboot\00"
define void @error_msg(i8* %0) {
tail call void asm sideeffect "xor %ah , %ah\0Amov $$0x02, %al\0Amov $$0x20, %bh\0Aint $$0x10\0A", "~{dirflag},~{fpsr},~{flags}"()
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getch()
tail call void asm sideeffect "int $$0x19", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LONG_MAX;
scalar_t__ nrand(int /*<<< orphan*/);
long random(void) { return (long)nrand(LONG_MAX); }


x86 assembly (clang, -O0):
<random>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <nrand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<random>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <nrand@plt>

LLVM IR (-O0):
@LONG_MAX = global i32 0
define i64 @random() {
%1 = load i32, i32* @LONG_MAX
%2 = call i64 @nrand(i32 %1)
ret i64 %2
}

LLVM IR (-O2):
@LONG_MAX = global i32 0
define i64 @random() {
%1 = load i32, i32* @LONG_MAX
%2 = tail call i64 @nrand(i32 %1)
ret i64 %2
}
void gdk_colormap_get_system() {}


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

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

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

LLVM IR (-O2):
define void @gdk_colormap_get_system() {
ret void
}
/* Variables and functions */
char *xml_find_end(char *, char *);
char *wordin_findendwrapper(char *buf, int ntype) {
  return xml_find_end(buf, "b:Source");
}


x86 assembly (clang, -O0):
<wordin_findendwrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <xml_find_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordin_findendwrapper>:
lea    0xee9(%rip),%rsi
jmp    1030 <xml_find_end@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"b:Source\00"
define i8* @wordin_findendwrapper(i8* %0, i32 %1) {
%3 = tail call i8* @xml_find_end(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void print_usage(const char *progname) {
  fprintf(
      stderr,
      "\nusage: %s [-q|-h] <filename> [/]<node1>/<node2>/<node3>/.../<nodeN>\n",
      progname);
  fprintf(stderr,
          "-q|--quiet activate quiet mode\n-h|--help display this message\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeff(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf12(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [70 x i8] c"\0Ausage: %s [-q|-h] <filename> [/]<node1>/<node2>/<node3>/.../<nodeN>\0A\00"
@.str.1 = [63 x i8] c"-q|--quiet activate quiet mode\0A-h|--help display this message\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [70 x i8] c"\0Ausage: %s [-q|-h] <filename> [/]<node1>/<node2>/<node3>/.../<nodeN>\0A\00"
@.str.1 = [63 x i8] c"-q|--quiet activate quiet mode\0A-h|--help display this message\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct kore_domain {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ accesslog_flush(struct kore_domain *, int /*<<< orphan*/,
                                   int);
void accesslog_flush_cb(struct kore_domain *dom) { accesslog_flush(dom, 0, 1); }


x86 assembly (clang, -O0):
<accesslog_flush_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <accesslog_flush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<accesslog_flush_cb>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <accesslog_flush@plt>

LLVM IR (-O0):
%struct.kore_domain = type { i32 }
define void @accesslog_flush_cb(%struct.kore_domain* %0) {
%2 = alloca %struct.kore_domain*
store %struct.kore_domain* %0, %struct.kore_domain** %2
%3 = load %struct.kore_domain*, %struct.kore_domain** %2
%4 = call i32 @accesslog_flush(%struct.kore_domain* %3, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
%struct.kore_domain = type { i32 }
define void @accesslog_flush_cb(%struct.kore_domain* %0) {
%2 = tail call i32 @accesslog_flush(%struct.kore_domain* %0, i32 0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ printf(char *);
void sigalrm_handler(int sig) {
  printf("foo\n");
  alarm(1);
}


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

x86 assembly (clang, -O2):
<sigalrm_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <alarm@plt>

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

LLVM IR (-O2):
@str = [4 x i8] c"foo\00"
define void @sigalrm_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @alarm(i32 1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void lfsr_next(uint32_t *state) {
  uint32_t state_value = *state;
  uint32_t bit = ((state_value >> 0) ^ (state_value >> 10) ^
                  (state_value >> 30) ^ (state_value >> 31)) &
                 1;
  *state = (state_value >> 1) | (bit << 31);
}


x86 assembly (clang, -O0):
<lfsr_next>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
mov    -0xc(%rbp),%ecx
sar    $0xa,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x1e,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x1f,%ecx
xor    %ecx,%eax
and    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
mov    -0x10(%rbp),%eax
shl    $0x1f,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfsr_next>:
mov    (%rdi),%eax
mov    %eax,%ecx
shr    $0xa,%ecx
xor    %eax,%ecx
mov    %eax,%edx
shr    $0x1e,%edx
xor    %ecx,%edx
mov    %eax,%ecx
sar    %ecx
shl    $0x1f,%edx
and    $0x80000000,%eax
xor    %edx,%eax
or     %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @lfsr_next(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = ashr i32 %7, 0
%9 = load i32, i32* %3
%10 = ashr i32 %9, 10
%11 = xor i32 %8, %10
%12 = load i32, i32* %3
%13 = ashr i32 %12, 30
%14 = xor i32 %11, %13
%15 = load i32, i32* %3
%16 = ashr i32 %15, 31
%17 = xor i32 %14, %16
%18 = and i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = ashr i32 %19, 1
%21 = load i32, i32* %4
%22 = shl i32 %21, 31
%23 = or i32 %20, %22
%24 = load i32*, i32** %2
store i32 %23, i32* %24
ret void
}

LLVM IR (-O2):
define void @lfsr_next(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 10
%4 = xor i32 %3, %2
%5 = lshr i32 %2, 30
%6 = xor i32 %4, %5
%7 = ashr i32 %2, 1
%8 = shl i32 %6, 31
%9 = and i32 %2, -2147483648
%10 = xor i32 %8, %9
%11 = or i32 %10, %7
store i32 %11, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fun();
int main(int argc, char *argv[]) { fun(); }


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @fun()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @fun()
ret i32 0
}
const char *lookup_variable_or_env(const char *szKey, const char *szDefault) {
  return szDefault;
}


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

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

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

LLVM IR (-O2):
define i8* @lookup_variable_or_env(i8* nocapture readnone %0, i8* readnone returned %1) {
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
int setup_build(char *buffer, int size) {
  strncpy(buffer,
          "Build date-time: "
          "Mar 19 2022"
          " "
          "20:52:50",
          size);
}


x86 assembly (clang, -O0):
<setup_build>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <strncpy@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_build>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Build date-time: Mar 19 2022 20:52:50\00"
define i32 @setup_build(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* %5
%8 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [38 x i8] c"Build date-time: Mar 19 2022 20:52:50\00"
define i32 @setup_build(i8* %0, i32 %1) {
%3 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig_handler(int sig_no) { printf("%d\n", sig_no); }


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

x86 assembly (clang, -O2):
<sig_handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @sig_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned int _uiGetVCols(void) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @_uiGetVCols() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("hello"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void char_pointer_array_swap(char *char_pointer_array[], int source,
                             int target) {
  char *place_holder = char_pointer_array[source];
  char_pointer_array[source] = char_pointer_array[target];
  char_pointer_array[target] = place_holder;
}


x86 assembly (clang, -O0):
<char_pointer_array_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,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_pointer_array_swap>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rcx
movslq %edx,%rdx
mov    (%rdi,%rdx,8),%rsi
mov    %rsi,(%rdi,%rax,8)
mov    %rcx,(%rdi,%rdx,8)
ret

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

LLVM IR (-O2):
define void @char_pointer_array_swap(i8** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
store i8* %9, i8** %5
store i8* %6, i8** %8
ret void
}
int islower(int c) { return !!((c >= 'a') && (c <= 'z')); }


x86 assembly (clang, -O0):
<islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <islower+0x20>
cmpl   $0x7a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @islower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = xor i1 %9, true
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int __VERIFIER_nondet_int();
scalar_t__ alloca(int);
int /*<<< orphan*/ sort(int *, int);
int main() {
  int array_size = __VERIFIER_nondet_int();
  if (array_size < 1) {
    array_size = 1;
  }
  int *numbers = (int *)alloca(array_size * sizeof(int));
  sort(numbers, array_size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    115a <main+0x2a>
movl   $0x1,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <sort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
mov    $0x1,%ebx
cmovg  %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <alloca@plt>
mov    %rax,%rdi
mov    %ebx,%esi
call   1030 <sort@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %2
br label %8
8: ; preds = %7, %0
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i64 @alloca(i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %3
%15 = load i32*, i32** %3
%16 = load i32, i32* %2
%17 = call i32 @sort(i32* %15, i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = icmp sgt i32 %1, 1
%3 = select i1 %2, i32 %1, i32 1
%4 = shl i32 %3, 2
%5 = tail call i64 @alloca(i32 %4)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i32 @sort(i32* %6, i32 %3)
ret i32 0
}
void motion_test6(int *data) {
  int j = data[1];
  int k = data[2];
  int i = data[0];
  int n = data[3];
  do
    i = j + i + k;
  while (i < n);
  data[4] = i;
}


x86 assembly (clang, -O0):
<motion_test6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     112f <motion_test6+0x2f>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<motion_test6>:
mov    (%rdi),%eax
mov    0x8(%rdi),%ecx
mov    0xc(%rdi),%edx
add    0x4(%rdi),%ecx
nopl   0x0(%rax,%rax,1)
add    %ecx,%eax
cmp    %edx,%eax
jl     1110 <motion_test6+0x10>
mov    %eax,0x10(%rdi)
ret

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

LLVM IR (-O2):
define void @motion_test6(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = load i32, i32* %4
%6 = load i32, i32* %0
%7 = getelementptr inbounds i32, i32* %0, i64 3
%8 = load i32, i32* %7
%9 = add i32 %5, %3
br label %10
10: ; preds = %10, %1
%11 = phi i32 [ %6, %1 ], [ %12, %10 ]
%12 = add i32 %9, %11
%13 = icmp slt i32 %12, %8
br i1 %13, label %10, label %14
14: ; preds = %10
%15 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %12, i32* %15
ret void
}