xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void pqueue_allocation_error() {
  fprintf(stderr, "Memory allocation failed.\n %s: %d\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/"
          "master/coloring/src/pqueue.c",
          19);
  exit(1);
}


x86 assembly (clang, -O0):
<pqueue_allocation_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xee8(%rip),%rdx
mov    $0x13,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<pqueue_allocation_error>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xeeb(%rip),%rdx
mov    $0x13,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Memory allocation failed.\0A %s: %d\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/master/coloring/src/pqueue.c\00"
define void @pqueue_allocation_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 19)
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Memory allocation failed.\0A %s: %d\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/master/coloring/src/pqueue.c\00"
define void @pqueue_allocation_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 19)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void gtk_plug_new() {}


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

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

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

LLVM IR (-O2):
define void @gtk_plug_new() {
ret void
}
/* Variables and functions */
int machdep_sys_wait4(int /*<<< orphan*/, int *, int, int *);
int machdep_sys_wait3(int *b, int c, int *d) {
  return (machdep_sys_wait4(0, b, c, d));
}


x86 assembly (clang, -O0):
<machdep_sys_wait3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
call   1030 <machdep_sys_wait4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machdep_sys_wait3>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <machdep_sys_wait4@plt>

LLVM IR (-O0):
define i32 @machdep_sys_wait3(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 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @machdep_sys_wait4(i32 0, i32* %7, i32 %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @machdep_sys_wait3(i32* %0, i32 %1, i32* %2) {
%4 = tail call i32 @machdep_sys_wait4(i32 0, i32* %0, i32 %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void memerr(void *p) {
  if (p == NULL) {
    puts("ERROR: Unable to allocate memory.");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<memerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114d <memerr+0x2d>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memerr>:
test   %rdi,%rdi
je     1126 <memerr+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"ERROR: Unable to allocate memory.\00"
define void @memerr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"ERROR: Unable to allocate memory.\00"
define void @memerr(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 -1)
unreachable
6: ; preds = %1
ret void
}
unsigned char swapnybbles(unsigned char n) {
  unsigned char highnybble = n >> 4;
  unsigned char lownybble = n & 0xf;
  return (lownybble << 4) | highnybble;
}


x86 assembly (clang, -O0):
<swapnybbles>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
shl    $0x4,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapnybbles>:
mov    %edi,%eax
rol    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @swapnybbles(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = ashr i32 %6, 4
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = and i32 %10, 15
%12 = trunc i32 %11 to i8
store i8 %12, i8* %4
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 4
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @swapnybbles(i8 zeroext %0) {
%2 = tail call i8 @llvm.fshl.i8(i8 %0, i8 %0, i8 4)
ret i8 %2
}
/* Variables and functions */
void *Memory__I7_alloc(int, int, int);
void *Memory__I7_malloc(int size_in_bytes, int reason) {
  return Memory__I7_alloc(-1, size_in_bytes, reason);
}


x86 assembly (clang, -O0):
<Memory__I7_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0xffffffff,%edi
call   1030 <Memory__I7_alloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Memory__I7_malloc>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0xffffffff,%edi
jmp    1030 <Memory__I7_alloc@plt>

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

LLVM IR (-O2):
define i8* @Memory__I7_malloc(i32 %0, i32 %1) {
%3 = tail call i8* @Memory__I7_alloc(i32 -1, i32 %0, i32 %1)
ret i8* %3
}
int test_imm_41int64_lowword_mem(long long *val) {
  return ((*val) & (0x41 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_41int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 65
%6 = icmp ne i64 %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_41int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 65
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
__attribute__((always_)) int __atomic_dec(volatile int *ptr) {
  return __sync_fetch_and_sub(ptr, 1);
}


x86 assembly (clang, -O0):
<__atomic_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0xffffffff,%eax
lock xadd %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_dec>:
mov    $0xffffffff,%eax
lock xadd %eax,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @__atomic_dec(i32* nocapture %0) {
%2 = atomicrmw sub i32* %0, i32 1 seq_cst
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ readmemw65816(int /*<<< orphan*/);
int /*<<< orphan*/ sbc16(int /*<<< orphan*/);
int /*<<< orphan*/ zeropagex();
void sbcZpx16(void) { sbc16(readmemw65816(zeropagex())); }


x86 assembly (clang, -O0):
<sbcZpx16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <zeropagex@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
call   1050 <sbc16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbcZpx16>:
push   %rax
xor    %eax,%eax
call   1040 <zeropagex@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <sbc16@plt>

LLVM IR (-O0):
define void @sbcZpx16() {
%1 = call i32 (...) @zeropagex()
%2 = call i32 @readmemw65816(i32 %1)
%3 = call i32 @sbc16(i32 %2)
ret void
}

LLVM IR (-O2):
define void @sbcZpx16() {
%1 = tail call i32 (...) @zeropagex()
%2 = tail call i32 @readmemw65816(i32 %1)
%3 = tail call i32 @sbc16(i32 %2)
ret void
}
/* Variables and functions */
int getch(int);
int skip1_blanks(int ch) {
  do {
    ch = getch(ch);
  } while (ch == ' ' || ch == '\t');
  return ch;
}


x86 assembly (clang, -O0):
<skip1_blanks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getch@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113f <skip1_blanks+0x2f>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    111b <skip1_blanks+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip1_blanks>:
push   %rax
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <getch@plt>
cmp    $0x9,%eax
je     1120 <skip1_blanks+0x10>
cmp    $0x20,%eax
je     1120 <skip1_blanks+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @skip1_blanks(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %12, %1
%4 = load i32, i32* %2
%5 = call i32 @getch(i32 %4)
store i32 %5, i32* %2
br label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 32
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 9
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %3, label %14
14: ; preds = %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @skip1_blanks(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i32 [ %0, %1 ], [ %4, %5 ]
%4 = tail call i32 @getch(i32 %3)
switch i32 %4, label %6 [
i32 32, label %5
i32 9, label %5
]
5: ; preds = %2, %2
br label %2
6: ; preds = %2
ret i32 %4
}
/* Variables and functions */
scalar_t__ isprint(int);
char prop(int o) { return isprint(o) ? o : ' '; }


x86 assembly (clang, -O0):
<prop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
je     1138 <prop+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <prop+0x35>
mov    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <prop+0x35>
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prop>:
push   %rbx
mov    %edi,%ebx
call   1030 <isprint@plt>
test   %rax,%rax
mov    $0x20,%eax
cmovne %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @prop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isprint(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i32 [ %7, %6 ], [ 32, %8 ]
%11 = trunc i32 %10 to i8
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @prop(i32 %0) {
%2 = tail call i64 @isprint(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = trunc i32 %0 to i8
%5 = select i1 %3, i8 32, i8 %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int main() {
  char buffer[8];
  gets(buffer);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *);
int write_bool(char *out, int in, size_t n) {
  snprintf(out, n, "%s", in ? "true" : "false");
  return 0;
}


x86 assembly (clang, -O0):
<write_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rcx
lea    0xec7(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xeb6(%rip),%rdx
call   1030 <snprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_bool>:
push   %rax
test   %esi,%esi
lea    0xeee(%rip),%rax
lea    0xee2(%rip),%rcx
cmove  %rax,%rcx
lea    0xed4(%rip),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <snprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @write_bool(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %6
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%13 = call i32 @snprintf(i8* %7, i64 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @write_bool(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @snprintf(i8* %0, i64 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
unsigned string_hash(char *s, int hash_size) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = (int)((unsigned char)*s) + 31 * hashval;
  return hashval % hash_size;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <string_hash+0x43>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
imul   $0x1f,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1112 <string_hash+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <string_hash+0x29>
add    $0x1,%rdi
xor    %edx,%edx
mov    %edx,%eax
xchg   %ax,%ax
movzbl %cl,%ecx
shl    $0x5,%eax
sub    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1110 <string_hash+0x10>
jmp    112b <string_hash+0x2b>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @string_hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = zext i8 %6 to i32
%10 = mul i32 %7, 31
%11 = add i32 %10, %9
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
int main() {
  short a = L'a';
  short b = L'b';
  return b - a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x61,-0x6(%rbp)
movw   $0x62,-0x8(%rbp)
movswl -0x8(%rbp),%eax
movswl -0x6(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
store i32 0, i32* %1
store i16 97, i16* %2
store i16 98, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = sub nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
unsigned int RTP_get_seq_num(unsigned char *p) {
  return (((unsigned int)p[2]) << 8) + (unsigned int)p[3];
}


x86 assembly (clang, -O0):
<RTP_get_seq_num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTP_get_seq_num>:
movzwl 0x2(%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @RTP_get_seq_num(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 3
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = add i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @RTP_get_seq_num(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw nsw i32 %4, 8
%6 = getelementptr inbounds i8, i8* %0, i64 3
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = or i32 %5, %8
ret i32 %9
}
/* Variables and functions */
float powf(float, float);
float __ocl_pow_float(float src1, float src2) { return powf(src1, src2); }


x86 assembly (clang, -O0):
<__ocl_pow_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <powf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_pow_float>:
jmp    1030 <powf@plt>

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

LLVM IR (-O2):
define float @__ocl_pow_float(float %0, float %1) {
%3 = tail call float @powf(float %0, float %1)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch) {
  free((void *)(m[nrl] + ncl - 1));
  free((void *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dmatrix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rax
lea    (%rax,%rcx,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
lea    (%rbx,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_dmatrix(double** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds double*, double** %0, i64 %1
%7 = load double*, double** %6
%8 = getelementptr inbounds double, double* %7, i64 %3
%9 = getelementptr inbounds double, double* %8, i64 -1
%10 = bitcast double* %9 to i8*
%11 = tail call i32 @free(i8* %10)
%12 = getelementptr inbounds double*, double** %6, i64 -1
%13 = bitcast double** %12 to i8*
%14 = tail call i32 @free(i8* %13)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
scalar_t__ fabs(float);
float stbir__filter_triangle(float x, float s) {
  (void)sizeof(s);
  x = (float)fabs(x);
  if (x <= 1.0f)
    return 1 - x;
  else
    return 0;
}


x86 assembly (clang, -O0):
<stbir__filter_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     115f <stbir__filter_triangle+0x4f>
movss  0xeb0(%rip),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1167 <stbir__filter_triangle+0x57>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbir__filter_triangle>:
push   %rax
call   1030 <fabs@plt>
cmp    $0x2,%rax
jl     1121 <stbir__filter_triangle+0x11>
xorps  %xmm0,%xmm0
pop    %rax
ret
cvtsi2ss %rax,%xmm1
movss  0xed2(%rip),%xmm0
subss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @stbir__filter_triangle(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = call i64 @fabs(float %6)
%8 = sitofp i64 %7 to float
store float %8, float* %4
%9 = load float, float* %4
%10 = fcmp ole float %9, 1.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load float, float* %4
%13 = fsub float 1.000000e+00, %12
store float %13, float* %3
br label %15
14: ; preds = %2
store float 0.000000e+00, float* %3
br label %15
15: ; preds = %14, %11
%16 = load float, float* %3
ret float %16
}

LLVM IR (-O2):
define float @stbir__filter_triangle(float %0, float %1) {
%3 = tail call i64 @fabs(float %0)
%4 = icmp slt i64 %3, 2
%5 = sitofp i64 %3 to float
%6 = fsub float 1.000000e+00, %5
%7 = select i1 %4, float %6, float 0.000000e+00
ret float %7
}
/* Type definitions */
struct vnic_wq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vnic_wq_init_start(struct vnic_wq *, unsigned int,
                                      int /*<<< orphan*/, int /*<<< orphan*/,
                                      unsigned int, unsigned int);
void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index,
                  unsigned int error_interrupt_enable,
                  unsigned int error_interrupt_offset) {
  vnic_wq_init_start(wq, cq_index, 0, 0, error_interrupt_enable,
                     error_interrupt_offset);
}


x86 assembly (clang, -O0):
<vnic_wq_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <vnic_wq_init_start@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vnic_wq_init>:
mov    %ecx,%r9d
mov    %edx,%r8d
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <vnic_wq_init_start@plt>

LLVM IR (-O0):
%struct.vnic_wq = type { i32 }
define void @vnic_wq_init(%struct.vnic_wq* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.vnic_wq*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.vnic_wq* %0, %struct.vnic_wq** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.vnic_wq*, %struct.vnic_wq** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @vnic_wq_init_start(%struct.vnic_wq* %9, i32 %10, i32 0, i32 0, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.vnic_wq = type { i32 }
define void @vnic_wq_init(%struct.vnic_wq* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @vnic_wq_init_start(%struct.vnic_wq* %0, i32 %1, i32 0, i32 0, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
scalar_t__ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int hello_world() {
  if (0 > fputs("hello world", stdout)) {
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<hello_world>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
lea    0xed8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1147 <hello_world+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <hello_world+0x3e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello_world>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
xor    %ecx,%ecx
test   %rax,%rax
setns  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
@stdout = global i32 0
define i32 @hello_world() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = call i64 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp sgt i64 0, %3
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %7
6: ; preds = %0
store i32 1, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@stdout = global i32 0
define i32 @hello_world() {
%1 = load i32, i32* @stdout
%2 = tail call i64 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i64 %2, 0
%4 = select i1 %3, i32 -1, i32 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f9();
void f8() { f9(); }


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

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

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

LLVM IR (-O2):
define void @f8() {
%1 = tail call i32 (...) @f9()
ret void
}
char *strchr(const char *s, int c) {
  const char *p = s;
  while (*p) {
    if (*p == c)
      return (char *)p;
    p++;
  }
  if (c == (int)((void *)0))
    return (char *)p;
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <strchr+0x4e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    113d <strchr+0x3d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <strchr+0x6d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1113 <strchr+0x13>
cmpl   $0x0,-0x14(%rbp)
jne    1165 <strchr+0x65>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <strchr+0x6d>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     112b <strchr+0x2b>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %ecx,%ecx
test   %esi,%esi
cmovne %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %18, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %10, %2
%15 = phi i8* [ %0, %2 ], [ %11, %10 ]
%16 = icmp eq i32 %1, 0
%17 = select i1 %16, i8* %15, i8* null
br label %18
18: ; preds = %5, %14
%19 = phi i8* [ %17, %14 ], [ %7, %5 ]
ret i8* %19
}
void libopenh264_init() {}


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

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

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

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

/* Variables and functions */
int __IUSAT(int, int);
__attribute__((always_)) uint32_t __UQADD16(uint32_t x, uint32_t y) {
  int32_t r = 0, s = 0;
  r = __IUSAT((((x << 16) >> 16) + ((y << 16) >> 16)), 16) & 0x0000FFFF;
  s = __IUSAT((((x) >> 16) + ((y) >> 16)), 16) & 0x0000FFFF;
  return ((s << 16) | (r));
}


x86 assembly (clang, -O0):
<__UQADD16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x10,%edi
sar    $0x10,%edi
mov    -0x8(%rbp),%eax
shl    $0x10,%eax
sar    $0x10,%eax
add    %eax,%edi
mov    $0x10,%esi
call   1030 <__IUSAT@plt>
and    $0xffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x10,%edi
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
add    %eax,%edi
mov    $0x10,%esi
call   1030 <__IUSAT@plt>
and    $0xffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x10,%eax
or     -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__UQADD16>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
movswl %bp,%eax
movswl %bx,%edi
add    %eax,%edi
mov    $0x10,%esi
call   1030 <__IUSAT@plt>
movzwl %ax,%r14d
sar    $0x10,%ebp
sar    $0x10,%ebx
add    %ebp,%ebx
mov    %ebx,%edi
mov    $0x10,%esi
call   1030 <__IUSAT@plt>
shl    $0x10,%eax
or     %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__UQADD16(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 = shl i32 %7, 16
%9 = ashr i32 %8, 16
%10 = load i32, i32* %4
%11 = shl i32 %10, 16
%12 = ashr i32 %11, 16
%13 = add nsw i32 %9, %12
%14 = call i32 @__IUSAT(i32 %13, i32 16)
%15 = and i32 %14, 65535
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = ashr i32 %16, 16
%18 = load i32, i32* %4
%19 = ashr i32 %18, 16
%20 = add nsw i32 %17, %19
%21 = call i32 @__IUSAT(i32 %20, i32 16)
%22 = and i32 %21, 65535
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = shl i32 %23, 16
%25 = load i32, i32* %5
%26 = or i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @__UQADD16(i32 %0, i32 %1) {
%3 = shl i32 %0, 16
%4 = ashr exact i32 %3, 16
%5 = shl i32 %1, 16
%6 = ashr exact i32 %5, 16
%7 = add nsw i32 %6, %4
%8 = tail call i32 @__IUSAT(i32 %7, i32 16)
%9 = and i32 %8, 65535
%10 = ashr i32 %0, 16
%11 = ashr i32 %1, 16
%12 = add nsw i32 %11, %10
%13 = tail call i32 @__IUSAT(i32 %12, i32 16)
%14 = shl i32 %13, 16
%15 = or i32 %14, %9
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
size_t strxfrm(char *s1, const char *s2, size_t n) {
  size_t temp = strlen(s2);
  if (temp > n)
    return (0);
  else {
    strcpy(s1, s2);
    return (temp);
  }
}


x86 assembly (clang, -O0):
<strxfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    115c <strxfrm+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    1171 <strxfrm+0x51>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfrm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
cmp    %r12,%rax
jbe    1142 <strxfrm+0x22>
xor    %ebx,%ebx
jmp    1150 <strxfrm+0x30>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @strxfrm(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ugt i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @strcpy(i8* %0, i8* %1)
br label %8
8: ; preds = %3, %6
%9 = phi i64 [ %4, %6 ], [ 0, %3 ]
ret i64 %9
}
int x_size_str(cp)
char *cp;
{
  int size = 0;
  while (*cp)
    size += x_size(*cp++);
  return size;
}


x86 assembly (clang, -O0):
<x_size_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1154 <x_size_str+0x44>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    $0x0,%al
call   1030 <x_size@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <x_size_str+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_size_str>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1149 <x_size_str+0x39>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
xor    %eax,%eax
call   1030 <x_size@plt>
add    %eax,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <x_size_str+0x20>
jmp    114b <x_size_str+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @x_size_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @x_size to i32 (i32, ...)*)(i32 %9)
%11 = add nsw i32 %10, %6
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
void *basic_memset(void *s, int c, size_t n) {
  size_t cnt = 0;
  unsigned char *schar = s;
  while (cnt < n) {
    *schar++ = (unsigned char)c;
    cnt++;
  }
  return s;
}


x86 assembly (clang, -O0):
<basic_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1154 <basic_memset+0x54>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111f <basic_memset+0x1f>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_memset>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1121 <basic_memset+0x11>
mov    %rbx,%rdi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @basic_memset(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %3
ret i8* %0
}
int ctoi(const char source) {
  if ((source >= '0') && (source <= '9'))
    return (source - '0');
  return (source - 'A' + 10);
}


x86 assembly (clang, -O0):
<ctoi>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <ctoi+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <ctoi+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <ctoi+0x40>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoi>:
lea    -0x30(%rdi),%ecx
lea    -0x37(%rdi),%edx
lea    -0x30(%rdi),%eax
cmp    $0xa,%cl
cmovae %edx,%eax
ret

LLVM IR (-O0):
define i32 @ctoi(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %20
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 65
%19 = add nsw i32 %18, 10
store i32 %19, i32* %2
br label %20
20: ; preds = %15, %11
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @ctoi(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = select i1 %4, i32 -48, i32 -55
%6 = add nsw i32 %5, %2
ret i32 %6
}
/* Variables and functions */
int in_byte(int);
int is_transmit_empty() { return in_byte((0x3F8 + 5)) & 0x20; }


x86 assembly (clang, -O0):
<is_transmit_empty>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fd,%edi
call   1030 <in_byte@plt>
and    $0x20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_transmit_empty>:
push   %rax
mov    $0x3fd,%edi
call   1030 <in_byte@plt>
and    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_transmit_empty() {
%1 = call i32 @in_byte(i32 1021)
%2 = and i32 %1, 32
ret i32 %2
}

LLVM IR (-O2):
define i32 @is_transmit_empty() {
%1 = tail call i32 @in_byte(i32 1021)
%2 = and i32 %1, 32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ handle_device_fd(int);
int open_uevent_socket();
int /*<<< orphan*/ printf(char *);
int main(void) {
  int fd = 0;
  fd = open_uevent_socket();
  if (fd < 0) {
    printf("error!\n");
    return -1;
  }
  handle_device_fd(fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <open_uevent_socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1172 <main+0x42>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117a <main+0x4a>
mov    -0x8(%rbp),%edi
call   1040 <handle_device_fd@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <open_uevent_socket@plt>
test   %eax,%eax
js     1147 <main+0x17>
mov    %eax,%edi
call   1040 <handle_device_fd@plt>
jmp    1158 <main+0x28>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"error!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @open_uevent_socket()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %11
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 @handle_device_fd(i32 %9)
br label %11
11: ; preds = %8, %6
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@str = [7 x i8] c"error!\00"
define i32 @main() {
%1 = tail call i32 (...) @open_uevent_socket()
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @handle_device_fd(i32 %1)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ -1, %3 ], [ 0, %5 ]
ret i32 %8
}
double foo() { return 42.0; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @foo() {
ret double 4.200000e+01
}

LLVM IR (-O2):
define double @foo() {
ret double 4.200000e+01
}
double Bbp1b(double x) {
  return 1.0 - x / 2.0 * (1.0 - x / 6.0 * (1.0 - x * x / 60.0));
}


x86 assembly (clang, -O0):
<Bbp1b>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xee9(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  -0x8(%rbp),%xmm3
movsd  0xecb(%rip),%xmm2
divsd  %xmm2,%xmm3
movsd  0xeb7(%rip),%xmm2
subsd  %xmm3,%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe90(%rip),%xmm2
addsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe69(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bbp1b>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  0xef0(%rip),%xmm1
movsd  0xef0(%rip),%xmm2
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm3
divsd  0xee8(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
mulsd  0xee0(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @Bbp1b(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 2.000000e+00
%5 = load double, double* %2
%6 = fdiv double %5, 6.000000e+00
%7 = load double, double* %2
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = fdiv double %9, 6.000000e+01
%11 = fsub double 1.000000e+00, %10
%12 = fneg double %6
%13 = call double @llvm.fmuladd.f64(double %12, double %11, double 1.000000e+00)
%14 = fneg double %4
%15 = call double @llvm.fmuladd.f64(double %14, double %13, double 1.000000e+00)
ret double %15
}

LLVM IR (-O2):
define double @Bbp1b(double %0) {
%2 = fmul double %0, %0
%3 = fdiv double %2, 6.000000e+01
%4 = fsub double 1.000000e+00, %3
%5 = fdiv double %0, -6.000000e+00
%6 = tail call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
%7 = fmul double %0, -5.000000e-01
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double 1.000000e+00)
ret double %8
}