xunge/DecIR huggingface dataset:
void init_device(int mic_device_number) {
  int i;
  for (i = 0; i < mic_device_number; i++) {
#pragma offload_transfer target(mic : i)
  }
}


x86 assembly (clang, -O0):
<init_device>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112d <init_device+0x2d>
jmp    111f <init_device+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <init_device+0xe>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @init_device(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
br label %9
9: ; preds = %8
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @init_device(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
void usage(const char *program_name) {
  printf("Usage: %s [OPTION] HOSTNAME [PORT]\n", program_name);
  puts("\nOptions:\n"
       "  -m  --use-keymap     translate key presses using the X keymap "
       "table\n"
       "  -v  --verbose        write emitted events to stdout\n"
       "  -q  --quiet          suppress informative messages\n"
       "  -h  --help           show this help text and exit");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Usage: %s [OPTION] HOSTNAME [PORT]\0A\00"
@.str.1 = [239 x i8] c"\0AOptions:\0A -m --use-keymap translate key presses using the X keymap table\0A -v --verbose write emitted events to stdout\0A -q --quiet suppress informative messages\0A -h --help show this help text and exit\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Usage: %s [OPTION] HOSTNAME [PORT]\0A\00"
@.str.1 = [239 x i8] c"\0AOptions:\0A -m --use-keymap translate key presses using the X keymap table\0A -v --verbose write emitted events to stdout\0A -q --quiet suppress informative messages\0A -h --help show this help text and exit\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([239 x i8], [239 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t dc_armor_radix64_size(size_t octets) {
  size_t ret = octets;
  if (octets % 3)
    ret += 3 - (octets % 3);
  ret /= 3;
  ret *= 4;
  return ret;
}


x86 assembly (clang, -O0):
<dc_armor_radix64_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     1146 <dc_armor_radix64_size+0x46>
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    $0x3,%eax
sub    %rdx,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dc_armor_radix64_size>:
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mov    %rdi,%rax
mul    %rcx
shr    %rdx
lea    (%rdx,%rdx,2),%rax
mov    %rdi,%rdx
sub    %rax,%rdx
mov    %rdx,%rax
xor    $0x3,%rax
test   %rdx,%rdx
cmove  %rdx,%rax
add    %rdi,%rax
mul    %rcx
lea    (%rdx,%rdx,1),%rax
and    $0xfffffffffffffffc,%rax
ret

LLVM IR (-O0):
define i64 @dc_armor_radix64_size(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %2
%6 = urem i64 %5, 3
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i64, i64* %2
%10 = urem i64 %9, 3
%11 = sub i64 3, %10
%12 = load i64, i64* %3
%13 = add i64 %12, %11
store i64 %13, i64* %3
br label %14
14: ; preds = %8, %1
%15 = load i64, i64* %3
%16 = udiv i64 %15, 3
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = mul i64 %17, 4
store i64 %18, i64* %3
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @dc_armor_radix64_size(i64 %0) {
%2 = urem i64 %0, 3
%3 = icmp eq i64 %2, 0
%4 = xor i64 %2, 3
%5 = select i1 %3, i64 0, i64 %4
%6 = add i64 %5, %0
%7 = udiv i64 %6, 3
%8 = shl i64 %7, 2
ret i64 %8
}
int type_cast_ch2i(char *src, int src_len) {
  int len;
  len = ((src_len) < (4)) ? (src_len) : (4);
  src[len] = '\0';
  return *(int *)src;
}


x86 assembly (clang, -O0):
<type_cast_ch2i>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1120 <type_cast_ch2i+0x20>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    112d <type_cast_ch2i+0x2d>
mov    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <type_cast_ch2i+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_cast_ch2i>:
cmp    $0x4,%esi
mov    $0x4,%eax
cmovl  %esi,%eax
cltq
movb   $0x0,(%rdi,%rax,1)
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @type_cast_ch2i(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 4
%4 = select i1 %3, i32 %1, i32 4
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
%7 = bitcast i8* %0 to i32*
%8 = load i32, i32* %7
ret i32 %8
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void _cdb_timerreset(struct timespec *ts) {
  clock_gettime(CLOCK_MONOTONIC, ts);
}


x86 assembly (clang, -O0):
<_cdb_timerreset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cdb_timerreset>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define void @_cdb_timerreset(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define void @_cdb_timerreset(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void purge_string(FILE *source_file) {
  int c = fgetc(source_file);
  while ((EOF != c) && (34 != c)) {
    c = fgetc(source_file);
  }
}


x86 assembly (clang, -O0):
<purge_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0xd(%rbp)
je     114d <purge_string+0x3d>
mov    $0x22,%eax
cmp    -0xc(%rbp),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115d <purge_string+0x4d>
jmp    116e <purge_string+0x5e>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
jmp    1128 <purge_string+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<purge_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fgetc@plt>
cmp    $0x22,%eax
je     1142 <purge_string+0x32>
mov    0x2ec0(%rip),%r14
nopl   0x0(%rax,%rax,1)
cmp    %eax,(%r14)
je     1142 <purge_string+0x32>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0x22,%eax
jne    1130 <purge_string+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @purge_string(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
store i32 %5, i32* %3
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* @EOF
%8 = load i32, i32* %3
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp ne i32 34, %11
br label %13
13: ; preds = %10, %6
%14 = phi i1 [ false, %6 ], [ %12, %10 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i32*, i32** %2
%17 = call i32 @fgetc(i32* %16)
store i32 %17, i32* %3
br label %6
18: ; preds = %13
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @purge_string(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %3, %2
%5 = icmp ne i32 %2, 34
%6 = and i1 %5, %4
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = tail call i32 @fgetc(i32* %0)
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %9, %8
%11 = icmp ne i32 %8, 34
%12 = and i1 %11, %10
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glFlush();
void qglFlush(void) { glFlush(); }


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

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

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

LLVM IR (-O2):
define void @qglFlush() {
%1 = tail call i32 (...) @glFlush()
ret void
}
double MULTIPLY_VOLUME(const int v) { return ((double)v + 0.3) / (20 + 0.3); }


x86 assembly (clang, -O0):
<MULTIPLY_VOLUME>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xef4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xee0(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MULTIPLY_VOLUME>:
cvtsi2sd %edi,%xmm0
addsd  0xef4(%rip),%xmm0
divsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @MULTIPLY_VOLUME(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 3.000000e-01
%6 = fdiv double %5, 2.030000e+01
ret double %6
}

LLVM IR (-O2):
define double @MULTIPLY_VOLUME(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fadd double %2, 3.000000e-01
%4 = fdiv double %3, 2.030000e+01
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ emit(char const *, char *, int, int);
void emit_unspec(const char *name, int level, int optname) {
  emit(name, "Net.UNSPEC", level, optname);
}


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

x86 assembly (clang, -O2):
<emit_unspec>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <emit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Net.UNSPEC\00"
define void @emit_unspec(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @emit(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Net.UNSPEC\00"
define void @emit_unspec(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @emit(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned long, unsigned long,
                           unsigned long, unsigned long);
int strlen(char *);
char *format_inet_addr(char *dest, unsigned long addr) {
  sprintf(dest, "%lu.%lu.%lu.%lu", (addr & 0xFF000000) >> 24,
          (addr & 0x00FF0000) >> 16, (addr & 0x0000FF00) >> 8,
          (addr & 0x000000FF));
  return (dest + strlen(dest));
}


x86 assembly (clang, -O0):
<format_inet_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movabs $0xff000000,%rdx
and    -0x10(%rbp),%rdx
shr    $0x18,%rdx
mov    -0x10(%rbp),%rcx
and    $0xff0000,%rcx
shr    $0x10,%rcx
mov    -0x10(%rbp),%r8
and    $0xff00,%r8
shr    $0x8,%r8
mov    -0x10(%rbp),%r9
and    $0xff,%r9
lea    0xe8a(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_inet_addr>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %edx,%eax
movzbl %dh,%ebp
movzbl %dl,%r9d
shr    $0x18,%edx
shr    $0x10,%eax
movzbl %al,%ecx
lea    0xebe(%rip),%rsi
mov    %rbp,%r8
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%lu.%lu.%lu.%lu\00"
define i8* @format_inet_addr(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 = and i64 %6, 4278190080
%8 = lshr i64 %7, 24
%9 = load i64, i64* %4
%10 = and i64 %9, 16711680
%11 = lshr i64 %10, 16
%12 = load i64, i64* %4
%13 = and i64 %12, 65280
%14 = lshr i64 %13, 8
%15 = load i64, i64* %4
%16 = and i64 %15, 255
%17 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %11, i64 %14, i64 %16)
%18 = load i8*, i8** %3
%19 = load i8*, i8** %3
%20 = call i32 @strlen(i8* %19)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
ret i8* %22
}

LLVM IR (-O2):
@.str = [16 x i8] c"%lu.%lu.%lu.%lu\00"
define i8* @format_inet_addr(i8* %0, i64 %1) {
%3 = lshr i64 %1, 24
%4 = and i64 %3, 255
%5 = lshr i64 %1, 16
%6 = and i64 %5, 255
%7 = lshr i64 %1, 8
%8 = and i64 %7, 255
%9 = and i64 %1, 255
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %6, i64 %8, i64 %9)
%11 = tail call i32 @strlen(i8* %0)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ nthword(char *, int);
int main() {
  char *test = "select * from mytable where city = \"Auckland\" ;";
  nthword(test, 1);
  nthword(test, 2);
  nthword(test, 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <nthword@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <nthword@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <nthword@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"select * from mytable where city = \22Auckland\22 ;\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @nthword(i8* %3, i32 1)
%5 = load i8*, i8** %2
%6 = call i32 @nthword(i8* %5, i32 2)
%7 = load i8*, i8** %2
%8 = call i32 @nthword(i8* %7, i32 3)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"select * from mytable where city = \22Auckland\22 ;\00"
define i32 @main() {
%1 = tail call i32 @nthword(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @nthword(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 @nthword(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
void nand_bch_free(struct nand_bch_control *nbc) {}


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

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

LLVM IR (-O0):
%struct.nand_bch_control = type opaque
define void @nand_bch_free(%struct.nand_bch_control* %0) {
%2 = alloca %struct.nand_bch_control*
store %struct.nand_bch_control* %0, %struct.nand_bch_control** %2
ret void
}

LLVM IR (-O2):
%struct.nand_bch_control = type opaque
define void @nand_bch_free(%struct.nand_bch_control* nocapture %0) {
ret void
}
void hp1(volatile unsigned int *i) {
  for (;;)
    (*i)++;
}


x86 assembly (clang, -O0):
<hp1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
mov    %ecx,(%rax)
jmp    1108 <hp1+0x8>

x86 assembly (clang, -O2):
<hp1>:
addl   $0x1,(%rdi)
jmp    1100 <hp1>

LLVM IR (-O0):
define void @hp1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
br label %3
3: ; preds = %3, %1
%4 = load i32*, i32** %2
%5 = load volatile i32, i32* %4
%6 = add i32 %5, 1
store volatile i32 %6, i32* %4
br label %3
}

LLVM IR (-O2):
define void @hp1(i32* %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* %0
%4 = add i32 %3, 1
store volatile i32 %4, i32* %0
br label %2
}
unsigned inl(unsigned short port) {
  unsigned val;
  asm volatile("inl %1, %0" : "=a"(val) : "Nd"(port));
  return val;
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i32 @inl(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl $1, $0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @inl(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl $1, $0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i32 %2
}
/* Variables and functions */
double gsl_sf_zeta(double);
double pow(long, double);
double pdf_Zeta(double s, long x) { return pow(x, -s) / gsl_sf_zeta(s); }


x86 assembly (clang, -O0):
<pdf_Zeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <gsl_sf_zeta@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdf_Zeta>:
sub    $0x28,%rsp
movaps %xmm0,%xmm1
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
xorps  %xmm1,%xmm0
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1040 <gsl_sf_zeta@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @pdf_Zeta(double %0, i64 %1) {
%3 = alloca double
%4 = alloca i64
store double %0, double* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load double, double* %3
%7 = fneg double %6
%8 = call double @pow(i64 %5, double %7)
%9 = load double, double* %3
%10 = call double @gsl_sf_zeta(double %9)
%11 = fdiv double %8, %10
ret double %11
}

LLVM IR (-O2):
define double @pdf_Zeta(double %0, i64 %1) {
%3 = fneg double %0
%4 = tail call double @pow(i64 %1, double %3)
%5 = tail call double @gsl_sf_zeta(double %0)
%6 = fdiv double %4, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ putword(int);
void twobyte(int co) { putword(co); }


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

x86 assembly (clang, -O2):
<twobyte>:
jmp    1030 <putword@plt>

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

LLVM IR (-O2):
define void @twobyte(i32 %0) {
%2 = tail call i32 @putword(i32 %0)
ret void
}
int map_getrowvert(int vert) { return vert / 6; }


x86 assembly (clang, -O0):
<map_getrowvert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_getrowvert>:
movslq %edi,%rax
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @map_getrowvert(i32 %0) {
%2 = sdiv i32 %0, 6
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
FILE *fopen(const char *filename, const char *mode) { int fd; }


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

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

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

LLVM IR (-O2):
define noalias i32* @fopen(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32* undef
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void AESIntEnable(uint32_t intFlags) {

  ;
  (*((volatile unsigned long *)(0x40024000 + 0x00000780))) = 0x00000001;
  (*((volatile unsigned long *)(0x40024000 + 0x00000784))) |= intFlags;
}


x86 assembly (clang, -O0):
<AESIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x40024780,%eax
movq   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x40024784,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x40024784,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<AESIntEnable>:
mov    %rdi,-0x8(%rsp)
movq   $0x1,0x40024780
mov    -0x8(%rsp),%rax
or     %rax,0x40024784
40
ret

LLVM IR (-O0):
define void @AESIntEnable(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
store volatile i64 1, i64* inttoptr (i64 1073891200 to i64*)
%3 = load volatile i64, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1073891204 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1073891204 to i64*)
ret void
}

LLVM IR (-O2):
define void @AESIntEnable(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
store volatile i64 1, i64* inttoptr (i64 1073891200 to i64*)
%3 = load volatile i64, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1073891204 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1073891204 to i64*)
ret void
}
/* Variables and functions */
scalar_t__ lw_sock_send_str(int *, char *);
scalar_t__ recv_ok(int *);
int lw_protocol_next(int *sock) {
  int result = 0;
  if (*sock >= 0 && lw_sock_send_str(sock, "NEXT")) {
    if (recv_ok(sock)) {
      result = 1;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<lw_protocol_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jl     1179 <lw_protocol_next+0x59>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <lw_sock_send_str@plt>
cmp    $0x0,%rax
je     1179 <lw_protocol_next+0x59>
mov    -0x8(%rbp),%rdi
call   1030 <recv_ok@plt>
cmp    $0x0,%rax
je     1174 <lw_protocol_next+0x54>
movl   $0x1,-0xc(%rbp)
jmp    1179 <lw_protocol_next+0x59>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw_protocol_next>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmpl   $0x0,(%rdi)
js     114f <lw_protocol_next+0x2f>
mov    %rdi,%rbx
lea    0xecc(%rip),%rsi
call   1040 <lw_sock_send_str@plt>
test   %rax,%rax
je     114f <lw_protocol_next+0x2f>
mov    %rbx,%rdi
call   1030 <recv_ok@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"NEXT\00"
define i32 @lw_protocol_next(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = call i64 @lw_sock_send_str(i32* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i32*, i32** %2
%13 = call i64 @recv_ok(i32* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %3
br label %16
16: ; preds = %15, %11
br label %17
17: ; preds = %16, %7, %1
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [5 x i8] c"NEXT\00"
define i32 @lw_protocol_next(i32* %0) {
%2 = load i32, i32* %0
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i64 @lw_sock_send_str(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i64 @recv_ok(i32* %0)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo() { printf("42"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"42\00"
define void @foo() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo1();
void foo2(void) { foo1(); }


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

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

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

LLVM IR (-O2):
define void @foo2() {
%1 = tail call i32 (...) @foo1()
ret void
}
/* Type definitions */
struct genlist_link {
  int dummy;
};
struct entry_list_link {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_link_prev(struct genlist_link const *);
struct entry_list_link *
entry_list_link_prev(const struct entry_list_link *plink) {
  return ((struct entry_list_link *)genlist_link_prev(
      (const struct genlist_link *)plink));
}


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

x86 assembly (clang, -O2):
<entry_list_link_prev>:
jmp    1030 <genlist_link_prev@plt>

LLVM IR (-O0):
%struct.entry_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %struct.entry_list_link* @entry_list_link_prev(%struct.entry_list_link* %0) {
%2 = alloca %struct.entry_list_link*
store %struct.entry_list_link* %0, %struct.entry_list_link** %2
%3 = load %struct.entry_list_link*, %struct.entry_list_link** %2
%4 = bitcast %struct.entry_list_link* %3 to %struct.genlist_link*
%5 = call i64 @genlist_link_prev(%struct.genlist_link* %4)
%6 = inttoptr i64 %5 to %struct.entry_list_link*
ret %struct.entry_list_link* %6
}

LLVM IR (-O2):
%struct.entry_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %struct.entry_list_link* @entry_list_link_prev(%struct.entry_list_link* %0) {
%2 = bitcast %struct.entry_list_link* %0 to %struct.genlist_link*
%3 = tail call i64 @genlist_link_prev(%struct.genlist_link* %2)
%4 = inttoptr i64 %3 to %struct.entry_list_link*
ret %struct.entry_list_link* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef size_t uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          size_t);
int __byte_encode_array(void *_buf, uint32_t offset, uint32_t maxlen,
                        const uint8_t *p, uint32_t elements) {
  if (maxlen < elements)
    return -1;
  uint8_t *buf = (uint8_t *)_buf;
  memcpy(&buf[offset], p, elements);
  return elements;
}


x86 assembly (clang, -O0):
<__byte_encode_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1146 <__byte_encode_array+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <__byte_encode_array+0x61>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__byte_encode_array>:
mov    $0xffffffff,%eax
cmp    %r8,%rdx
jb     1130 <__byte_encode_array+0x20>
push   %rbx
mov    %r8,%rbx
lea    (%rdi,%rsi,4),%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
call   1030 <memcpy@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @__byte_encode_array(i8* %0, i64 %1, i64 %2, i32* %3, i64 %4) {
%6 = icmp ult i64 %2, %4
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = bitcast i8* %0 to i32*
%9 = getelementptr inbounds i32, i32* %8, i64 %1
%10 = tail call i32 @memcpy(i32* %9, i32* %3, i64 %4)
%11 = trunc i64 %4 to i32
br label %12
12: ; preds = %5, %7
%13 = phi i32 [ %11, %7 ], [ -1, %5 ]
ret i32 %13
}
/* Variables and functions */
int CHAR_BIT;
void clear_bit(int nr, void *addr) {
  unsigned long mask = (1UL << ((nr) % (sizeof(long) * CHAR_BIT)));
  unsigned long *p =
      ((unsigned long *)addr) + ((nr) / (sizeof(long) * CHAR_BIT));
  *p &= ~mask;
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
mov    0x2eca(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x4(%rbp),%rax
mov    0x2e9c(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x20(%rbp),%rax
and    (%rax),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
movslq %edi,%rax
mov    0x2ed6(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1127 <clear_bit+0x27>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rcx
jmp    112f <clear_bit+0x2f>
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%ecx
mov    $0xfffffffffffffffe,%rdx
rol    %cl,%rdx
and    %rdx,(%rsi,%rax,8)
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define void @clear_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = load i32, i32* @CHAR_BIT
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = urem i64 %8, %11
%13 = shl i64 1, %12
store i64 %13, i64* %5
%14 = load i8*, i8** %4
%15 = bitcast i8* %14 to i64*
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = load i32, i32* @CHAR_BIT
%19 = sext i32 %18 to i64
%20 = mul i64 8, %19
%21 = udiv i64 %17, %20
%22 = getelementptr inbounds i64, i64* %15, i64 %21
store i64* %22, i64** %6
%23 = load i64, i64* %5
%24 = xor i64 %23, -1
%25 = load i64*, i64** %6
%26 = load i64, i64* %25
%27 = and i64 %26, %24
store i64 %27, i64* %25
ret void
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define void @clear_bit(i32 %0, i8* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = load i32, i32* @CHAR_BIT
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 3
%7 = urem i64 %3, %6
%8 = shl nuw i64 1, %7
%9 = bitcast i8* %1 to i64*
%10 = udiv i64 %3, %6
%11 = getelementptr inbounds i64, i64* %9, i64 %10
%12 = xor i64 %8, -1
%13 = load i64, i64* %11
%14 = and i64 %13, %12
store i64 %14, i64* %11
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int getpid();
int random();
int choose_delay() {
  pid_t pid = getpid();
  int i;
  for (i = 0; i < pid % 30; i++)
    random();
  return random() % 100;
}


x86 assembly (clang, -O0):
<choose_delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
cmp    %edx,%eax
jge    116a <choose_delay+0x4a>
mov    $0x0,%al
call   1040 <random@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <choose_delay+0x19>
mov    $0x0,%al
call   1040 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choose_delay>:
push   %rbx
xor    %eax,%eax
call   1030 <getpid@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%ebx
sub    %edx,%ebx
add    %ecx,%ebx
add    %eax,%ebx
test   %ebx,%ebx
jle    116c <choose_delay+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <random@plt>
add    $0xffffffff,%ebx
jne    1160 <choose_delay+0x40>
xor    %eax,%eax
call   1040 <random@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @choose_delay() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getpid()
store i32 %3, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = srem i32 %6, 30
%8 = icmp slt i32 %5, %7
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = call i32 (...) @random()
br label %11
11: ; preds = %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = call i32 (...) @random()
%16 = srem i32 %15, 100
ret i32 %16
}

LLVM IR (-O2):
define i32 @choose_delay() {
%1 = tail call i32 (...) @getpid()
%2 = srem i32 %1, 30
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ 0, %0 ]
%6 = tail call i32 (...) @random()
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %2
br i1 %8, label %9, label %4
9: ; preds = %4, %0
%10 = tail call i32 (...) @random()
%11 = srem i32 %10, 100
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  printf("%s\n", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/vincent040/lab/refs/heads/"
                 "master/GNU-tools/make/demo/c.c");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vincent040/lab/refs/heads/master/GNU-tools/make/demo/c.c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vincent040/lab/refs/heads/master/GNU-tools/make/demo/c.c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void debug_puts(const char *str) {
  const char *c;
  for (c = str; *c; c++)
    (*((volatile char *)0x20)) = *c;
}


x86 assembly (clang, -O0):
<debug_puts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     113b <debug_puts+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    $0x20,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <debug_puts+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_puts>:
mov    (%rdi),%al
test   %al,%al
je     1122 <debug_puts+0x22>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,0x20
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <debug_puts+0x10>
ret

LLVM IR (-O0):
define void @debug_puts(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %12, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
store volatile i8 %11, i8* inttoptr (i64 32 to i8*)
br label %12
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @debug_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %8, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
store volatile i8 %5, i8* inttoptr (i64 32 to i8*)
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4, %1
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int stat(char const *, struct stat *);
int doesFileExist(const char *filename) {
  struct stat buffer;
  int exist = stat(filename, &buffer);
  if (exist == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<doesFileExist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1142 <doesFileExist+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <doesFileExist+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @doesFileExist(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @stat(i8* %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @doesFileExist(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void plugin_exit_event(void) {}


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

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

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

LLVM IR (-O2):
define void @plugin_exit_event() {
ret void
}
/* Variables and functions */
double double_modulus(double, double);
double math_angle_to_game_angle_degrees(double angle) {
  double a;
  a = (360.0 - angle) + 90.0;
  if (a < 0)
    a += 360.0;
  if (a >= 360.0)
    a -= 360.0;
  return double_modulus(a, 360.0);
}


x86 assembly (clang, -O0):
<math_angle_to_game_angle_degrees>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    115b <math_angle_to_game_angle_degrees+0x4b>
movsd  0xeb7(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1188 <math_angle_to_game_angle_degrees+0x78>
movsd  -0x10(%rbp),%xmm0
movsd  0xe89(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe73(%rip),%xmm1
call   1030 <double_modulus@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_angle_to_game_angle_degrees>:
movsd  0xee8(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  0xee0(%rip),%xmm2
movapd %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
movapd %xmm2,%xmm4
cmpltsd %xmm3,%xmm4
andpd  %xmm4,%xmm0
andnpd %xmm2,%xmm4
orpd   %xmm0,%xmm4
movapd %xmm1,%xmm0
cmpnlesd %xmm4,%xmm0
movapd %xmm0,%xmm2
andpd  %xmm4,%xmm2
addsd  0xeae(%rip),%xmm4
andnpd %xmm4,%xmm0
orpd   %xmm2,%xmm0
jmp    1030 <double_modulus@plt>

LLVM IR (-O0):
define double @math_angle_to_game_angle_degrees(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fsub double 3.600000e+02, %4
%6 = fadd double %5, 9.000000e+01
store double %6, double* %3
%7 = load double, double* %3
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = fadd double %10, 3.600000e+02
store double %11, double* %3
br label %12
12: ; preds = %9, %1
%13 = load double, double* %3
%14 = fcmp oge double %13, 3.600000e+02
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double, double* %3
%17 = fsub double %16, 3.600000e+02
store double %17, double* %3
br label %18
18: ; preds = %15, %12
%19 = load double, double* %3
%20 = call double @double_modulus(double %19, double 3.600000e+02)
ret double %20
}

LLVM IR (-O2):
define double @math_angle_to_game_angle_degrees(double %0) {
%2 = fsub double 3.600000e+02, %0
%3 = fadd double %2, 9.000000e+01
%4 = fcmp olt double %3, 0.000000e+00
%5 = fadd double %3, 3.600000e+02
%6 = select i1 %4, double %5, double %3
%7 = fcmp ult double %6, 3.600000e+02
%8 = fadd double %6, -3.600000e+02
%9 = select i1 %7, double %6, double %8
%10 = tail call double @double_modulus(double %9, double 3.600000e+02)
ret double %10
}
/* Variables and functions */
int benchmark(int);
int main() {
  int result = benchmark(10000);
  return result;
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x2710,%edi
jmp    1030 <benchmark@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @benchmark(i32 10000)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ readide(int, int /*<<< orphan*/);
uint8_t ide_read_sec(uint16_t addr, void *priv) { return readide(1, addr); }


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

x86 assembly (clang, -O2):
<ide_read_sec>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <readide@plt>

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

LLVM IR (-O2):
define i32 @ide_read_sec(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 @readide(i32 1, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ function();
void use() { function(); }


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

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

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

LLVM IR (-O2):
define void @use() {
%1 = tail call i32 (...) @function()
ret void
}
void SetPixel(unsigned char x, unsigned char y, unsigned char value) {}


x86 assembly (clang, -O0):
<SetPixel>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @SetPixel(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
ret void
}

LLVM IR (-O2):
define void @SetPixel(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}