xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ dup(int);
int /*<<< orphan*/ dup2(int, int);
int main() {
  dup(2);
  dup(256);
  dup(-1);
  dup2(3, 4);
  dup2(255, 256);
  dup2(1, 1);
  dup2(-1, 4);
  dup2(3, -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <dup@plt>
mov    $0x100,%edi
call   1040 <dup@plt>
mov    $0xffffffff,%edi
call   1040 <dup@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <dup2@plt>
mov    $0xff,%edi
mov    $0x100,%esi
call   1030 <dup2@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <dup2@plt>
mov    $0xffffffff,%edi
mov    $0x4,%esi
call   1030 <dup2@plt>
mov    $0x3,%edi
mov    $0xffffffff,%esi
call   1030 <dup2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <dup@plt>
mov    $0x100,%edi
call   1040 <dup@plt>
mov    $0xffffffff,%edi
call   1040 <dup@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <dup2@plt>
mov    $0xff,%edi
mov    $0x100,%esi
call   1030 <dup2@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    $0xffffffff,%edi
mov    $0x4,%esi
call   1030 <dup2@plt>
mov    $0x3,%edi
mov    $0xffffffff,%esi
call   1030 <dup2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @dup(i32 2)
%3 = call i32 @dup(i32 256)
%4 = call i32 @dup(i32 -1)
%5 = call i32 @dup2(i32 3, i32 4)
%6 = call i32 @dup2(i32 255, i32 256)
%7 = call i32 @dup2(i32 1, i32 1)
%8 = call i32 @dup2(i32 -1, i32 4)
%9 = call i32 @dup2(i32 3, i32 -1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @dup(i32 2)
%2 = tail call i32 @dup(i32 256)
%3 = tail call i32 @dup(i32 -1)
%4 = tail call i32 @dup2(i32 3, i32 4)
%5 = tail call i32 @dup2(i32 255, i32 256)
%6 = tail call i32 @dup2(i32 1, i32 1)
%7 = tail call i32 @dup2(i32 -1, i32 4)
%8 = tail call i32 @dup2(i32 3, i32 -1)
ret i32 0
}
/* Variables and functions */
char freadb(int /*<<< orphan*/);
char readb() { return freadb(0); }


x86 assembly (clang, -O0):
<readb>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <freadb@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readb>:
xor    %edi,%edi
jmp    1030 <freadb@plt>

LLVM IR (-O0):
define signext i8 @readb() {
%1 = call signext i8 @freadb(i32 0)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @readb() {
%1 = tail call signext i8 @freadb(i32 0)
ret i8 %1
}
/* Type definitions */
struct msgbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *msgbuf_put_uninit(struct msgbuf *, size_t);
void *msgbuf_put(struct msgbuf *b, const void *p, size_t size) {
  void *dst = msgbuf_put_uninit(b, size);
  memcpy(dst, p, size);
  return dst;
}


x86 assembly (clang, -O0):
<msgbuf_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <msgbuf_put_uninit@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgbuf_put>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdx,%rsi
call   1040 <msgbuf_put_uninit@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.msgbuf = type { i32 }
define i8* @msgbuf_put(%struct.msgbuf* %0, i8* %1, i64 %2) {
%4 = alloca %struct.msgbuf*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store %struct.msgbuf* %0, %struct.msgbuf** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load %struct.msgbuf*, %struct.msgbuf** %4
%9 = load i64, i64* %6
%10 = call i8* @msgbuf_put_uninit(%struct.msgbuf* %8, i64 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call i32 @memcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %7
ret i8* %15
}

LLVM IR (-O2):
%struct.msgbuf = type { i32 }
define i8* @msgbuf_put(%struct.msgbuf* %0, i8* %1, i64 %2) {
%4 = tail call i8* @msgbuf_put_uninit(%struct.msgbuf* %0, i64 %2)
%5 = tail call i32 @memcpy(i8* %4, i8* %1, i64 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printusage(int argc, char *argv[]) {
  printf("Usage: %s OPTS -f FILE\n", argv[0]);
  printf("\t-b\tSave non-zero blocks as binary files.\n");
  printf("\t-a\tSave non-zero blocks as ASM-include files, with DB "
         "statements.\n\n");
}


x86 assembly (clang, -O0):
<printusage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s OPTS -f FILE\0A\00"
@.str.1 = [43 x i8] c"\09-b\09Save non-zero blocks as binary files.\0A\00"
@.str.2 = [69 x i8] c"\09-a\09Save non-zero blocks as ASM-include files, with DB statements.\0A\0A\00"
define void @printusage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s OPTS -f FILE\0A\00"
@str = [42 x i8] c"\09-b\09Save non-zero blocks as binary files.\00"
@str.3 = [68 x i8] c"\09-a\09Save non-zero blocks as ASM-include files, with DB statements.\0A\00"
define void @printusage(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.3, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ window;
};
typedef TYPE_1__ XButtonEvent;

/* Variables and functions */
unsigned long get_XButtonEvent_window(void *_p) {
  return (unsigned long)((XButtonEvent *)_p)->window;
}


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

x86 assembly (clang, -O2):
<get_XButtonEvent_window>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XButtonEvent_window(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XButtonEvent_window(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ errorp(int, char *);
char *malloc(int);
char *alloc(int n) {
  char *x;
  if ((x = malloc(n)) != NULL)
    return (x);
  errorp(1, "out of space");
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     114e <alloc+0x2e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115f <alloc+0x3f>
mov    $0x1,%edi
lea    0xea6(%rip),%rsi
call   1030 <errorp@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <alloc+0x1f>
lea    0xecb(%rip),%rsi
mov    $0x1,%edi
call   1030 <errorp@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"out of space\00"
define i8* @alloc(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %4
store i8* %9, i8** %2
br label %12
10: ; preds = %1
%11 = call i32 @errorp(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [13 x i8] c"out of space\00"
define noalias i8* @alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @errorp(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int lw_sock_peek(int *, int);
int lw_netkey_peek(int *sock, int num) {
  int result;
  result = lw_sock_peek(sock, num * (6 + 2 + 4));
  return result;
}


x86 assembly (clang, -O0):
<lw_netkey_peek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
imul   $0xc,-0xc(%rbp),%esi
call   1030 <lw_sock_peek@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw_netkey_peek>:
shl    $0x2,%esi
lea    (%rsi,%rsi,2),%esi
jmp    1030 <lw_sock_peek@plt>

LLVM IR (-O0):
define i32 @lw_netkey_peek(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 = mul nsw i32 %7, 12
%9 = call i32 @lw_sock_peek(i32* %6, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @lw_netkey_peek(i32* %0, i32 %1) {
%3 = mul nsw i32 %1, 12
%4 = tail call i32 @lw_sock_peek(i32* %0, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CANCEL_ASYNCHRONOUS;
int /*<<< orphan*/ parse_message();
int /*<<< orphan*/ pthread_setcanceltype(int /*<<< orphan*/,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
void *ping() {
  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
  while (1) {
    parse_message();
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<ping>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_setcanceltype@plt>
mov    $0x0,%al
call   1030 <parse_message@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1146 <ping+0x16>

x86 assembly (clang, -O2):
<ping>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <pthread_setcanceltype@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <parse_message@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <ping+0x20>

LLVM IR (-O0):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define i8* @ping() {
%1 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%2 = call i32 @pthread_setcanceltype(i32 %1, i32* null)
br label %3
3: ; preds = %0, %3
%4 = call i32 (...) @parse_message()
%5 = call i32 @sleep(i32 1)
br label %3
}

LLVM IR (-O2):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define noalias i8* @ping() {
%1 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%2 = tail call i32 @pthread_setcanceltype(i32 %1, i32* null)
br label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @parse_message()
%5 = tail call i32 @sleep(i32 1)
br label %3
}
/* Type definitions */
struct vmhd_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct vmhd_t *);
void vmhd_exit(struct vmhd_t *atom) { free(atom); }


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

x86 assembly (clang, -O2):
<vmhd_exit>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.vmhd_t = type { i32 }
define void @vmhd_exit(%struct.vmhd_t* nocapture %0) {
%2 = tail call i32 @free(%struct.vmhd_t* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ freematrix();
int /*<<< orphan*/ freesparse();
void closehyd() {
  freesparse();
  freematrix();
}


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

x86 assembly (clang, -O2):
<closehyd>:
push   %rax
xor    %eax,%eax
call   1030 <freesparse@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <freematrix@plt>

LLVM IR (-O0):
define void @closehyd() {
%1 = call i32 (...) @freesparse()
%2 = call i32 (...) @freematrix()
ret void
}

LLVM IR (-O2):
define void @closehyd() {
%1 = tail call i32 (...) @freesparse()
%2 = tail call i32 (...) @freematrix()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_dvector(double *v, int nl, int nh) { free((char *)(v + nl)); }


x86 assembly (clang, -O0):
<free_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
movslq %esi,%rax
lea    (%rdi,%rax,8),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dvector(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
void restore_state(struct parser *p, struct parse_state *ps) {}


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

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

LLVM IR (-O0):
%struct.parser = type opaque
%struct.parse_state = type opaque
define void @restore_state(%struct.parser* %0, %struct.parse_state* %1) {
%3 = alloca %struct.parser*
%4 = alloca %struct.parse_state*
store %struct.parser* %0, %struct.parser** %3
store %struct.parse_state* %1, %struct.parse_state** %4
ret void
}

LLVM IR (-O2):
%struct.parser = type opaque
%struct.parse_state = type opaque
define void @restore_state(%struct.parser* nocapture %0, %struct.parse_state* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, size_t, int, int /*<<< orphan*/ *);
void write_it(unsigned char *data, size_t len, void *file) {
  fwrite(data, len, 1, (FILE *)file);
}


x86 assembly (clang, -O0):
<write_it>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_it>:
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define void @write_it(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i8*, i8** %6
%10 = bitcast i8* %9 to i32*
%11 = call i32 @fwrite(i8* %7, i64 %8, i32 1, i32* %10)
ret void
}

LLVM IR (-O2):
define void @write_it(i8* nocapture %0, i64 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i32 @fwrite(i8* %0, i64 %1, i32 1, i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ subCopyAnimToScreen(int, int, int /*<<< orphan*/);
void subCopyImageToScreen(int si, int graphic) {
  subCopyAnimToScreen(si, graphic, 0);
}


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

x86 assembly (clang, -O2):
<subCopyImageToScreen>:
xor    %edx,%edx
jmp    1030 <subCopyAnimToScreen@plt>

LLVM IR (-O0):
define void @subCopyImageToScreen(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 i32 @subCopyAnimToScreen(i32 %5, i32 %6, i32 0)
ret void
}

LLVM IR (-O2):
define void @subCopyImageToScreen(i32 %0, i32 %1) {
%3 = tail call i32 @subCopyAnimToScreen(i32 %0, i32 %1, i32 0)
ret void
}
/* Variables and functions */
int U4(unsigned char *);
float R4(unsigned char *p) {
  if (U4(p) == 0x7FC00000)
    return 0.0f;
  return *(float *)p;
}


x86 assembly (clang, -O0):
<R4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <U4@plt>
cmp    $0x7fc00000,%eax
jne    113d <R4+0x2d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    114a <R4+0x3a>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<R4>:
push   %rbx
mov    %rdi,%rbx
call   1030 <U4@plt>
xorps  %xmm0,%xmm0
cmp    $0x7fc00000,%eax
je     1127 <R4+0x17>
movss  (%rbx),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @R4(i8* %0) {
%2 = alloca float
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @U4(i8* %4)
%6 = icmp eq i32 %5, 2143289344
br i1 %6, label %7, label %8
7: ; preds = %1
store float 0.000000e+00, float* %2
br label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to float*
%11 = load float, float* %10
store float %11, float* %2
br label %12
12: ; preds = %8, %7
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @R4(i8* %0) {
%2 = tail call i32 @U4(i8* %0)
%3 = icmp eq i32 %2, 2143289344
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = bitcast i8* %0 to float*
%6 = load float, float* %5
br label %7
7: ; preds = %1, %4
%8 = phi float [ %6, %4 ], [ 0.000000e+00, %1 ]
ret float %8
}
unsigned sum(unsigned n) {
  unsigned i, s = 0;
  for (i = 1; i <= n; i++)
    s += i;
  return s;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     1138 <sum+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <sum+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
je     1118 <sum+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl i32 %0, 1
%5 = add i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
/* Variables and functions */
int umount2(char const *, int /*<<< orphan*/);
int umount(const char *target) { return umount2(target, 0); }


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

x86 assembly (clang, -O2):
<umount>:
xor    %esi,%esi
jmp    1030 <umount2@plt>

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

LLVM IR (-O2):
define i32 @umount(i8* %0) {
%2 = tail call i32 @umount2(i8* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Gettext(char *, char const *, int);
char *gettext(const char *msgid) {
  static char string[8][32000];
  static int index = 0;
  char *buf = string[index++ & 7];
  Gettext(buf, msgid, sizeof(*string));
  return buf;
}


x86 assembly (clang, -O0):
<gettext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x4171e(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x41713(%rip)
and    $0x7,%eax
movslq %eax,%rcx
lea    0x2f06(%rip),%rax
imul   $0x7d00,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x7d00,%edx
call   1030 <Gettext@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettext>:
push   %rbx
mov    %rdi,%rsi
mov    0x41726(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x4171d(%rip)
and    $0x7,%eax
imul   $0x7d00,%rax,%rax
lea    0x2f0c(%rip),%rbx
add    %rax,%rbx
mov    %rbx,%rdi
mov    $0x7d00,%edx
call   1030 <Gettext@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@gettext.string = internal global [8 x [32000 x i8]] zeroinitializer
@gettext.index = internal global i32 0
define i8* @gettext(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i32, i32* @gettext.index
%5 = add nsw i32 %4, 1
store i32 %5, i32* @gettext.index
%6 = and i32 %4, 7
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [8 x [32000 x i8]], [8 x [32000 x i8]]* @gettext.string, i64 0, i64 %7
%9 = getelementptr inbounds [32000 x i8], [32000 x i8]* %8, i64 0, i64 0
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @Gettext(i8* %10, i8* %11, i32 32000)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@gettext.string = internal global [8 x [32000 x i8]] zeroinitializer
@gettext.index = internal unnamed_addr global i32 0
define i8* @gettext(i8* %0) {
%2 = load i32, i32* @gettext.index
%3 = add nsw i32 %2, 1
store i32 %3, i32* @gettext.index
%4 = and i32 %2, 7
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [8 x [32000 x i8]], [8 x [32000 x i8]]* @gettext.string, i64 0, i64 %5, i64 0
%7 = tail call i32 @Gettext(i8* %6, i8* %0, i32 32000)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help(void) {
  printf("help\tthis help\r\n"
         "d\tdisassemble\r\n");
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"help\09this help\0D\0Ad\09disassemble\0D\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"help\09this help\0D\0Ad\09disassemble\0D\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void driver_display_error(char *message) { printf("error: %s\n", message); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"error: %s\0A\00"
define void @driver_display_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ sinh(double);
double stdDuration_SpeedTest(double x) {
  clock_t start = clock();
  sinh(x);
  clock_t stop = clock();
  return (double)(stop - start) / CLOCKS_PER_SEC * 1000;
}


x86 assembly (clang, -O0):
<stdDuration_SpeedTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e87(%rip),%rax
divsd  (%rax),%xmm0
movsd  0xe93(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdDuration_SpeedTest>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <sinh@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2e8f(%rip),%rax
divsd  (%rax),%xmm0
mulsd  0xe9b(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
define double @stdDuration_SpeedTest(double %0) {
%2 = alloca double
%3 = alloca i64
%4 = alloca i64
store double %0, double* %2
%5 = call i64 (...) @clock()
store i64 %5, i64* %3
%6 = load double, double* %2
%7 = call i32 @sinh(double %6)
%8 = call i64 (...) @clock()
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = sub nsw i64 %9, %10
%12 = sitofp i64 %11 to double
%13 = load double, double* @CLOCKS_PER_SEC
%14 = fdiv double %12, %13
%15 = fmul double %14, 1.000000e+03
ret double %15
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
define double @stdDuration_SpeedTest(double %0) {
%2 = tail call i64 (...) @clock()
%3 = tail call i32 @sinh(double %0)
%4 = tail call i64 (...) @clock()
%5 = sub nsw i64 %4, %2
%6 = sitofp i64 %5 to double
%7 = load double, double* @CLOCKS_PER_SEC
%8 = fdiv double %6, %7
%9 = fmul double %8, 1.000000e+03
ret double %9
}
/* Variables and functions */
int parseInt(char *, int);
char *stringToInt(int);
char *wum_div(char *a, char *b) {
  return stringToInt((parseInt(a, 10) / parseInt(b, 10)));
}


x86 assembly (clang, -O0):
<wum_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <parseInt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1030 <parseInt@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <stringToInt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wum_div>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    $0xa,%esi
call   1030 <parseInt@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <parseInt@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <stringToInt@plt>

LLVM IR (-O0):
define i8* @wum_div(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 = call i32 @parseInt(i8* %5, i32 10)
%7 = load i8*, i8** %4
%8 = call i32 @parseInt(i8* %7, i32 10)
%9 = sdiv i32 %6, %8
%10 = call i8* @stringToInt(i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @wum_div(i8* %0, i8* %1) {
%3 = tail call i32 @parseInt(i8* %0, i32 10)
%4 = tail call i32 @parseInt(i8* %1, i32 10)
%5 = sdiv i32 %3, %4
%6 = tail call i8* @stringToInt(i32 %5)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ errMem();
void *realloc(void *, size_t);
void *Realloc(void *ptr, size_t size) {
  void *p = realloc(ptr, size);
  if (!p)
    errMem();
  return p;
}


x86 assembly (clang, -O0):
<Realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <Realloc+0x33>
mov    $0x0,%al
call   1030 <errMem@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Realloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <Realloc+0x15>
xor    %eax,%eax
call   1030 <errMem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @Realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (...) @errMem()
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @Realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @errMem()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void longjmp(jmp_buf env, int val) { exit(0); }


x86 assembly (clang, -O0):
<longjmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<longjmp>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @longjmp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @longjmp(i32 %0, i32 %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef char wchar_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int wcslen(char *);
int main() {
  wchar_t *s = L"; Welcome to TCAX forum http://tcax.rhacg.com\r\n";
  printf("%i\n", wcslen(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <wcslen@plt>
mov    %eax,%esi
lea    0xf74(%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
mov    $0x2f,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i32] [i32 59, i32 32, i32 87, i32 101, i32 108, i32 99, i32 111, i32 109, i32 101, i32 32, i32 116, i32 111, i32 32, i32 84, i32 67, i32 65, i32 88, i32 32, i32 102, i32 111, i32 114, i32 117, i32 109, i32 32, i32 104, i32 116, i32 116, i32 112, i32 58, i32 47, i32 47, i32 116, i32 99, i32 97, i32 120, i32 46, i32 114, i32 104, i32 97, i32 99, i32 103, i32 46, i32 99, i32 111, i32 109, i32 13, i32 10, i32 0]
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* bitcast ([48 x i32]* @.str to i8*), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @wcslen(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 47)
ret i32 0
}
/* Variables and functions */
int rand();
int CoinToss() { return rand() & 1; }


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

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

LLVM IR (-O0):
define i32 @CoinToss() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @CoinToss() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ NP();
int /*<<< orphan*/ VP();
int /*<<< orphan*/ printf(char *);
int S() {
  printf("<S>");
  NP();
  VP();
  printf("</S>");
}


x86 assembly (clang, -O0):
<S>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <NP@plt>
mov    $0x0,%al
call   1050 <VP@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <NP@plt>
xor    %eax,%eax
call   1050 <VP@plt>
lea    0xeb2(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"<S>\00"
@.str.1 = [5 x i8] c"</S>\00"
define i32 @S() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @NP()
%4 = call i32 (...) @VP()
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"<S>\00"
@.str.1 = [5 x i8] c"</S>\00"
define i32 @S() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @NP()
%3 = tail call i32 (...) @VP()
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int age = 20;
  int height = 60;
  printf("I am %d years old.\n", age);
  printf("I am %d inches tall.\n", height);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0x3c,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xece(%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
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x3c,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
store i32 60, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 60)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_subdirname(void) { printf("mips"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"mips\00"
define void @get_subdirname() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void dump_block() {}


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

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

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

LLVM IR (-O2):
define void @dump_block() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int bell_pitch;
};
typedef TYPE_1__ XKeyboardControl;

/* Variables and functions */
void set_XKeyboardControl_bell_pitch(void *_p, int _v) {
  ((XKeyboardControl *)_p)->bell_pitch = (int)_v;
}


x86 assembly (clang, -O0):
<set_XKeyboardControl_bell_pitch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XKeyboardControl_bell_pitch>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyboardControl_bell_pitch(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyboardControl_bell_pitch(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t soft_timer_ticks_to_us(int32_t ticks) {
  return (((int64_t)ticks) * 1000000) / 32768;
}


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

x86 assembly (clang, -O2):
<soft_timer_ticks_to_us>:
imul   $0xf4240,%edi,%ecx
lea    0x7fff(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @soft_timer_ticks_to_us(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000000
%5 = sdiv i32 %4, 32768
ret i32 %5
}

LLVM IR (-O2):
define i32 @soft_timer_ticks_to_us(i32 %0) {
%2 = mul nsw i32 %0, 1000000
%3 = sdiv i32 %2, 32768
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void kmr_free(void *p, size_t sz) {
  ((void)0);
  free(p);
}


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

x86 assembly (clang, -O2):
<kmr_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @kmr_free(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perm(int *, int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a = 3, b = 7;
  perm(&a, &b);
  printf("%d %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <perm@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3,0x4(%rsp)
movl   $0x7,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <perm@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 7, i32* %2
%5 = call i32 @perm(i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}
/* Variables and functions */
void *real_to_prot(const void *real) {
  uintptr_t retval = (uintptr_t)real >> 16;
  retval *= 16;
  retval += (uintptr_t)real & 0xFFFFUL;
  return (void *)retval;
}


x86 assembly (clang, -O0):
<real_to_prot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_to_prot>:
movzwl %di,%eax
shr    $0xc,%rdi
and    $0xfffffffffffffff0,%rdi
add    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @real_to_prot(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = lshr i64 %5, 16
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = mul i64 %7, 16
store i64 %8, i64* %3
%9 = load i8*, i8** %2
%10 = ptrtoint i8* %9 to i64
%11 = and i64 %10, 65535
%12 = load i64, i64* %3
%13 = add i64 %12, %11
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = inttoptr i64 %14 to i8*
ret i8* %15
}

LLVM IR (-O2):
define i8* @real_to_prot(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = lshr i64 %2, 12
%4 = and i64 %3, 4503599627370480
%5 = and i64 %2, 65535
%6 = add nuw nsw i64 %4, %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}
/* Type definitions */
struct xfs_mount {
  int dummy;
};

/* Variables and functions */
void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
%struct.xfs_mount = type { i32 }
define void @xfs_debug(%struct.xfs_mount* nocapture %0, i8* nocapture %1, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putstr_fd(int, char const *);
void ft_putstr(const char *s) { ft_putstr_fd(1, s); }


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

x86 assembly (clang, -O2):
<ft_putstr>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <ft_putstr_fd@plt>

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

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = tail call i32 @ft_putstr_fd(i32 1, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ip(char const *);
int /*<<< orphan*/ line();
int /*<<< orphan*/ name(char const *);
int /*<<< orphan*/ number(unsigned int);
int /*<<< orphan*/ space();
int /*<<< orphan*/ string(char *);
void log_nxdomain(const char server[4], const char *q, unsigned int ttl) {
  string("     nxdomain ");
  ip(server);
  space();
  number(ttl);
  space();
  name(q);
  line();
}


x86 assembly (clang, -O0):
<log_nxdomain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xe86(%rip),%rdi
call   1040 <string@plt>
mov    -0x8(%rbp),%rdi
call   1080 <ip@plt>
mov    $0x0,%al
call   1030 <space@plt>
mov    -0x14(%rbp),%edi
call   1060 <number@plt>
mov    $0x0,%al
call   1030 <space@plt>
mov    -0x10(%rbp),%rdi
call   1050 <name@plt>
mov    $0x0,%al
call   1070 <line@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_nxdomain>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe8d(%rip),%rdi
call   1040 <string@plt>
mov    %rbx,%rdi
call   1080 <ip@plt>
xor    %eax,%eax
call   1030 <space@plt>
mov    %ebp,%edi
call   1060 <number@plt>
xor    %eax,%eax
call   1030 <space@plt>
mov    %r14,%rdi
call   1050 <name@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <line@plt>

LLVM IR (-O0):
@.str = [15 x i8] c" nxdomain \00"
define void @log_nxdomain(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
%7 = call i32 @string(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32 @ip(i8* %8)
%10 = call i32 (...) @space()
%11 = load i32, i32* %6
%12 = call i32 @number(i32 %11)
%13 = call i32 (...) @space()
%14 = load i8*, i8** %5
%15 = call i32 @name(i8* %14)
%16 = call i32 (...) @line()
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c" nxdomain \00"
define void @log_nxdomain(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @string(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @ip(i8* %0)
%6 = tail call i32 (...) @space()
%7 = tail call i32 @number(i32 %2)
%8 = tail call i32 (...) @space()
%9 = tail call i32 @name(i8* %1)
%10 = tail call i32 (...) @line()
ret void
}