xunge/DecIR huggingface dataset:
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ printf(char *, char *);
int usage(char *argv[]) {
  printf("usage: %s up | down | max | min | on | off\n\n"
         "options:\n"
         "\tup:\t increases brightness by 10%%\n"
         "\tdown:\t decreases brightness by 10%%\n"
         "\tmax:\t sets brightness to 100%%\n"
         "\tmin:\t sets brightness to 0%%\n"
         "\ton:\t turns the screen on\n"
         "\toff:\t turns the screen off\n\n"
         "2015, Jakub Hladik, www.github.com/jakeh12\n\n",
         argv[0]);
  return EXIT_FAILURE;
}


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

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

LLVM IR (-O0):
@.str = [287 x i8] c"usage: %s up | down | max | min | on | off\0A\0Aoptions:\0A\09up:\09 increases brightness by 10%%\0A\09down:\09 decreases brightness by 10%%\0A\09max:\09 sets brightness to 100%%\0A\09min:\09 sets brightness to 0%%\0A\09on:\09 turns the screen on\0A\09off:\09 turns the screen off\0A\0A2015, Jakub Hladik, www.github.com/jakeh12\0A\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @EXIT_FAILURE
ret i32 %7
}

LLVM IR (-O2):
@.str = [287 x i8] c"usage: %s up | down | max | min | on | off\0A\0Aoptions:\0A\09up:\09 increases brightness by 10%%\0A\09down:\09 decreases brightness by 10%%\0A\09max:\09 sets brightness to 100%%\0A\09min:\09 sets brightness to 0%%\0A\09on:\09 turns the screen on\0A\09off:\09 turns the screen off\0A\0A2015, Jakub Hladik, www.github.com/jakeh12\0A\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([287 x i8], [287 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @EXIT_FAILURE
ret i32 %4
}
/* Variables and functions */
int compare_beepackages(void *, void *);
int my_compare_key(void *a, void *b) { return compare_beepackages(a, b); }


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

x86 assembly (clang, -O2):
<my_compare_key>:
jmp    1030 <compare_beepackages@plt>

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

