xunge/DecIR huggingface dataset:
/* Variables and functions */
int strlen(char *);
int mask_search(char *s) {
  int i;
  for (i = 0; i < strlen(s); i++)
    s[i] ^= 3;
  return 0;
}


x86 assembly (clang, -O0):
<mask_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    115f <mask_search+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
xor    $0x3,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <mask_search+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask_search>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1148 <mask_search+0x38>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorb   $0x3,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1130 <mask_search+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @mask_search(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = xor i8 %7, 3
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fmaxf(float const, float);
float fminf(float const, int /*<<< orphan*/);
float constrain(float value, const float minVal, const float maxVal) {
  return fminf(maxVal, fmaxf(minVal, value));
}


x86 assembly (clang, -O0):
<constrain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1040 <fmaxf@plt>
movss  -0x10(%rbp),%xmm0
mov    %eax,%edi
call   1030 <fminf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constrain>:
push   %rax
movss  %xmm2,0x4(%rsp)
movaps %xmm0,%xmm2
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1040 <fmaxf@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
pop    %rax
jmp    1030 <fminf@plt>

LLVM IR (-O0):
define float @constrain(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = load float, float* %5
%9 = load float, float* %4
%10 = call i32 @fmaxf(float %8, float %9)
%11 = call float @fminf(float %7, i32 %10)
ret float %11
}

LLVM IR (-O2):
define float @constrain(float %0, float %1, float %2) {
%4 = tail call i32 @fmaxf(float %1, float %0)
%5 = tail call float @fminf(float %2, i32 %4)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void menu(void) {
  printf("1. Inicializar Lista\n");
  printf("2. Insertar elemento\n");
  printf("3. Visualizar Lista\n");
  printf("4. Eliminar elemento\n");
  printf("5. Salir\nOpcion: ");
}


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

x86 assembly (clang, -O2):
<menu>:
push   %rax
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"1. Inicializar Lista\0A\00"
@.str.1 = [22 x i8] c"2. Insertar elemento\0A\00"
@.str.2 = [21 x i8] c"3. Visualizar Lista\0A\00"
@.str.3 = [22 x i8] c"4. Eliminar elemento\0A\00"
@.str.4 = [18 x i8] c"5. Salir\0AOpcion: \00"
define void @menu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.4 = [18 x i8] c"5. Salir\0AOpcion: \00"
@str = [21 x i8] c"1. Inicializar Lista\00"
@str.5 = [21 x i8] c"2. Insertar elemento\00"
@str.6 = [20 x i8] c"3. Visualizar Lista\00"
@str.7 = [21 x i8] c"4. Eliminar elemento\00"
define void @menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
ret void
}
double solveRootOne(double a, double b) { return -b / (2 * a); }


x86 assembly (clang, -O0):
<solveRootOne>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xece(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveRootOne>:
xorpd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @solveRootOne(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 = fneg double %5
%7 = load double, double* %3
%8 = fmul double 2.000000e+00, %7
%9 = fdiv double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @solveRootOne(double %0, double %1) {
%3 = fneg double %1
%4 = fmul double %0, 2.000000e+00
%5 = fdiv double %3, %4
ret double %5
}
void gtk_tree_selection_select_path() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_selection_select_path() {
ret void
}
int execute_perf_event_open() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_perf_event_open() {
ret i32 0
}
long long GetNumPlayers() { return 350000LL - 1; }


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

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

LLVM IR (-O0):
define i64 @GetNumPlayers() {
ret i64 349999
}

LLVM IR (-O2):
define i64 @GetNumPlayers() {
ret i64 349999
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
uint16_t mmio_readw(uint16_t *addr) { return *(volatile uint16_t *)addr; }


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

x86 assembly (clang, -O2):
<mmio_readw>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @mmio_readw(i32* %0) {
%2 = load volatile i32, i32* %0
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint_fast16_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_EQUALS_uint_fast16_t(uint_fast16_t const k1,
                                            uint_fast16_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_EQUALS_uint_fast16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_EQUALS_uint_fast16_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_EQUALS_uint_fast16_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_EQUALS_uint_fast16_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ shell_sort2(int *, int);
int main(void) {
  int arr[] = {2, 1, 8, 3, 9, 0, 4, 6, 7, 5};
  int length = 10;
  shell_sort2(arr, length);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <shell_sort2@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <shell_sort2@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 2, i32 1, i32 8, i32 3, i32 9, i32 0, i32 4, i32 6, i32 7, i32 5]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
store i32 10, i32* %2
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @shell_sort2(i32* %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 2, i32 1, i32 8, i32 3, i32 9, i32 0, i32 4, i32 6, i32 7, i32 5]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @shell_sort2(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ serial_puts(char *);
int main(int argc, char **argv) {
  puts("Is the serial working?\n");
  serial_puts("Hello from userland!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
call   1040 <serial_puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"Is the serial working?\0A\00"
@.str.1 = [22 x i8] c"Hello from userland!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @serial_puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Is the serial working?\0A\00"
@.str.1 = [22 x i8] c"Hello from userland!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @serial_puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void tag5(handler, arg) void (*handler)();
void *arg;
{ (*handler)(arg); }


x86 assembly (clang, -O0):
<tag5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   *%rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag5>:
mov    %rdi,%rcx
mov    %rsi,%rdi
xor    %eax,%eax
jmp    *%rcx

LLVM IR (-O0):
define void @tag5(void (...)* %0, i8* %1) {
%3 = alloca void (...)*
%4 = alloca i8*
store void (...)* %0, void (...)** %3
store i8* %1, i8** %4
%5 = load void (...)*, void (...)** %3
%6 = load i8*, i8** %4
%7 = bitcast void (...)* %5 to void (i8*, ...)*
ret void
}

LLVM IR (-O2):
define void @tag5(void (...)* nocapture %0, i8* %1) {
%3 = bitcast void (...)* %0 to void (i8*, ...)*
tail call void (i8*, ...) %3(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ help();
int usage() {
  help();
  return 1;
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
xor    %eax,%eax
call   1030 <help@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @usage() {
%1 = tail call i32 (...) @help()
ret i32 1
}
/* Variables and functions */
unsigned char rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
void fill_random(unsigned char *p, int n) {
  srand(0);
  int i;
  for (i = 0; i < n; i++)
    p[i] = rand();
}


x86 assembly (clang, -O0):
<fill_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
call   1030 <srand@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116b <fill_random+0x4b>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <fill_random+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_random>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    1154 <fill_random+0x34>
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <fill_random+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @fill_random(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 @srand(i32 0)
store i32 0, i32* %5
br label %7
7: ; preds = %17, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = call zeroext i8 (...) @rand()
%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 %12, i8* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %7
20: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @fill_random(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @srand(i32 0)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %11, %7 ]
%9 = tail call zeroext i8 (...) @rand()
%10 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %9, i8* %10
%11 = add nuw nsw i64 %8, 1
%12 = icmp eq i64 %11, %6
br i1 %12, label %13, label %7
13: ; preds = %7, %2
ret void
}
int test() {
  int i, j, k;
  for (i = 0; i < 8;) {
    if (i == 4)
      break;
    i++;
  }
  return (i != 4);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    1132 <test+0x32>
cmpl   $0x4,-0x4(%rbp)
jne    1124 <test+0x24>
jmp    1132 <test+0x32>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test+0xb>
cmpl   $0x4,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rectangle();
int /*<<< orphan*/ triangle();
main(void) {
  triangle();
  rectangle();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <triangle@plt>
mov    $0x0,%al
call   1030 <rectangle@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @triangle()
%2 = call i32 (...) @rectangle()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @triangle()
%2 = tail call i32 (...) @rectangle()
ret i32 0
}
double degs_to_rads(double degs) {
  return degs * 6.2831853071795864769252867665590 / 360.0;
}


x86 assembly (clang, -O0):
<degs_to_rads>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<degs_to_rads>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @degs_to_rads(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x401921FB54442D18
%5 = fdiv double %4, 3.600000e+02
ret double %5
}

LLVM IR (-O2):
define double @degs_to_rads(double %0) {
%2 = fmul double %0, 0x401921FB54442D18
%3 = fdiv double %2, 3.600000e+02
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void func_help() {
  fprintf(stderr, "Utilisation\n");
  fprintf(stderr, "main [-a IPv4 | -n Netmask]\n");
  fprintf(stderr, "-a IPv4:\tStarting ipv4 address\n");
  fprintf(stderr, "-n Netmask:\tNetmask to use\n");
  return;
}


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

x86 assembly (clang, -O2):
<func_help>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeed(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeff(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"Utilisation\0A\00"
@.str.1 = [29 x i8] c"main [-a IPv4 | -n Netmask]\0A\00"
@.str.2 = [32 x i8] c"-a IPv4:\09Starting ipv4 address\0A\00"
@.str.3 = [28 x i8] c"-n Netmask:\09Netmask to use\0A\00"
define void @func_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"Utilisation\0A\00"
@.str.1 = [29 x i8] c"main [-a IPv4 | -n Netmask]\0A\00"
@.str.2 = [32 x i8] c"-a IPv4:\09Starting ipv4 address\0A\00"
@.str.3 = [28 x i8] c"-n Netmask:\09Netmask to use\0A\00"
define void @func_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int utf8_byte_count(char);
int utf8_advance_ptr(char **ptr) {
  int bc = utf8_byte_count(**ptr);
  *ptr += bc;
  return bc;
}


x86 assembly (clang, -O0):
<utf8_advance_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <utf8_byte_count@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_advance_ptr>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
movsbl (%rax),%edi
call   1030 <utf8_byte_count@plt>
cltq
add    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @utf8_advance_ptr(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = call i32 @utf8_byte_count(i8 signext %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds i8, i8* %10, i64 %11
store i8* %12, i8** %9
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @utf8_advance_ptr(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i32 @utf8_byte_count(i8 signext %3)
%5 = load i8*, i8** %0
%6 = sext i32 %4 to i64
%7 = getelementptr inbounds i8, i8* %5, i64 %6
store i8* %7, i8** %0
ret i32 %4
}
/* Variables and functions */
int core6_safe(char const *);
int U_EMRPOLYGON16_safe(const char *record) { return (core6_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYGON16_safe>:
jmp    1030 <core6_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYGON16_safe(i8* %0) {
%2 = tail call i32 @core6_safe(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int64_t compare_string(const void *keyA, const void *keyB) {
  return strcmp((char *)keyA, (char *)keyB);
}


x86 assembly (clang, -O0):
<compare_string>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_string>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_string(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 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @compare_string(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ getChar();
void init() { getChar(); }


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

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

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

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @getChar()
ret void
}
int int_ops_slr(unsigned int l, int r) { return l >> r; }


x86 assembly (clang, -O0):
<int_ops_slr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_ops_slr>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @int_ops_slr(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
ret i32 %3
}
void unlimit(void) {}


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

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

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

LLVM IR (-O2):
define void @unlimit() {
ret void
}
int SDL_imageFilterBitNegationMMX(unsigned char *Src1, unsigned char *Dest,
                                  int length) {
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterBitNegationMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @SDL_imageFilterBitNegationMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgior(void) { gen("orl\t%ecx,%eax"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"orl\09%ecx,%eax\00"
define void @cgior() {
%1 = call i32 @gen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"orl\09%ecx,%eax\00"
define void @cgior() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ A();
void infinite_for_test(void) {
  for (;;) {
    A();
  }
}


x86 assembly (clang, -O0):
<infinite_for_test>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <infinite_for_test+0x9>
mov    $0x0,%al
call   1030 <A@plt>
jmp    1119 <infinite_for_test+0x9>

x86 assembly (clang, -O2):
<infinite_for_test>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <A@plt>
jmp    1120 <infinite_for_test+0x10>

LLVM IR (-O0):
define void @infinite_for_test() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @A()
br label %1
}

LLVM IR (-O2):
define void @infinite_for_test() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @A()
br label %1
}
/* Variables and functions */
int bs_conv_14be_8(unsigned char const *, int, unsigned char *);
int bs_conv_swab16(unsigned char *, int, unsigned char *);
int bs_conv_14be_16le(const unsigned char *in_buf, int size,
                      unsigned char *out_buf) {
  size = bs_conv_14be_8(in_buf, size, out_buf);
  size = bs_conv_swab16(out_buf, size, out_buf);
  return size;
}


x86 assembly (clang, -O0):
<bs_conv_14be_16le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <bs_conv_14be_8@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <bs_conv_swab16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bs_conv_14be_16le>:
push   %rbx
mov    %rdx,%rbx
call   1030 <bs_conv_14be_8@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    1040 <bs_conv_swab16@plt>

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

LLVM IR (-O2):
define i32 @bs_conv_14be_16le(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @bs_conv_14be_8(i8* %0, i32 %1, i8* %2)
%5 = tail call i32 @bs_conv_swab16(i8* %2, i32 %4, i8* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free3(void *data0, void *data1, void *data2) {
  if (data0)
    free(data0);
  if (data1)
    free(data1);
  if (data2)
    free(data2);
}


x86 assembly (clang, -O0):
<free3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <free3+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     114c <free3+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x18(%rbp)
je     1160 <free3+0x50>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free3>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
test   %rdi,%rdi
je     1124 <free3+0x14>
call   1030 <free@plt>
test   %rbx,%rbx
je     1131 <free3+0x21>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r14,%r14
je     1145 <free3+0x35>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @free3(i8* %0, i8* %1, i8* %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
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = call i32 @free(i8* %10)
br label %12
12: ; preds = %9, %3
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i8*, i8** %5
%17 = call i32 @free(i8* %16)
br label %18
18: ; preds = %15, %12
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i8*, i8** %6
%23 = call i32 @free(i8* %22)
br label %24
24: ; preds = %21, %18
ret void
}

LLVM IR (-O2):
define void @free3(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @free(i8* %0)
br label %7
7: ; preds = %5, %3
%8 = icmp eq i8* %1, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @free(i8* %1)
br label %11
11: ; preds = %9, %7
%12 = icmp eq i8* %2, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @free(i8* %2)
br label %15
15: ; preds = %13, %11
ret void
}
unsigned float_uint_overflow(float f) { return f; }


x86 assembly (clang, -O0):
<float_uint_overflow>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_uint_overflow>:
cvttss2si %xmm0,%rax
ret

LLVM IR (-O0):
define i32 @float_uint_overflow(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptoui float %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @float_uint_overflow(float %0) {
%2 = fptoui float %0 to i32
ret i32 %2
}
int mod(int k, int n) {
  int j = k % n;
  if (j < 0) {
    j = j + n;
  }
  return j;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1127 <mod+0x27>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
sar    $0x1f,%eax
and    %esi,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @mod(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 = srem i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
store i32 %14, i32* %5
br label %15
15: ; preds = %11, %2
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp slt i32 %3, 0
%5 = select i1 %4, i32 %1, i32 0
%6 = add nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int test_sat_parser_should_fail(char *);
int test08(void) { return test_sat_parser_should_fail("(a or --b)"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"(a or --b)\00"
define i32 @test08() {
%1 = call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [11 x i8] c"(a or --b)\00"
define i32 @test08() {
%1 = tail call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void test_2(void) {}


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

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

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

LLVM IR (-O2):
define void @test_2() {
ret void
}
int sod2hms(int sod, int *hour, int *min, int *sec) {
  *hour = sod / 3600;
  *min = (sod % 3600) / 60;
  *sec = (sod % 60);
  return (*sec);
}


x86 assembly (clang, -O0):
<sod2hms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sod2hms>:
movslq %edi,%rax
imul   $0xffffffff91a2b3c5,%rax,%rdi
shr    $0x20,%rdi
add    %eax,%edi
mov    %edi,%r8d
shr    $0x1f,%r8d
sar    $0xb,%edi
add    %r8d,%edi
mov    %edi,(%rsi)
imul   $0xe10,%edi,%esi
mov    %eax,%edi
sub    %esi,%edi
movswl %di,%esi
imul   $0xffff8889,%esi,%esi
shr    $0x10,%esi
add    %edi,%esi
movzwl %si,%esi
movswl %si,%edi
shr    $0xf,%esi
sar    $0x5,%edi
add    %esi,%edi
movswl %di,%esi
mov    %esi,(%rdx)
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x5,%edx
add    %esi,%edx
imul   $0x3c,%edx,%edx
sub    %edx,%eax
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define i32 @sod2hms(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 3600
%11 = load i32*, i32** %6
store i32 %10, i32* %11
%12 = load i32, i32* %5
%13 = srem i32 %12, 3600
%14 = sdiv i32 %13, 60
%15 = load i32*, i32** %7
store i32 %14, i32* %15
%16 = load i32, i32* %5
%17 = srem i32 %16, 60
%18 = load i32*, i32** %8
store i32 %17, i32* %18
%19 = load i32*, i32** %8
%20 = load i32, i32* %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @sod2hms(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = sdiv i32 %0, 3600
store i32 %5, i32* %1
%6 = srem i32 %0, 3600
%7 = trunc i32 %6 to i16
%8 = sdiv i16 %7, 60
%9 = sext i16 %8 to i32
store i32 %9, i32* %2
%10 = srem i32 %0, 60
store i32 %10, i32* %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
int print_chandle() {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.print_chandle()"
      "\n",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/"
      "amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/"
      "dpi_c_misc.h",
      111);
  return 10;
}


x86 assembly (clang, -O0):
<print_chandle>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xefb(%rip),%rdx
mov    $0x6f,%ecx
call   1030 <fprintf@plt>
mov    $0xa,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_chandle>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
lea    0xefe(%rip),%rdx
mov    $0x6f,%ecx
call   1030 <fprintf@plt>
mov    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"[INFO](%s:%d:) dpi_c.print_chandle()\0A\00"
@.str.1 = [218 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/dpi_c_misc.h\00"
define i32 @print_chandle() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([218 x i8], [218 x i8]* @.str.1, i64 0, i64 0), i32 111)
ret i32 10
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"[INFO](%s:%d:) dpi_c.print_chandle()\0A\00"
@.str.1 = [218 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/dpi_c_misc.h\00"
define i32 @print_chandle() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([218 x i8], [218 x i8]* @.str.1, i64 0, i64 0), i32 111)
ret i32 10
}
int getIndex(double min, double range, int dim, double val) {
  if (val >= min + range)
    return dim - 1;
  if (val <= min)
    return 0;
  return (int)(((val - min) / range) * dim);
}


x86 assembly (clang, -O0):
<getIndex>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     113d <getIndex+0x3d>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <getIndex+0x7c>
movsd  -0x28(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     115d <getIndex+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    117c <getIndex+0x7c>
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getIndex>:
movapd %xmm0,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm3,%xmm2
jae    112e <getIndex+0x2e>
xor    %eax,%eax
ucomisd %xmm2,%xmm0
jae    112d <getIndex+0x2d>
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
ret
add    $0xffffffff,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @getIndex(double %0, double %1, i32 %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca double
store double %0, double* %6
store double %1, double* %7
store i32 %2, i32* %8
store double %3, double* %9
%10 = load double, double* %9
%11 = load double, double* %6
%12 = load double, double* %7
%13 = fadd double %11, %12
%14 = fcmp oge double %10, %13
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32, i32* %8
%17 = sub nsw i32 %16, 1
store i32 %17, i32* %5
br label %33
18: ; preds = %4
%19 = load double, double* %9
%20 = load double, double* %6
%21 = fcmp ole double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %5
br label %33
23: ; preds = %18
%24 = load double, double* %9
%25 = load double, double* %6
%26 = fsub double %24, %25
%27 = load double, double* %7
%28 = fdiv double %26, %27
%29 = load i32, i32* %8
%30 = sitofp i32 %29 to double
%31 = fmul double %28, %30
%32 = fptosi double %31 to i32
store i32 %32, i32* %5
br label %33
33: ; preds = %23, %22, %15
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @getIndex(double %0, double %1, i32 %2, double %3) {
%5 = fadd double %0, %1
%6 = fcmp ugt double %5, %3
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = add nsw i32 %2, -1
br label %17
9: ; preds = %4
%10 = fcmp ugt double %3, %0
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = fsub double %3, %0
%13 = fdiv double %12, %1
%14 = sitofp i32 %2 to double
%15 = fmul double %13, %14
%16 = fptosi double %15 to i32
br label %17
17: ; preds = %9, %11, %7
%18 = phi i32 [ %8, %7 ], [ %16, %11 ], [ 0, %9 ]
ret i32 %18
}
int cmpStrDec(const void *pa, const void *pb) {
  char *p1 = (char *)pa;
  char *p2 = (char *)pb;
  return *p2 - *p1;
}


x86 assembly (clang, -O0):
<cmpStrDec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpStrDec>:
movsbl (%rsi),%eax
movsbl (%rdi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmpStrDec(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @cmpStrDec(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void func_2(int a[][3][5]) { printf("%d\n", a[1][2][3]); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @func_2([3 x [5 x i32]]* nocapture %0) {
%2 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %0, i64 1, i64 2, i64 3
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
float arc2pixel(int, float);
float lon2pixel(int zoom, float lon) { return arc2pixel(zoom, lon); }


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

x86 assembly (clang, -O2):
<lon2pixel>:
jmp    1030 <arc2pixel@plt>

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

LLVM IR (-O2):
define float @lon2pixel(i32 %0, float %1) {
%3 = tail call float @arc2pixel(i32 %0, float %1)
ret float %3
}