xunge/DecIR huggingface dataset:
void swap(unsigned int *array, unsigned int a, unsigned int b) {
  unsigned int temp = array[a];
  array[a] = array[b];
  array[b] = temp;
}


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
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    %esi,%eax
mov    (%rdi,%rax,4),%ecx
mov    %edx,%edx
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 = zext 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 = zext 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 = zext 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 = zext 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 = zext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = zext 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
}
unsigned short assign_bit_HWCTS(unsigned reg_value, int set) {
  return (reg_value & ~0x4000) | (set ? 0x4000 : 0);
}


x86 assembly (clang, -O0):
<assign_bit_HWCTS>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffbfff,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x4000,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assign_bit_HWCTS>:
xor    %eax,%eax
test   %esi,%esi
setne  %al
and    $0xbfff,%edi
shl    $0xe,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @assign_bit_HWCTS(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 = and i32 %5, -16385
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 16384, i32 0
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @assign_bit_HWCTS(i32 %0, i32 %1) {
%3 = and i32 %0, 49151
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 0, i32 16384
%6 = or i32 %5, %3
%7 = trunc i32 %6 to i16
ret i16 %7
}
/* Variables and functions */
int /*<<< orphan*/ CopierZone(int, int, int, int, int, int, int, int);
void save_buff_zone(int x, int y, int w, int h, int x_save, int y_save) {
  CopierZone(1, 3, x, y, w, h, x_save, y_save);
}


x86 assembly (clang, -O0):
<save_buff_zone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x14(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    $0x1,%edi
mov    $0x3,%esi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <CopierZone@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_buff_zone>:
push   %rax
mov    %r9d,%eax
mov    %r8d,%r10d
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x1,%edi
mov    $0x3,%esi
push   %rax
push   %r10
call   1030 <CopierZone@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @save_buff_zone(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i32 @CopierZone(i32 1, i32 3, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
define void @save_buff_zone(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @CopierZone(i32 1, i32 3, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5)
ret void
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memcpy(void *, void const *, int);
void *memdup(const void *s, int n) {
  void *d = malloc(n);
  if (d)
    memcpy(d, s, n);
  return d;
}


x86 assembly (clang, -O0):
<memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1156 <memdup+0x36>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdup>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1145 <memdup+0x25>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @memdup(i8* %0, i32 %1) {
%3 = tail call i8* @malloc(i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memcpy(i8* %3, i8* %0, i32 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
int foo(int a) { return - --a; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = sub i32 1, %0
ret i32 %2
}
/* Variables and functions */
int lspcon_i2c_spi_write_register(int, int, int /*<<< orphan*/);
int lspcon_i2c_spi_disable_hw_write(int fd) {
  return lspcon_i2c_spi_write_register(fd, 0xda, 0);
}


x86 assembly (clang, -O0):
<lspcon_i2c_spi_disable_hw_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xda,%esi
xor    %edx,%edx
call   1030 <lspcon_i2c_spi_write_register@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lspcon_i2c_spi_disable_hw_write>:
mov    $0xda,%esi
xor    %edx,%edx
jmp    1030 <lspcon_i2c_spi_write_register@plt>

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

LLVM IR (-O2):
define i32 @lspcon_i2c_spi_disable_hw_write(i32 %0) {
%2 = tail call i32 @lspcon_i2c_spi_write_register(i32 %0, i32 218, i32 0)
ret i32 %2
}
int system_ctx_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @system_ctx_init() {
ret i32 0
}
/* Variables and functions */
int testLibCycleA2();
int testLibCycleB1(void) { return testLibCycleA2(); }


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

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

LLVM IR (-O0):
define i32 @testLibCycleB1() {
%1 = call i32 (...) @testLibCycleA2()
ret i32 %1
}

LLVM IR (-O2):
define i32 @testLibCycleB1() {
%1 = tail call i32 (...) @testLibCycleA2()
ret i32 %1
}
void screen320x200(void) { __asm__ __volatile__("hlt"); }


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

x86 assembly (clang, -O2):
hlt
ret

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

LLVM IR (-O2):
define void @screen320x200() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int do_257() { return 257; }


x86 assembly (clang, -O0):
<do_257>:
push   %rbp
mov    %rsp,%rbp
mov    $0x101,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_257() {
ret i32 257
}

LLVM IR (-O2):
define i32 @do_257() {
ret i32 257
}
unsigned int rt_rand(unsigned int *idum) {
  *idum = (1099087573 * (*idum));
  return *idum;
}


x86 assembly (clang, -O0):
<rt_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x4182bed5,(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_rand>:
imul   $0x4182bed5,(%rdi),%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @rt_rand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul i32 1099087573, %4
%6 = load i32*, i32** %2
store i32 %5, i32* %6
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @rt_rand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul i32 %2, 1099087573
store i32 %3, i32* %0
ret i32 %3
}
/* Variables and functions */
void *_memory_allocate(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *rpcalloc(size_t num, size_t size) {
  size_t total;
  void *ptr;
  total = num * size;
  ptr = _memory_allocate(total);
  memset(ptr, 0, total);
  return ptr;
}


x86 assembly (clang, -O0):
<rpcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <_memory_allocate@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <_memory_allocate@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @rpcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = mul i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = call i8* @_memory_allocate(i64 %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = load i64, i64* %5
%14 = call i32 @memset(i8* %12, i32 0, i64 %13)
%15 = load i8*, i8** %6
ret i8* %15
}

LLVM IR (-O2):
define i8* @rpcalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @_memory_allocate(i64 %3)
%5 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void fatal(const char *description) {
  fprintf(stderr, "%s: %s: %s\n", "ft_strace", description, strerror(errno));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rcx
mov    %rax,%r8
lea    0xe91(%rip),%rsi
lea    0xe96(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeac(%rip),%rsi
lea    0xeb1(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rcx
mov    %rax,%r8
call   1030 <fprintf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s: %s: %s\0A\00"
@.str.1 = [10 x i8] c"ft_strace\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s: %s: %s\0A\00"
@.str.1 = [10 x i8] c"ft_strace\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
}
void op0xE3(void) {}


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

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

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

LLVM IR (-O2):
define void @op0xE3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hi");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"hi\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef long off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
long lseek(int, long, int /*<<< orphan*/);
off_t _fsize(int fd) {
  off_t prev, sz;
  prev = lseek(fd, 0L, SEEK_CUR);
  sz = lseek(fd, 0L, SEEK_END);
  lseek(fd, prev, SEEK_SET);
  return sz;
}


x86 assembly (clang, -O0):
<_fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fsize>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r14
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r15
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <lseek@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @_fsize(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @SEEK_CUR
%7 = call i64 @lseek(i32 %5, i64 0, i32 %6)
store i64 %7, i64* %3
%8 = load i32, i32* %2
%9 = load i32, i32* @SEEK_END
%10 = call i64 @lseek(i32 %8, i64 0, i32 %9)
store i64 %10, i64* %4
%11 = load i32, i32* %2
%12 = load i64, i64* %3
%13 = load i32, i32* @SEEK_SET
%14 = call i64 @lseek(i32 %11, i64 %12, i32 %13)
%15 = load i64, i64* %4
ret i64 %15
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @_fsize(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i64 @lseek(i32 %0, i64 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i64 @lseek(i32 %0, i64 0, i32 %4)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i64 @lseek(i32 %0, i64 %3, i32 %6)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ insert8(int);
int simple(int code, char *label, char *mnemo, char *oper) {
  if (code & 0xff00) {
    insert8(code >> 8);
  }
  insert8(code);
  if (oper) {
    error("no operands allowed");
  }
  return 0;
}


x86 assembly (clang, -O0):
<simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
je     1153 <simple+0x33>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
call   1030 <insert8@plt>
mov    -0x4(%rbp),%edi
call   1030 <insert8@plt>
cmpq   $0x0,-0x20(%rbp)
je     1172 <simple+0x52>
lea    0xe93(%rip),%rdi
call   1040 <error@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple>:
push   %rbp
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edi,%ebp
test   $0xff00,%edi
je     113a <simple+0x1a>
mov    %ebp,%edi
sar    $0x8,%edi
call   1030 <insert8@plt>
mov    %ebp,%edi
call   1030 <insert8@plt>
test   %rbx,%rbx
je     1152 <simple+0x32>
lea    0xeb3(%rip),%rdi
call   1040 <error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"no operands allowed\00"
define i32 @simple(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = and i32 %9, 65280
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32, i32* %5
%14 = ashr i32 %13, 8
%15 = call i32 @insert8(i32 %14)
br label %16
16: ; preds = %12, %4
%17 = load i32, i32* %5
%18 = call i32 @insert8(i32 %17)
%19 = load i8*, i8** %8
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"no operands allowed\00"
define i32 @simple(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* readnone %3) {
%5 = and i32 %0, 65280
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = ashr i32 %0, 8
%9 = tail call i32 @insert8(i32 %8)
br label %10
10: ; preds = %7, %4
%11 = tail call i32 @insert8(i32 %0)
%12 = icmp eq i8* %3, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
ret i32 0
}
int test_imm_35uint16_reg(unsigned short val) {
  return ((val) & (-0x35 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_35uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffcb,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_35uint16_reg>:
test   $0xffcb,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_35uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -53
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
adr0reg1(r0, r1, x0, x1, p0, p1) unsigned int r0, r1;
unsigned int *p0, *p1;
{
  if ((*((unsigned int *)10000000)) <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adr0reg1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    $0x989680,%eax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
ja     1134 <adr0reg1+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <adr0reg1+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0reg1>:
xor    %eax,%eax
cmp    %esi,0x989680
setbe  %al
ret

LLVM IR (-O0):
define i32 @adr0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* inttoptr (i64 10000000 to i32*)
%15 = load i32, i32* %9
%16 = icmp ule i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %6
store i32 1, i32* %7
br label %19
18: ; preds = %6
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @adr0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
%7 = load i32, i32* inttoptr (i64 10000000 to i32*)
%8 = icmp ule i32 %7, %1
%9 = zext i1 %8 to i32
ret i32 %9
}
char *chomp(char *s) {
  while (*s == ' ') {
    s++;
  }
  return s;
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1129 <chomp+0x29>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <chomp+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rax)
lea    0x1(%rax),%rax
je     1110 <chomp+0x10>
ret

LLVM IR (-O0):
define i8* @chomp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @chomp(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 32
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void current_vm() { exit(1); }


x86 assembly (clang, -O0):
<current_vm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<current_vm>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @current_vm() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int b) { assert(0); }


x86 assembly (clang, -O0):
<pthread_rwlockattr_setpshared>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_rwlockattr_setpshared>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define i32 @pthread_rwlockattr_setpshared(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @assert(i32 0)
ret i32 undef
}
double obd_convert_10(int a, int b) { return (double)((a * 256) + b) / 100.0f; }


x86 assembly (clang, -O0):
<obd_convert_10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
add    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xee1(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obd_convert_10>:
shl    $0x8,%edi
add    %esi,%edi
cvtsi2sd %edi,%xmm0
divsd  0xeef(%rip),%xmm0
ret

LLVM IR (-O0):
define double @obd_convert_10(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, 256
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+02
ret double %10
}

LLVM IR (-O2):
define double @obd_convert_10(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 8
%4 = add nsw i32 %3, %1
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 1.000000e+02
ret double %6
}
/* Type definitions */
struct sembuf {
  int sem_op;
  int /*<<< orphan*/ sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int /*<<< orphan*/ SEM_UNDO;
int semop(int, struct sembuf *, int);
int semaphore_wait(int semid) {
  struct sembuf sem_b;
  sem_b.sem_num = 0;
  sem_b.sem_op = -1;
  sem_b.sem_flg = SEM_UNDO;
  return semop(semid, &sem_b, 1);
}


x86 assembly (clang, -O0):
<semaphore_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semaphore_wait>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
mov    0x2ec4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i64 }
@SEM_UNDO = global i32 0
define i32 @semaphore_wait(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sembuf
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 2
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 0
store i32 -1, i32* %5
%6 = load i32, i32* @SEM_UNDO
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 1
store i32 %6, i32* %7
%8 = load i32, i32* %2
%9 = call i32 @semop(i32 %8, %struct.sembuf* %3, i32 1)
ret i32 %9
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i32, i64 }
@SEM_UNDO = global i32 0
define i32 @semaphore_wait(i32 %0) {
%2 = alloca %struct.sembuf
%3 = bitcast %struct.sembuf* %2 to i8*
%4 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 2
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 0
store i32 -1, i32* %5
%6 = load i32, i32* @SEM_UNDO
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 1
store i32 %6, i32* %7
%8 = call i32 @semop(i32 %0, %struct.sembuf* %2, i32 1)
ret i32 %8
}
void good_vararg(const int *p) {
  __builtin_prefetch(p, 0, 3);
  __builtin_prefetch(p, 0);
  __builtin_prefetch(p, 1);
  __builtin_prefetch(p);
}


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

x86 assembly (clang, -O2):
<good_vararg>:
prefetcht0 (%rdi)
prefetcht0 (%rdi)
prefetcht0 (%rdi)
prefetcht0 (%rdi)
ret

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

LLVM IR (-O2):
define void @good_vararg(i32* nocapture %0) {
%2 = bitcast i32* %0 to i8*
tail call void @llvm.prefetch.p0i8(i8* %2, i32 0, i32 3, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %2, i32 0, i32 3, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %2, i32 1, i32 3, i32 1)
tail call void @llvm.prefetch.p0i8(i8* %2, i32 0, i32 3, i32 1)
ret void
}
void pay_amount(int dollars, int *twenties, int *tens, int *fives, int *ones) {
  *twenties = dollars / 20;
  dollars = dollars % 20;
  *tens = dollars / 10;
  dollars = dollars % 10;
  *fives = dollars / 5;
  *ones = dollars % 5;
}


x86 assembly (clang, -O0):
<pay_amount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pay_amount>:
movslq %edi,%r9
imul   $0x66666667,%r9,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x23,%rdi
add    %eax,%edi
mov    %edi,(%rsi)
shl    $0x2,%edi
lea    (%rdi,%rdi,4),%eax
sub    %eax,%r9d
movsbl %r9b,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
movswl %ax,%esi
shr    $0xf,%eax
shr    $0xa,%esi
add    %al,%sil
movsbl %sil,%eax
mov    %eax,(%rdx)
movzbl %al,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%r9b
movsbl %r9b,%eax
imul   $0x67,%eax,%edx
movzwl %dx,%esi
shr    $0x9,%edx
shr    $0xf,%esi
add    %dl,%sil
movsbl %sil,%edx
mov    %edx,(%rcx)
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%eax
mov    %eax,(%r8)
ret

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

LLVM IR (-O2):
define void @pay_amount(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = sdiv i32 %0, 20
store i32 %6, i32* %1
%7 = srem i32 %0, 20
%8 = trunc i32 %7 to i8
%9 = sdiv i8 %8, 10
%10 = sext i8 %9 to i32
store i32 %10, i32* %2
%11 = srem i8 %8, 10
%12 = sdiv i8 %11, 5
%13 = sext i8 %12 to i32
store i32 %13, i32* %3
%14 = srem i8 %11, 5
%15 = sext i8 %14 to i32
store i32 %15, i32* %4
ret void
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
void sigint_function(int signum) {
  assert(signum == SIGINT);
  printf("SIGINT\n");
}


x86 assembly (clang, -O0):
<sigint_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigint_function>:
push   %rax
mov    0x2ec0(%rip),%rcx
xor    %eax,%eax
cmp    %edi,(%rcx)
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
lea    0xec3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [8 x i8] c"SIGINT\0A\00"
define void @sigint_function(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@str = [7 x i8] c"SIGINT\00"
define void @sigint_function(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
void av_guess_sample_aspect_ratio() {}


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

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

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

LLVM IR (-O2):
define void @av_guess_sample_aspect_ratio() {
ret void
}
/* Variables and functions */
int isBlank(const char *ccp_input, const size_t i_offset) {
  return ((ccp_input[i_offset] == ' ' || ccp_input[i_offset] == '\t') ? 0 : -1);
}


x86 assembly (clang, -O0):
<isBlank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     113b <isBlank+0x3b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
mov    $0xffffffff,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBlank>:
mov    (%rdi,%rsi,1),%al
cmp    $0x20,%al
setne  %cl
cmp    $0x9,%al
setne  %al
and    %cl,%al
movzbl %al,%eax
neg    %eax
ret

LLVM IR (-O0):
define i32 @isBlank(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 = load i64, i64* %4
%7 = getelementptr inbounds i8, i8* %5, i64 %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 32
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 9
br label %18
18: ; preds = %11, %2
%19 = phi i1 [ true, %2 ], [ %17, %11 ]
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 0, i32 -1
ret i32 %21
}

LLVM IR (-O2):
define i32 @isBlank(i8* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 32
%6 = icmp ne i8 %4, 9
%7 = and i1 %5, %6
%8 = sext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *str_dup(char *string) {
  char *ctmp;
  ctmp = (char *)malloc(sizeof(char) * (strlen(string) + 1));
  if (!ctmp) {
    printf("out of memory\n");
    exit(-1);
  }
  strcpy(ctmp, string);
  return ctmp;
}


x86 assembly (clang, -O0):
<str_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119a <str_dup+0x4a>
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     1182 <str_dup+0x32>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @str_dup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 1, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %17, label %14
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %1
%18 = load i8*, i8** %3
%19 = load i8*, i8** %2
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@str = [14 x i8] c"out of memory\00"
define i8* @str_dup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %1
%11 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
void foo511() {}


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

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

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

LLVM IR (-O2):
define void @foo511() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint32_t;

/* Variables and functions */
uint32_t read_u32(const uint8_t *buffer) {
  return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) |
         (buffer[3] << 0);
}


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

x86 assembly (clang, -O2):
<read_u32>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     %ecx,%eax
or     0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read_u32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = or i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 3
%19 = load i32, i32* %18
%20 = shl i32 %19, 0
%21 = or i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @read_u32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = or i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ objfcn_(int *, double *, double *, int *);
double mgh_objfcn(int n, const double *x, int nprob) {
  double _f;
  int _n = n, _nprob = nprob;
  assert(sizeof(double) == sizeof(*x));
  objfcn_(&_n, (double *)x, &_f, &_nprob);
  return (double)_f;
}


x86 assembly (clang, -O0):
<mgh_objfcn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rsi
lea    -0x24(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <objfcn_@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgh_objfcn>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,0x4(%rsp)
mov    %edx,(%rsp)
mov    $0x1,%edi
call   1040 <assert@plt>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rsi
call   1030 <objfcn_@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @mgh_objfcn(i32 %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
store i32 %10, i32* %8
%11 = load i32, i32* %6
store i32 %11, i32* %9
%12 = call i32 @assert(i32 1)
%13 = load double*, double** %5
%14 = call i32 @objfcn_(i32* %8, double* %13, double* %7, i32* %9)
%15 = load double, double* %7
ret double %15
}

LLVM IR (-O2):
define double @mgh_objfcn(i32 %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = bitcast double* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 %0, i32* %5
%9 = bitcast i32* %6 to i8*
store i32 %2, i32* %6
%10 = tail call i32 @assert(i32 1)
%11 = call i32 @objfcn_(i32* %5, double* %1, double* %4, i32* %6)
%12 = load double, double* %4
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void setPurpleBlink(int sockfd, int timeOn, int period) {
  printf("Currently unavailable, because it's glitchy.\n");
}


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"Currently unavailable, because it's glitchy.\0A\00"
define void @setPurpleBlink(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [45 x i8] c"Currently unavailable, because it's glitchy.\00"
define void @setPurpleBlink(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret void
}
void example_4(int A, int B) {
  int S0 = 0;
  int S1 = 0;
  if (A == B) {
    S0 = S0;
  }
  if (A == B) {
    S1 = S1;
  }
}


x86 assembly (clang, -O0):
<example_4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    112a <example_4+0x2a>
mov    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    113c <example_4+0x3c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @example_4(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ destruct(int /*<<< orphan*/);
int /*<<< orphan*/ this_object();
int clean_up(int inh) {
  destruct(this_object());
  return 0;
}


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

x86 assembly (clang, -O2):
<clean_up>:
push   %rax
xor    %eax,%eax
call   1030 <this_object@plt>
mov    %eax,%edi
call   1040 <destruct@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @clean_up(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @this_object()
%4 = call i32 @destruct(i32 %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @clean_up(i32 %0) {
%2 = tail call i32 (...) @this_object()
%3 = tail call i32 @destruct(i32 %2)
ret i32 0
}
void setup_i18n(void) {}


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

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

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

LLVM IR (-O2):
define void @setup_i18n() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MSG_PEEK;
int fh_tcp_readex(int, void *, int, int /*<<< orphan*/);
int fh_tcp_peek(int s, void *buf, int nbytes) {
  return fh_tcp_readex(s, buf, nbytes, MSG_PEEK);
}


x86 assembly (clang, -O0):
<fh_tcp_peek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
call   1030 <fh_tcp_readex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fh_tcp_peek>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <fh_tcp_readex@plt>

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

LLVM IR (-O2):
@MSG_PEEK = global i32 0
define i32 @fh_tcp_peek(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @MSG_PEEK
%5 = tail call i32 @fh_tcp_readex(i32 %0, i8* %1, i32 %2, i32 %4)
ret i32 %5
}