LLVM IR (-O2):
define i32 @my_compare_key(i8* %0, i8* %1) {
%3 = tail call i32 @compare_beepackages(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ _xabort(int);
void test_xabort(void) { _xabort(2); }


x86 assembly (clang, -O0):
<test_xabort>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <_xabort@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_xabort>:
mov    $0x2,%edi
jmp    1030 <_xabort@plt>

LLVM IR (-O0):
define void @test_xabort() {
%1 = call i32 @_xabort(i32 2)
ret void
}

LLVM IR (-O2):
define void @test_xabort() {
%1 = tail call i32 @_xabort(i32 2)
ret void
}
/* Variables and functions */
double svp(double);
double svp_slope(double temp) {
  return (17.269 * 237.3) / ((237.3 + temp) * (237.3 + temp)) * svp(temp);
}


x86 assembly (clang, -O0):
<svp_slope>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <svp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svp_slope>:
push   %rax
movsd  0xee7(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movsd  0xedf(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   1030 <svp@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @svp_slope(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double 2.373000e+02, %3
%5 = load double, double* %2
%6 = fadd double 2.373000e+02, %5
%7 = fmul double %4, %6
%8 = fdiv double 0x40B001EF06F69446, %7
%9 = load double, double* %2
%10 = call double @svp(double %9)
%11 = fmul double %8, %10
ret double %11
}

LLVM IR (-O2):
define double @svp_slope(double %0) {
%2 = fadd double %0, 2.373000e+02
%3 = fmul double %2, %2
%4 = fdiv double 0x40B001EF06F69446, %3
%5 = tail call double @svp(double %0)
%6 = fmul double %4, %5
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;
typedef int /*<<< orphan*/ instr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ build_instr(int, int);
int encode_opcode(char *);
int /*<<< orphan*/ fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
void write_instr(FILE *file_ptr, char opcode[], char operand[]) {
  int int_opcode = encode_opcode(opcode);
  int int_operand = atoi(operand);
  int16_t instr = build_instr(int_opcode, int_operand);
  fwrite(&instr, sizeof(instr), 1, file_ptr);
}


x86 assembly (clang, -O0):
<write_instr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <encode_opcode@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <build_instr@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_instr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <encode_opcode@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <build_instr@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1060 <fwrite@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @write_instr(i32* nocapture %0, i8* %1, i8* nocapture %2) {
%4 = alloca i32
%5 = tail call i32 @encode_opcode(i8* %1)
%6 = tail call i32 @atoi(i8* %2)
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @build_instr(i32 %5, i32 %6)
store i32 %8, i32* %4
%9 = call i32 @fwrite(i32* %4, i32 4, i32 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Cylinder_draw();
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glPointSize(double);
int /*<<< orphan*/ parallelepiped_draw();
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0, 0.0, 0.0);
  glPointSize(2.0);
  Cylinder_draw();
  parallelepiped_draw();
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
movsd  0xe8e(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
movsd  0xe73(%rip),%xmm0
call   1080 <glPointSize@plt>
mov    $0x0,%al
call   1030 <Cylinder_draw@plt>
mov    $0x0,%al
call   1070 <parallelepiped_draw@plt>
mov    $0x0,%al
call   1060 <glFlush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
movsd  0xe89(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1050 <glColor3f@plt>
movsd  0xe7e(%rip),%xmm0
call   1080 <glPointSize@plt>
xor    %eax,%eax
call   1030 <Cylinder_draw@plt>
xor    %eax,%eax
call   1070 <parallelepiped_draw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = call i32 @glClear(i32 %1)
%3 = call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%4 = call i32 @glPointSize(double 2.000000e+00)
%5 = call i32 (...) @Cylinder_draw()
%6 = call i32 (...) @parallelepiped_draw()
%7 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%4 = tail call i32 @glPointSize(double 2.000000e+00)
%5 = tail call i32 (...) @Cylinder_draw()
%6 = tail call i32 (...) @parallelepiped_draw()
%7 = tail call i32 (...) @glFlush()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ pc_trace(char, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char const *);
void panic(const char *s) {
  pc_trace('*', 0);
  puts(s);
  exit(5);
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2a,%edi
xor    %esi,%esi
call   1050 <pc_trace@plt>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2a,%edi
xor    %esi,%esi
call   1050 <pc_trace@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @panic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @pc_trace(i8 signext 42, i32 0)
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
%6 = call i32 @exit(i32 5)
unreachable
}

LLVM IR (-O2):
define void @panic(i8* nocapture %0) {
%2 = tail call i32 @pc_trace(i8 signext 42, i32 0)
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @exit(i32 5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char const *, char *, int /*<<< orphan*/);
int begins_with(const char *str, char *with) {
  if (str == NULL || with == NULL) {
    return 0;
  }
  return strncmp(str, with, strlen(with)) == 0;
}


x86 assembly (clang, -O0):
<begins_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <begins_with+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <begins_with+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1189 <begins_with+0x69>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<begins_with>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     1156 <begins_with+0x36>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1156 <begins_with+0x36>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @begins_with(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %1)
%8 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ %10, %6 ], [ 0, %2 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: [-a | -f | -r] ipv4-address\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Usage: [-a | -f | -r] ipv4-address\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [36 x i8] c"Usage: [-a | -f | -r] ipv4-address\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void myfree(void *q, void *p) {
  q = 0;
  free(p);
}


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

x86 assembly (clang, -O2):
<myfree>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @myfree(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
void microsec_(int *ig) {
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  *ig = (int)tv.tv_usec;
  return;
}


x86 assembly (clang, -O0):
<microsec_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<microsec_>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
define void @microsec_(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timeval
%4 = alloca %struct.timezone
store i32* %0, i32** %2
%5 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* %4)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = load i32*, i32** %2
store i32 %8, i32* %9
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
define void @microsec_(i32* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.timezone
%4 = bitcast %struct.timeval* %2 to i8*
%5 = bitcast %struct.timezone* %3 to i8*
%6 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* %3)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
store i32 %9, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_help() {
  fprintf(stderr, "testopt [options] <message>\n"
                  "-h  help message\n"
                  "-k  assign key\n"
                  "-t  assign type (default:9)\n");
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [89 x i8] c"testopt [options] <message>\0A-h help message\0A-k assign key\0A-t assign type (default:9)\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [89 x i8] c"testopt [options] <message>\0A-h help message\0A-k assign key\0A-t assign type (default:9)\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IO_get_byte();
int /*<<< orphan*/ put_argument2(char *, int /*<<< orphan*/, char *);
int am_abs_y8(void) {
  put_argument2(" $", IO_get_byte(), ", y");
  return 2;
}


x86 assembly (clang, -O0):
<am_abs_y8>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <IO_get_byte@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
lea    0xec8(%rip),%rdx
call   1040 <put_argument2@plt>
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_abs_y8>:
push   %rax
xor    %eax,%eax
call   1030 <IO_get_byte@plt>
lea    0xed1(%rip),%rdi
lea    0xecd(%rip),%rdx
mov    %eax,%esi
call   1040 <put_argument2@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c" $\00"
@.str.1 = [4 x i8] c", y\00"
define i32 @am_abs_y8() {
%1 = call i32 (...) @IO_get_byte()
%2 = call i32 @put_argument2(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 2
}

LLVM IR (-O2):
@.str = [3 x i8] c" $\00"
@.str.1 = [4 x i8] c", y\00"
define i32 @am_abs_y8() {
%1 = tail call i32 (...) @IO_get_byte()
%2 = tail call i32 @put_argument2(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 2
}
double double5(void) { return 5.0; }


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

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

LLVM IR (-O0):
define double @double5() {
ret double 5.000000e+00
}

LLVM IR (-O2):
define double @double5() {
ret double 5.000000e+00
}
const char *Hash_Description(void) {
  return "The `Hash` class provides a mechanism for hashing an object. This "
         "hash "
         "value should remain the same across objects that are also considered "
         "equal by the `Cmp` class. For objects that are not considered equal "
         "this "
         "value should aim to be evenly distributed across integers."
         "\n\n"
         "This is not a cryptographic hash. It is used for various objects or "
         "data structures that require fast hashing such as the `Table` type. "
         "Due "
         "to this it should not be used for cryptography or security."
         "\n\n"
         "By default an object is hashed by using its raw memory with the "
         "[Murmurhash](http://en.wikipedia.org/wiki/MurmurHash) algorithm. Due "
         "to "
         "the link between them it is recommended to only override `Hash` and "
         "`Cmp` in conjunction.";
}


x86 assembly (clang, -O0):
<Hash_Description>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hash_Description>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [700 x i8] c"The `Hash` class provides a mechanism for hashing an object. This hash value should remain the same across objects that are also considered equal by the `Cmp` class. For objects that are not considered equal this value should aim to be evenly distributed across integers.\0A\0AThis is not a cryptographic hash. It is used for various objects or data structures that require fast hashing such as the `Table` type. Due to this it should not be used for cryptography or security.\0A\0ABy default an object is hashed by using its raw memory with the [Murmurhash](http://en.wikipedia.org/wiki/MurmurHash) algorithm. Due to the link between them it is recommended to only override `Hash` and `Cmp` in conjunction.\00"
define i8* @Hash_Description() {
ret i8* getelementptr inbounds ([700 x i8], [700 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [700 x i8] c"The `Hash` class provides a mechanism for hashing an object. This hash value should remain the same across objects that are also considered equal by the `Cmp` class. For objects that are not considered equal this value should aim to be evenly distributed across integers.\0A\0AThis is not a cryptographic hash. It is used for various objects or data structures that require fast hashing such as the `Table` type. Due to this it should not be used for cryptography or security.\0A\0ABy default an object is hashed by using its raw memory with the [Murmurhash](http://en.wikipedia.org/wiki/MurmurHash) algorithm. Due to the link between them it is recommended to only override `Hash` and `Cmp` in conjunction.\00"
define i8* @Hash_Description() {
ret i8* getelementptr inbounds ([700 x i8], [700 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
size_t strlen(char const *);
size_t strlen_P(const char *s) { return strlen(s); }


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

x86 assembly (clang, -O2):
<strlen_P>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i64 @strlen_P(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @strlen_P(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ test_func(int, int);
int main() {
  typedef struct {
    int x;
    int y;
    char ch;
    float fp;
    char ar[4];
    char *p;
  } LOCAL_TYPE;
  LOCAL_TYPE a;
  LOCAL_TYPE b;
  int i = 1;
  while (1) {
    test_func(i, i * 2);
    i++;
    if (i > 4)
      i = 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x4c(%rbp),%esi
shl    $0x1,%esi
call   1030 <test_func@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jle    114e <main+0x3e>
movl   $0x1,-0x4c(%rbp)
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
mov    $0x1,%ebx
nopl   (%rax)
lea    (%rbx,%rbx,1),%esi
mov    %ebx,%edi
call   1030 <test_func@plt>
cmp    $0x4,%ebx
lea    0x1(%rbx),%eax
cmovge %ebp,%eax
mov    %eax,%ebx
jmp    1120 <main+0x10>

LLVM IR (-O0):
%struct.LOCAL_TYPE = type { i32, i32, i8, float, [4 x i8], i8* }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.LOCAL_TYPE
%3 = alloca %struct.LOCAL_TYPE
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
br label %5
5: ; preds = %0, %15
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = mul nsw i32 %7, 2
%9 = call i32 @test_func(i32 %6, i32 %8)
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 4
br i1 %13, label %14, label %15
14: ; preds = %5
store i32 1, i32* %4
br label %15
15: ; preds = %14, %5
br label %5
}

LLVM IR (-O2):
%struct.LOCAL_TYPE = type { i32, i32, i8, float, [4 x i8], i8* }
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %7, %1 ]
%3 = shl nsw i32 %2, 1
%4 = tail call i32 @test_func(i32 %2, i32 %3)
%5 = add nsw i32 %2, 1
%6 = icmp sgt i32 %2, 3
%7 = select i1 %6, i32 1, i32 %5
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, ...);
int main(int argc, char **argv) {
  if (argc > 1) {
    printf("%s:%s\n", argv[0], argv[1]);
  } else {
    printf("two::::%s\n", argv[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1152 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1167 <main+0x57>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rax
mov    (%rsi),%rsi
cmp    $0x2,%edi
jl     1130 <main+0x20>
mov    0x8(%rax),%rdx
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    113e <main+0x2e>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s:%s\0A\00"
@.str.1 = [11 x i8] c"two::::%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %14)
br label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%s\0A\00"
@.str.1 = [11 x i8] c"two::::%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
%4 = load i8*, i8** %1
br i1 %3, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %7)
br label %11
9: ; preds = %2
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %11
11: ; preds = %9, %5
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wprintw(int /*<<< orphan*/ *, char const *, short);
int i2_wprintw(WINDOW *win, const char *fmt, short i) {
  return (wprintw(win, fmt, i));
}


x86 assembly (clang, -O0):
<i2_wprintw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movswl -0x12(%rbp),%edx
call   1030 <wprintw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2_wprintw>:
jmp    1030 <wprintw@plt>

LLVM IR (-O0):
define i32 @i2_wprintw(i32* %0, i8* %1, i16 signext %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i16
store i32* %0, i32** %4
store i8* %1, i8** %5
store i16 %2, i16* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i16, i16* %6
%10 = call i32 @wprintw(i32* %7, i8* %8, i16 signext %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @i2_wprintw(i32* %0, i8* %1, i16 signext %2) {
%4 = tail call i32 @wprintw(i32* %0, i8* %1, i16 signext %2)
ret i32 %4
}
int lcm(int a, int b) {
  int step;
  if (a > b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  for (step = b; b % a; b += step)
    ;
  return b;
}


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1131 <lcm+0x31>
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x0,%edx
je     115a <lcm+0x5a>
jmp    114c <lcm+0x4c>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1137 <lcm+0x37>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
cmp    %esi,%edi
mov    %esi,%r8d
cmovg  %edi,%r8d
cmovg  %esi,%edi
xor    %ecx,%ecx
xchg   %ax,%ax
add    %r8d,%ecx
mov    %ecx,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    1110 <lcm+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @lcm(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
br label %6
6: ; preds = %6, %2
%7 = phi i32 [ %4, %2 ], [ %10, %6 ]
%8 = srem i32 %7, %5
%9 = icmp eq i32 %8, 0
%10 = add nsw i32 %7, %4
br i1 %9, label %11, label %6
11: ; preds = %6
ret i32 %7
}
double relativeError(double value, double error) { return error / value; }


x86 assembly (clang, -O0):
<relativeError>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<relativeError>:
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @relativeError(double %0, double %1) {
%3 = fdiv double %1, %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(unsigned short *);
unsigned int logic_decimal_shift_left(unsigned short to_shift, size_t shift_by,
                                      unsigned short *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (to_shift << shift_by);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<logic_decimal_shift_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114e <logic_decimal_shift_left+0x3e>
movl   $0x2,-0x1c(%rbp)
jmp    1162 <logic_decimal_shift_left+0x52>
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    %cl,%eax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_decimal_shift_left>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rdx,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     1138 <logic_decimal_shift_left+0x28>
movzwl %bp,%eax
mov    %r14d,%ecx
shl    %cl,%eax
mov    %ax,(%rbx)
xor    %eax,%eax
jmp    113d <logic_decimal_shift_left+0x2d>
mov    $0x2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @logic_decimal_shift_left(i16 zeroext %0, i64 %1, i16* %2) {
%4 = alloca i16
%5 = alloca i64
%6 = alloca i16*
%7 = alloca i32
store i16 %0, i16* %4
store i64 %1, i64* %5
store i16* %2, i16** %6
%8 = load i16*, i16** %6
%9 = call i32 @assert(i16* %8)
store i32 0, i32* %7
%10 = load i16*, i16** %6
%11 = icmp ne i16* %10, null
br i1 %11, label %13, label %12
12: ; preds = %3
store i32 2, i32* %7
br label %21
13: ; preds = %3
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = load i64, i64* %5
%17 = trunc i64 %16 to i32
%18 = shl i32 %15, %17
%19 = trunc i32 %18 to i16
%20 = load i16*, i16** %6
store i16 %19, i16* %20
br label %21
21: ; preds = %13, %12
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @logic_decimal_shift_left(i16 zeroext %0, i64 %1, i16* %2) {
%4 = tail call i32 @assert(i16* %2)
%5 = icmp eq i16* %2, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = zext i16 %0 to i32
%8 = trunc i64 %1 to i32
%9 = shl i32 %7, %8
%10 = trunc i32 %9 to i16
store i16 %10, i16* %2
br label %11
11: ; preds = %3, %6
%12 = phi i32 [ 0, %6 ], [ 2, %3 ]
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t swap32(register uint32_t d) {
  return ((d & 0xff) << 24) | (d >> 24) | ((d & 0xff00) << 8) |
         ((d & 0xff0000) >> 8);
}


x86 assembly (clang, -O0):
<swap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap32>:
mov    %edi,%eax
shl    $0x18,%eax
mov    %edi,%ecx
sar    $0x18,%ecx
or     %eax,%ecx
mov    %edi,%eax
shl    $0x8,%eax
and    $0xff0000,%eax
or     %ecx,%eax
shr    $0x8,%edi
and    $0xff00,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @swap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = ashr i32 %6, 24
%8 = or i32 %5, %7
%9 = load i32, i32* %2
%10 = and i32 %9, 65280
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = load i32, i32* %2
%14 = and i32 %13, 16711680
%15 = ashr i32 %14, 8
%16 = or i32 %12, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @swap32(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr i32 %0, 24
%4 = or i32 %2, %3
%5 = shl i32 %0, 8
%6 = and i32 %5, 16711680
%7 = or i32 %4, %6
%8 = lshr i32 %0, 8
%9 = and i32 %8, 65280
%10 = or i32 %7, %9
ret i32 %10
}
signed char signedchar_ignoring_unsignedlongint(signed char x,
                                                unsigned long int y) {
  return x;
}


x86 assembly (clang, -O0):
<signedchar_ignoring_unsignedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @signedchar_ignoring_unsignedlongint(i8 signext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @signedchar_ignoring_unsignedlongint(i8 returned signext %0, i64 %1) {
ret i8 %0
}
int get_motiflength_from_index(int index) {
  int temp_index;
  int rem;
  int i;
  i = 0;
  temp_index = index;
  while (temp_index > 0) {
    rem = temp_index % 4;
    if (rem == 0)
      rem = 4;
    temp_index -= rem;
    temp_index /= 4;
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<get_motiflength_from_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1164 <get_motiflength_from_index+0x64>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    113d <get_motiflength_from_index+0x3d>
movl   $0x4,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1114 <get_motiflength_from_index+0x14>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_motiflength_from_index>:
xor    %eax,%eax
test   %edi,%edi
jle    1133 <get_motiflength_from_index+0x33>
mov    $0x4,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x3,%edx
cmove  %ecx,%edx
mov    %edi,%esi
sub    %edx,%esi
neg    %edx
add    %edx,%edi
add    $0x3,%edi
test   %esi,%esi
cmovns %esi,%edi
sar    $0x2,%edi
add    $0x1,%eax
cmp    $0x3,%esi
jg     1110 <get_motiflength_from_index+0x10>
ret

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

LLVM IR (-O2):
define i32 @get_motiflength_from_index(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i32 [ %11, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ %0, %1 ]
%6 = and i32 %5, 3
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 4, i32 %6
%9 = sub nsw i32 %5, %8
%10 = sdiv i32 %9, 4
%11 = add nuw nsw i32 %4, 1
%12 = icmp sgt i32 %9, 3
br i1 %12, label %3, label %13
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %11, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ output_line(char *);
void gen_get_indirect(char typeobj, int reg) {
  if (typeobj & (1 << 2)) {
    if (typeobj & 1) {
      output_line("lbu\t$v0, 0($v0)");
    } else {
      output_line("lb\t$v0, 0($v0)");
    }
  } else {
    output_line("lw\t$v0, 0($v0)");
  }
}


x86 assembly (clang, -O0):
<gen_get_indirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1163 <gen_get_indirect+0x53>
movsbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1152 <gen_get_indirect+0x42>
lea    0xeb8(%rip),%rdi
call   1030 <output_line@plt>
jmp    115e <gen_get_indirect+0x4e>
lea    0xeb7(%rip),%rdi
call   1030 <output_line@plt>
jmp    116f <gen_get_indirect+0x5f>
lea    0xeb5(%rip),%rdi
call   1030 <output_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_get_indirect>:
test   $0x1,%dil
lea    0xef5(%rip),%rax
lea    0xede(%rip),%rcx
cmove  %rax,%rcx
test   $0x4,%dil
lea    0xeee(%rip),%rdi
cmovne %rcx,%rdi
jmp    1030 <output_line@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"lbu\09$v0, 0($v0)\00"
@.str.1 = [15 x i8] c"lb\09$v0, 0($v0)\00"
@.str.2 = [15 x i8] c"lw\09$v0, 0($v0)\00"
define void @gen_get_indirect(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = and i32 %6, 4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @output_line(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %9
%17 = call i32 @output_line(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %21
19: ; preds = %2
%20 = call i32 @output_line(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %18
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"lbu\09$v0, 0($v0)\00"
@.str.1 = [15 x i8] c"lb\09$v0, 0($v0)\00"
@.str.2 = [15 x i8] c"lw\09$v0, 0($v0)\00"
define void @gen_get_indirect(i8 signext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = and i32 %3, 4
%5 = icmp eq i32 %4, 0
%6 = and i32 %3, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
%9 = select i1 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %8
%10 = tail call i32 @output_line(i8* %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int fail(char *msg) {
  printf("%s\n", msg);
  printf("FAIL\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<fail>:
push   %rax
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [5 x i8] c"FAIL\00"
define i32 @fail(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, long long, int);
int fun_stub_base_14_stub(int a, long long b, int c) {
  printf("fun_stub_base_14_stub:a = %d, b = %lld, c = %d\n", a, b, c);
  return a + b + c;
}


x86 assembly (clang, -O0):
<fun_stub_base_14_stub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
movslq -0x4(%rbp),%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_stub_base_14_stub>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xedd(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1030 <printf@plt>
add    %ebp,%ebx
add    %r14d,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"fun_stub_base_14_stub:a = %d, b = %lld, c = %d\0A\00"
define i32 @fun_stub_base_14_stub(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %7, i64 %8, i32 %9)
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = load i64, i64* %5
%14 = add nsw i64 %12, %13
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = add nsw i64 %14, %16
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@.str = [48 x i8] c"fun_stub_base_14_stub:a = %d, b = %lld, c = %d\0A\00"
define i32 @fun_stub_base_14_stub(i32 %0, i64 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %1, i32 %2)
%5 = trunc i64 %1 to i32
%6 = add i32 %5, %0
%7 = add i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ close_libgl();
int /*<<< orphan*/ load_procs();
int /*<<< orphan*/ open_libgl();
int parse_version();
int gl3wInit(void) {
  open_libgl();
  load_procs();
  close_libgl();
  return parse_version();
}


x86 assembly (clang, -O0):
<gl3wInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <open_libgl@plt>
mov    $0x0,%al
call   1050 <load_procs@plt>
mov    $0x0,%al
call   1040 <close_libgl@plt>
mov    $0x0,%al
call   1060 <parse_version@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl3wInit>:
push   %rax
xor    %eax,%eax
call   1030 <open_libgl@plt>
xor    %eax,%eax
call   1050 <load_procs@plt>
xor    %eax,%eax
call   1040 <close_libgl@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <parse_version@plt>

LLVM IR (-O0):
define i32 @gl3wInit() {
%1 = call i32 (...) @open_libgl()
%2 = call i32 (...) @load_procs()
%3 = call i32 (...) @close_libgl()
%4 = call i32 (...) @parse_version()
ret i32 %4
}

LLVM IR (-O2):
define i32 @gl3wInit() {
%1 = tail call i32 (...) @open_libgl()
%2 = tail call i32 (...) @load_procs()
%3 = tail call i32 (...) @close_libgl()
%4 = tail call i32 (...) @parse_version()
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_char(int a) { printf("%c\n", (char)a); }


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

x86 assembly (clang, -O2):
<print_char>:
movsbl %dil,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @print_char(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %2)
ret void
}