xunge/DecIR huggingface dataset:
int stub_ast_sign(struct ast_key *key, char *msg, char *sig) {
  ast_log(2,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/"
          "master/cryptostub.c",
          49, __PRETTY_FUNCTION__, "Crypto support not loaded!\n");
  return -1;
}


x86 assembly (clang, -O0):
<stub_ast_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x2,%edi
lea    0xed0(%rip),%rsi
mov    $0x31,%edx
lea    0xf5b(%rip),%rcx
lea    0xf88(%rip),%r8
mov    $0x0,%al
call   1030 <ast_log@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stub_ast_sign>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xf78(%rip),%rcx
lea    0xfa5(%rip),%r8
mov    $0x2,%edi
mov    $0x31,%edx
xor    %eax,%eax
call   1030 <ast_log@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ast_key = type opaque
@.str = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/master/cryptostub.c\00"
@__PRETTY_FUNCTION__.stub_ast_sign = [52 x i8] c"int stub_ast_sign(struct ast_key *, char *, char *)\00"
@.str.1 = [28 x i8] c"Crypto support not loaded!\0A\00"
define i32 @stub_ast_sign(%struct.ast_key* %0, i8* %1, i8* %2) {
%4 = alloca %struct.ast_key*
%5 = alloca i8*
%6 = alloca i8*
store %struct.ast_key* %0, %struct.ast_key** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = call i32 (i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @ast_log to i32 (i32, i8*, i32, i8*, i8*, ...)*)(i32 2, i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @__PRETTY_FUNCTION__.stub_ast_sign, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
%struct.ast_key = type opaque
@.str = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tpenguin/solarisvoip-asterisk/refs/heads/master/cryptostub.c\00"
@__PRETTY_FUNCTION__.stub_ast_sign = [52 x i8] c"int stub_ast_sign(struct ast_key *, char *, char *)\00"
@.str.1 = [28 x i8] c"Crypto support not loaded!\0A\00"
define i32 @stub_ast_sign(%struct.ast_key* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 (i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @ast_log to i32 (i32, i8*, i32, i8*, i8*, ...)*)(i32 2, i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @__PRETTY_FUNCTION__.stub_ast_sign, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
ret i32 -1
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  int tv_sec;
};

/* Variables and functions */
unsigned int ts_to_ms(struct timespec *ts) {
  return ts->tv_nsec / 1000 / 1000 + ts->tv_sec * 1000;
}


x86 assembly (clang, -O0):
<ts_to_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rcx
imul   $0x3e8,0x4(%rcx),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_to_ms>:
movslq (%rdi),%rax
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x32,%rcx
add    %eax,%ecx
imul   $0x3e8,0x4(%rdi),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @ts_to_ms(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = sdiv i32 %5, 1000
%7 = sdiv i32 %6, 1000
%8 = load %struct.timespec*, %struct.timespec** %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define i32 @ts_to_ms(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 1000000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = add nsw i32 %7, %4
ret i32 %8
}
int shift_off_sf(int x, int o, int a) { return ((x + o) >> a); }


x86 assembly (clang, -O0):
<shift_off_sf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_off_sf>:
mov    %edx,%ecx
lea    (%rdi,%rsi,1),%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @shift_off_sf(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = ashr i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @shift_off_sf(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = ashr i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int ints[], int len) {
  int i;
  for (i = 0; i < len; i++) {
    printf("[%d]", ints[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"[%d]\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(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 = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
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
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"[%d]\00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
void free_dvector(v, nl, nh) double *v;
int nl, 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*
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*
tail call void @free(i8* %6)
ret void
}
unsigned int _extu(unsigned int src2, unsigned int csta, unsigned int cstb) {
  return (src2 << csta) >> cstb;
}


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

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

LLVM IR (-O0):
define i32 @_extu(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = shl i32 %7, %8
%10 = load i32, i32* %6
%11 = lshr i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @_extu(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, %1
%5 = lshr i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void print_int_array(int array[], int sizeof_array) {
  int i;
  for (i = 0; i < sizeof_array; i++) {
    printf("%d: %d\n", i, array[i]);
  }
}


x86 assembly (clang, -O0):
<print_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <print_int_array+0x4a>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_int_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <print_int_array+0x37>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_int_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d: %d\0A\00"
define void @print_int_array(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 = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d: %d\0A\00"
define void @print_int_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
int dasm_analyzer(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @dasm_analyzer() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ M_StopMovie();
void Command_StopMovie_f(void) { M_StopMovie(); }


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

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

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

LLVM IR (-O2):
define void @Command_StopMovie_f() {
%1 = tail call i32 (...) @M_StopMovie()
ret void
}
void Call_C_Stop(char *fct_name, int nb_args, char **p_) {}


x86 assembly (clang, -O0):
<Call_C_Stop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Call_C_Stop(i8* nocapture %0, i32 %1, i8** nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void ehelp(char *nome) {
  fprintf(stderr, "Uso: %s numero_di_password\n", nome);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<ehelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ehelp>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Uso: %s numero_di_password\0A\00"
@EXIT_FAILURE = global i32 0
define void @ehelp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Uso: %s numero_di_password\0A\00"
@EXIT_FAILURE = global i32 0
define void @ehelp(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int write(int, int /*<<< orphan*/ const *, size_t);
int write_to(int fd, const uint8_t *buffer, size_t size) {
  int ret = write(fd, buffer, size);
  if (ret == -1 || ret != size)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<write_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     114e <write_to+0x3e>
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     115a <write_to+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1161 <write_to+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to>:
push   %rbx
mov    %rdx,%rbx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
sete   %cl
cltq
cmp    %rbx,%rax
setne  %al
or     %cl,%al
movzbl %al,%eax
neg    %eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @write_to(i32 %0, i32* nocapture %1, i64 %2) {
%4 = tail call i32 @write(i32 %0, i32* %1, i64 %2)
%5 = icmp eq i32 %4, -1
%6 = sext i32 %4 to i64
%7 = icmp ne i64 %6, %2
%8 = or i1 %5, %7
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f3() { printf("Hello! You have invoked f3().\n"); }


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"Hello! You have invoked f3().\0A\00"
define void @f3() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"Hello! You have invoked f3().\00"
define void @f3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_mbind;
int syscall(int /*<<< orphan*/, void *, unsigned long, int, unsigned long *,
            unsigned long, unsigned int);
int mbind(void *addr, unsigned long len, int mode, unsigned long *nodemask,
          unsigned long maxnode, unsigned flags) {
  return syscall(__NR_mbind, addr, len, mode, nodemask, maxnode, flags);
}


x86 assembly (clang, -O0):
<mbind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x2c(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <syscall@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbind>:
push   %rax
mov    %r8,%rax
mov    %rcx,%r8
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2eba(%rip),%rdi
mov    (%rdi),%edi
mov    %r9d,(%rsp)
mov    %rax,%r9
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__NR_mbind = global i32 0
define i32 @mbind(i8* %0, i64 %1, i32 %2, i64* %3, i64 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i64*
%11 = alloca i64
%12 = alloca i32
store i8* %0, i8** %7
store i64 %1, i64* %8
store i32 %2, i32* %9
store i64* %3, i64** %10
store i64 %4, i64* %11
store i32 %5, i32* %12
%13 = load i32, i32* @__NR_mbind
%14 = load i8*, i8** %7
%15 = load i64, i64* %8
%16 = load i32, i32* %9
%17 = load i64*, i64** %10
%18 = load i64, i64* %11
%19 = load i32, i32* %12
%20 = call i32 @syscall(i32 %13, i8* %14, i64 %15, i32 %16, i64* %17, i64 %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
@__NR_mbind = global i32 0
define i32 @mbind(i8* %0, i64 %1, i32 %2, i64* %3, i64 %4, i32 %5) {
%7 = load i32, i32* @__NR_mbind
%8 = tail call i32 @syscall(i32 %7, i8* %0, i64 %1, i32 %2, i64* %3, i64 %4, i32 %5)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clr_scr() { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @clr_scr() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XComposeStatus;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XComposeStatus(void *_p) {
  if (_p == NULL)
    abort();
  free((XComposeStatus *)_p);
}


x86 assembly (clang, -O0):
<free_XComposeStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XComposeStatus+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XComposeStatus>:
test   %rdi,%rdi
je     112a <free_XComposeStatus+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XComposeStatus(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XComposeStatus(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void status(char *status) { printf("Status: %s\n", status); }


x86 assembly (clang, -O0):
<status>:
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):
<status>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"Status: %s\0A\00"
define void @status(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int standard_Newton_step(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(199, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<standard_Newton_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xc7,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_Newton_step>:
mov    $0xc7,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @standard_Newton_step() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 199, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @standard_Newton_step() {
%1 = tail call i32 @_ada_use_c2phc(i32 199, i32* undef, i32* undef, double* undef)
ret i32 %1
}
void ext4bf_xattr_put_super(struct super_block *sb) {}


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

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

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

LLVM IR (-O2):
%struct.super_block = type opaque
define void @ext4bf_xattr_put_super(%struct.super_block* nocapture %0) {
ret void
}
/* Variables and functions */
int cmp_double_array_idxs(void *, void const *, void const *);
int rcmp_double_array_idxs(void *qsort_thunk_vp, const void *xvp,
                           const void *yvp) {
  return -1 * cmp_double_array_idxs(qsort_thunk_vp, xvp, yvp);
}


x86 assembly (clang, -O0):
<rcmp_double_array_idxs>:
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),%rdx
call   1030 <cmp_double_array_idxs@plt>
imul   $0xffffffff,%eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcmp_double_array_idxs>:
push   %rax
call   1030 <cmp_double_array_idxs@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rcmp_double_array_idxs(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @cmp_double_array_idxs(i8* %7, i8* %8, i8* %9)
%11 = mul nsw i32 -1, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @rcmp_double_array_idxs(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @cmp_double_array_idxs(i8* %0, i8* %1, i8* %2)
%5 = sub nsw i32 0, %4
ret i32 %5
}
void main(void) {
  int x[10];
  int y;
  int w;
  w = x[y];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %5
%7 = load i32, i32* %6
store i32 %7, i32* %3
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ strx_printv(int *, char *, size_t, char const *,
                               int /*<<< orphan*/);
extern int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap) {
  int cc;
  strx_printv(&cc, buf, (len - 1), format, ap);
  return (cc);
}


x86 assembly (clang, -O0):
<ap_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
lea    -0x20(%rbp),%rdi
call   1030 <strx_printv@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_vsnprintf>:
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rdi,%rax
lea    -0x1(%rsi),%rdx
lea    0x4(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strx_printv@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ap_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = sub i64 %11, 1
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @strx_printv(i32* %9, i8* %10, i64 %12, i8* %13, i32 %14)
%16 = load i32, i32* %9
ret i32 %16
}

LLVM IR (-O2):
define i32 @ap_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = add i64 %1, -1
%8 = call i32 @strx_printv(i32* %5, i8* %0, i64 %7, i8* %2, i32 %3)
%9 = load i32, i32* %5
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ disable_interrupts_test();
int /*<<< orphan*/ enable_interrupts_test();
int /*<<< orphan*/ halt_test();
int /*<<< orphan*/ input_test();
int /*<<< orphan*/ nop_test();
int /*<<< orphan*/ output_test();
int main(int argc, const char *argv[]) {
  input_test();
  output_test();
  enable_interrupts_test();
  disable_interrupts_test();
  halt_test();
  nop_test();
  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)
mov    $0x0,%al
call   1080 <input_test@plt>
mov    $0x0,%al
call   1040 <output_test@plt>
mov    $0x0,%al
call   1060 <enable_interrupts_test@plt>
mov    $0x0,%al
call   1050 <disable_interrupts_test@plt>
mov    $0x0,%al
call   1030 <halt_test@plt>
mov    $0x0,%al
call   1070 <nop_test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <input_test@plt>
xor    %eax,%eax
call   1040 <output_test@plt>
xor    %eax,%eax
call   1060 <enable_interrupts_test@plt>
xor    %eax,%eax
call   1050 <disable_interrupts_test@plt>
xor    %eax,%eax
call   1030 <halt_test@plt>
xor    %eax,%eax
call   1070 <nop_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 (...) @input_test()
%7 = call i32 (...) @output_test()
%8 = call i32 (...) @enable_interrupts_test()
%9 = call i32 (...) @disable_interrupts_test()
%10 = call i32 (...) @halt_test()
%11 = call i32 (...) @nop_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @input_test()
%4 = tail call i32 (...) @output_test()
%5 = tail call i32 (...) @enable_interrupts_test()
%6 = tail call i32 (...) @disable_interrupts_test()
%7 = tail call i32 (...) @halt_test()
%8 = tail call i32 (...) @nop_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_red(void) {
  printf("The SCHED library is not included in this build\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"The SCHED library is not included in this build\0A\00"
define i32 @test_red() {
%1 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [48 x i8] c"The SCHED library is not included in this build\00"
define i32 @test_red() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void cant(char *s) { fprintf(stderr, "%s: cannot open\n", s); }


x86 assembly (clang, -O0):
<cant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cant>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"%s: cannot open\0A\00"
define void @cant(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"%s: cannot open\0A\00"
define void @cant(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int my_nint(double in) {
  if (in < 0)
    return (int)(in - 0.5);
  else
    return (int)(in + 0.5);
}


x86 assembly (clang, -O0):
<my_nint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1134 <my_nint+0x34>
movsd  -0x10(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <my_nint+0x48>
movsd  0xec4(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_nint>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @my_nint(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fsub double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fadd double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @my_nint(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Type definitions */
struct clad_sb {
  int dummy;
};

/* Variables and functions */
struct clad_sb *clad_sb_init_buf(struct clad_sb *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
struct clad_sb *clad_sb_init_cstr(struct clad_sb *me, char *str) {
  return clad_sb_init_buf(me, str, strlen(str));
}


x86 assembly (clang, -O0):
<clad_sb_init_cstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <clad_sb_init_buf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clad_sb_init_cstr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <clad_sb_init_buf@plt>

LLVM IR (-O0):
%struct.clad_sb = type { i32 }
define %struct.clad_sb* @clad_sb_init_cstr(%struct.clad_sb* %0, i8* %1) {
%3 = alloca %struct.clad_sb*
%4 = alloca i8*
store %struct.clad_sb* %0, %struct.clad_sb** %3
store i8* %1, i8** %4
%5 = load %struct.clad_sb*, %struct.clad_sb** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call %struct.clad_sb* @clad_sb_init_buf(%struct.clad_sb* %5, i8* %6, i32 %8)
ret %struct.clad_sb* %9
}

LLVM IR (-O2):
%struct.clad_sb = type { i32 }
define %struct.clad_sb* @clad_sb_init_cstr(%struct.clad_sb* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call %struct.clad_sb* @clad_sb_init_buf(%struct.clad_sb* %0, i8* %1, i32 %3)
ret %struct.clad_sb* %4
}
long long suzz() { return 0xffff7fff00000000LL; }


x86 assembly (clang, -O0):
<suzz>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffff7fff00000000,%rax
7f ff ff
pop    %rbp
ret

x86 assembly (clang, -O2):
<suzz>:
movabs $0xffff7fff00000000,%rax
7f ff ff
ret

LLVM IR (-O0):
define i64 @suzz() {
ret i64 -140741783322624
}

LLVM IR (-O2):
define i64 @suzz() {
ret i64 -140741783322624
}
/* Variables and functions */
int /*<<< orphan*/ writeUARTChar(char);
void writeString(char *s) {
  while (*s) {
    writeUARTChar(*s);
    ++s;
  }
}


x86 assembly (clang, -O0):
<writeString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <writeString+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <writeUARTChar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <writeString+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeString>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <writeString+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <writeUARTChar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <writeString+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @writeString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = call i32 @writeUARTChar(i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @writeString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @writeUARTChar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int atoi(char *);
int fib(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int n;
  char *arg1 = argv[1];
  if (arg1 == NULL) {
    n = 10;
  } else {
    n = atoi(arg1);
  }
  printf("%d\n", fib(n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1169 <main+0x39>
movl   $0xa,-0x14(%rbp)
jmp    1175 <main+0x45>
mov    -0x20(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <fib@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1143 <main+0x13>
call   1050 <atoi@plt>
mov    %eax,%edi
jmp    1148 <main+0x18>
mov    $0xa,%edi
call   1040 <fib@plt>
lea    0xeac(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ tx_bytes(unsigned char *, int);
void set_sample_period(unsigned period) {
  unsigned char d[4];
  d[0] = (4 << 5) + 0x1F;
  d[1] = 0x04;
  d[2] = (unsigned char)((period >> 8) & 0xff);
  d[3] = (unsigned char)(period & 0xff);
  tx_bytes(d, sizeof(d));
}


x86 assembly (clang, -O0):
<set_sample_period>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x9f,-0x8(%rbp)
movb   $0x4,-0x7(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x5(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <tx_bytes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sample_period>:
push   %rax
mov    %edi,%eax
movw   $0x49f,0x4(%rsp)
mov    %ah,0x6(%rsp)
mov    %al,0x7(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <tx_bytes@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @set_sample_period(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 -97, i8* %4
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 4, i8* %5
%6 = load i32, i32* %2
%7 = lshr i32 %6, 8
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %9, i8* %10
%11 = load i32, i32* %2
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%16 = call i32 @tx_bytes(i8* %15, i32 4)
ret void
}

LLVM IR (-O2):
define void @set_sample_period(i32 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
store i8 -97, i8* %3
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 4, i8* %4
%5 = lshr i32 %0, 8
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %6, i8* %7
%8 = trunc i32 %0 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 %8, i8* %9
%10 = call i32 @tx_bytes(i8* %3, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dtoi(float);
int /*<<< orphan*/ g2_circle(int /*<<< orphan*/, float, float, float);
void g2_circle_(float *dev, float *x, float *y, float *r) {
  g2_circle(dtoi(*dev), *x, *y, *r);
}


x86 assembly (clang, -O0):
<g2_circle_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1040 <dtoi@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm2
call   1030 <g2_circle@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_circle_>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
movss  (%rdi),%xmm0
call   1040 <dtoi@plt>
movss  (%rbx),%xmm0
movss  (%r15),%xmm1
movss  (%r14),%xmm2
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <g2_circle@plt>

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

LLVM IR (-O2):
define void @g2_circle_(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3) {
%5 = load float, float* %0
%6 = tail call i32 @dtoi(float %5)
%7 = load float, float* %1
%8 = load float, float* %2
%9 = load float, float* %3
%10 = tail call i32 @g2_circle(i32 %6, float %7, float %8, float %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Scheme_Shutdown();
int /*<<< orphan*/ Sscheme_deinit();
void WSQ_Shutdown() {
  Scheme_Shutdown();
  Sscheme_deinit();
}


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

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

LLVM IR (-O0):
define void @WSQ_Shutdown() {
%1 = call i32 (...) @Scheme_Shutdown()
%2 = call i32 (...) @Sscheme_deinit()
ret void
}

LLVM IR (-O2):
define void @WSQ_Shutdown() {
%1 = tail call i32 (...) @Scheme_Shutdown()
%2 = tail call i32 (...) @Sscheme_deinit()
ret void
}
int leap_years_to_end(int tm_year) {
  int leap_years = 0;
  leap_years += (tm_year / 4);
  leap_years -= (tm_year / 100);
  leap_years += ((tm_year + 300) / 400);
  return leap_years;
}


x86 assembly (clang, -O0):
<leap_years_to_end>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x12c,%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leap_years_to_end>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x2,%eax
movslq %edi,%rcx
imul   $0xffffffffae147ae1,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
add    %eax,%edx
add    $0x12c,%ecx
movslq %ecx,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rax
add    %ecx,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @leap_years_to_end(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, %5
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 100
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 300
%14 = sdiv i32 %13, 400
%15 = load i32, i32* %3
%16 = add nsw i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @leap_years_to_end(i32 %0) {
%2 = sdiv i32 %0, 4
%3 = sdiv i32 %0, -100
%4 = add nsw i32 %3, %2
%5 = add nsw i32 %0, 300
%6 = sdiv i32 %5, 400
%7 = add nsw i32 %4, %6
ret i32 %7
}
void GC_fault_handler(int sig) {}


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

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

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

LLVM IR (-O2):
define void @GC_fault_handler(i32 %0) {
ret void
}
void trap_is_kprobe(unsigned long cause, unsigned long address,
                    struct pt_regs *regs) {}


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

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

LLVM IR (-O0):
%struct.pt_regs = type opaque
define void @trap_is_kprobe(i64 %0, i64 %1, %struct.pt_regs* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca %struct.pt_regs*
store i64 %0, i64* %4
store i64 %1, i64* %5
store %struct.pt_regs* %2, %struct.pt_regs** %6
ret void
}

LLVM IR (-O2):
%struct.pt_regs = type opaque
define void @trap_is_kprobe(i64 %0, i64 %1, %struct.pt_regs* nocapture %2) {
ret void
}