xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/);
void initrand() { srand((unsigned)(time(0))); }


x86 assembly (clang, -O0):
<initrand>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initrand>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @initrand() {
%1 = call i64 @time(i32 0)
%2 = trunc i64 %1 to i32
%3 = call i32 @srand(i32 %2)
ret void
}

LLVM IR (-O2):
define void @initrand() {
%1 = tail call i64 @time(i32 0)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
ret void
}
void posix_class2P_ALNUM() {}


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

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

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

LLVM IR (-O2):
define void @posix_class2P_ALNUM() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_auto_mark_appoint(long);
void init_auto_mark_all_appoint(void) {
  long i;
  for (i = 0; i < 64; i++)
    init_auto_mark_appoint(i);
}


x86 assembly (clang, -O0):
<init_auto_mark_all_appoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x40,-0x8(%rbp)
jge    1145 <init_auto_mark_all_appoint+0x35>
mov    -0x8(%rbp),%rdi
call   1030 <init_auto_mark_appoint@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <init_auto_mark_all_appoint+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_auto_mark_all_appoint>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <init_auto_mark_appoint@plt>
add    $0x1,%rbx
cmp    $0x40,%rbx
jne    1120 <init_auto_mark_all_appoint+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @init_auto_mark_all_appoint() {
%1 = alloca i64
store i64 0, i64* %1
br label %2
2: ; preds = %8, %0
%3 = load i64, i64* %1
%4 = icmp slt i64 %3, 64
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i64, i64* %1
%7 = call i32 @init_auto_mark_appoint(i64 %6)
br label %8
8: ; preds = %5
%9 = load i64, i64* %1
%10 = add nsw i64 %9, 1
store i64 %10, i64* %1
br label %2
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @init_auto_mark_all_appoint() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @init_auto_mark_appoint(i64 %2)
%4 = add nuw nsw i64 %2, 1
%5 = icmp eq i64 %4, 64
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_INTEGER;

/* Variables and functions */
int /*<<< orphan*/ ASN1_INTEGER_it;
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void ASN1_INTEGER_free(ASN1_INTEGER *a) {
  ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it);
}


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

x86 assembly (clang, -O2):
<ASN1_INTEGER_free>:
mov    0x2ed1(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@ASN1_INTEGER_it = global i32 0
define void @ASN1_INTEGER_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @ASN1_INTEGER_it)
ret void
}

LLVM IR (-O2):
@ASN1_INTEGER_it = global i32 0
define void @ASN1_INTEGER_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @ASN1_INTEGER_it)
ret void
}
int fun1043() { return 1043; }


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

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

LLVM IR (-O0):
define i32 @fun1043() {
ret i32 1043
}

LLVM IR (-O2):
define i32 @fun1043() {
ret i32 1043
}
AR0IR1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[10000000]) = (*p1); }


x86 assembly (clang, -O0):
<AR0IR1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cx
mov    -0x18(%rbp),%rax
mov    %cx,0x1312d00(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0IR1>:
movzwl (%r9),%eax
mov    %ax,0x1312d00(%r8)
01
ret

LLVM IR (-O0):
define i32 @AR0IR1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %13
%17 = load i16, i16* %16
%18 = load i16*, i16** %12
%19 = getelementptr inbounds i16, i16* %18, i64 10000000
store i16 %17, i16* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @AR0IR1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture %5) {
%7 = load i16, i16* %5
%8 = getelementptr inbounds i16, i16* %4, i64 10000000
store i16 %7, i16* %8
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *);
void initpower(double *power) {
  printf("New power?\n");
  scanf("%lf%*[^\n]", power);
  getchar();
}


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

x86 assembly (clang, -O2):
<initpower>:
push   %rbx
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <getchar@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"New power?\0A\00"
@.str.1 = [10 x i8] c"%lf%*[^\0A]\00"
define void @initpower(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load double*, double** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %4)
%6 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%lf%*[^\0A]\00"
@str = [11 x i8] c"New power?\00"
define void @initpower(double* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %0)
%4 = tail call i32 (...) @getchar()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main(void) {
  FILE *fp;
  fp = fopen("apple", "w");
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"apple\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fclose(i32* %1)
ret i32 0
}
int f16(int x, int y) {
  if (y > -17 && y < 0)
    return x % -y;
  return 34;
}


x86 assembly (clang, -O0):
<f16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xffffffef,-0xc(%rbp)
jle    1131 <f16+0x31>
cmpl   $0x0,-0xc(%rbp)
jge    1131 <f16+0x31>
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    1138 <f16+0x38>
movl   $0x22,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f16>:
mov    $0x22,%eax
cmp    $0xfffffff0,%esi
jb     1113 <f16+0x13>
neg    %esi
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @f16(i32 %0, i32 %1) {
%3 = icmp ugt i32 %1, -17
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = sub nsw i32 0, %1
%6 = srem i32 %0, %5
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ 34, %2 ]
ret i32 %8
}
char getTitle() {
  char title[140];
  printf("What is the title?\n");
  scanf("%s", title);
  return title;
}


x86 assembly (clang, -O0):
<getTitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x90(%rbp),%rax
movsbl %al,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTitle>:
push   %rbx
sub    $0x90,%rsp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %ebx,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"What is the title?\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define signext i8 @getTitle() {
%1 = alloca [140 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%6 = ptrtoint i8* %5 to i8
ret i8 %6
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [19 x i8] c"What is the title?\00"
define signext i8 @getTitle() {
%1 = alloca [140 x i8]
%2 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = ptrtoint [140 x i8]* %1 to i64
%6 = trunc i64 %5 to i8
ret i8 %6
}
void smp_mb(void) { __sync_synchronize(); }


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

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

LLVM IR (-O0):
define void @smp_mb() {
fence seq_cst
ret void
}

LLVM IR (-O2):
define void @smp_mb() {
fence seq_cst
ret void
}
IR0I1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ (*p0) = 33; }


x86 assembly (clang, -O0):
<IR0I1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x21,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0I1>:
movl   $0x21,(%r8)
ret

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

LLVM IR (-O2):
define i32 @IR0I1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture readnone %5) {
store i32 33, i32* %4
ret i32 undef
}
void test4_OtherInterrupts_other_enable__E() {}


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

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

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

LLVM IR (-O2):
define void @test4_OtherInterrupts_other_enable__E() {
ret void
}
int ls_costN_nm4_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @ls_costN_nm4_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @ls_costN_nm4_n_out() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) {
  if (ptr == NULL)
    fatal("xfree: NULL pointer given as argument");
  free(ptr);
}


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <xfree+0x23>
lea    0xec2(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <xfree+0x15>
lea    0xed0(%rip),%rdi
call   1040 <fatal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"xfree: NULL pointer given as argument\00"
define void @xfree(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 @fatal(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"xfree: NULL pointer given as argument\00"
define void @xfree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @fatal(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int __builtin_wasm_atomic_wait_i32(int *, int, long long);
int atomic_wait_i32(int *addr, int expected, long long timeout) {
  return __builtin_wasm_atomic_wait_i32(addr, expected, timeout);
}


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

x86 assembly (clang, -O2):
<atomic_wait_i32>:
jmp    1030 <__builtin_wasm_atomic_wait_i32@plt>

LLVM IR (-O0):
define i32 @atomic_wait_i32(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i32 @__builtin_wasm_atomic_wait_i32(i32* %7, i32 %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @atomic_wait_i32(i32* %0, i32 %1, i64 %2) {
%4 = tail call i32 @__builtin_wasm_atomic_wait_i32(i32* %0, i32 %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t *write_u32(uint8_t *p, const uint16_t v) {
  *p++ = (v >> 24) & 0xFF;
  *p++ = (v >> 16) & 0xFF;
  *p++ = (v >> 8) & 0xFF;
  *p++ = (v >> 0) & 0xFF;
  return (p);
}


x86 assembly (clang, -O0):
<write_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_u32>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rdi)
mov    %edx,0x8(%rdi)
mov    %esi,0xc(%rdi)
lea    0x10(%rdi),%rax
ret

LLVM IR (-O0):
define i32* @write_u32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 24
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i32 1
store i32* %9, i32** %3
store i32 %7, i32* %8
%10 = load i32, i32* %4
%11 = ashr i32 %10, 16
%12 = and i32 %11, 255
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %3
store i32 %12, i32* %13
%15 = load i32, i32* %4
%16 = ashr i32 %15, 8
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i32 1
store i32* %19, i32** %3
store i32 %17, i32* %18
%20 = load i32, i32* %4
%21 = ashr i32 %20, 0
%22 = and i32 %21, 255
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i32 1
store i32* %24, i32** %3
store i32 %22, i32* %23
%25 = load i32*, i32** %3
ret i32* %25
}

LLVM IR (-O2):
define i32* @write_u32(i32* writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %0
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %6, i32* %4
%8 = lshr i32 %1, 8
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %9, i32* %7
%11 = and i32 %1, 255
%12 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %11, i32* %10
ret i32* %12
}
void fname(src, dst) char *src, *dst;
{
  char *p;
  strcpy(dst, src);
  p = &dst[strlen(src) - strlen(",S")];
  if (!strcmp(p, ",S"))
    *p = '\0';
}


x86 assembly (clang, -O0):
<fname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
sub    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1190 <fname+0x60>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fname>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rax,%r14,1),%rbx
add    $0xfffffffffffffffe,%rbx
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    116b <fname+0x3b>
movb   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c",S\00"
define void @fname(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @strcpy(i8* %6, i8* %7)
%9 = load i8*, i8** %4
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = sub i64 %11, 2
%13 = getelementptr inbounds i8, i8* %9, i64 %12
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = load i8*, i8** %5
store i8 0, i8* %18
br label %19
19: ; preds = %17, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c",S\00"
define void @fname(i8* nocapture %0, i8* %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %1, i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add i64 %4, -2
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8 0, i8* %6
br label %10
10: ; preds = %9, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
char *strrchr(char *, char);
void PathRenameExtensionA(char *path, const char *more) {
  ;
  char *dot = strrchr(path, '.');
  if (!dot) {
    dot = path + strlen(path);
  }
  strcpy(dot, more);
}


x86 assembly (clang, -O0):
<PathRenameExtensionA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117e <PathRenameExtensionA+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PathRenameExtensionA>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
jne    1156 <PathRenameExtensionA+0x26>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
add    %rbx,%rax
mov    %rax,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define void @PathRenameExtensionA(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i8* @strrchr(i8* %6, i8 signext 46)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
store i8* %15, i8** %5
br label %16
16: ; preds = %10, %2
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %17, i8* %18)
ret void
}

LLVM IR (-O2):
define void @PathRenameExtensionA(i8* %0, i8* %1) {
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ %3, %2 ], [ %8, %5 ]
%11 = tail call i32 @strcpy(i8* %10, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
void make_filename(const char *name, char *filename) {
  strcpy(filename, name);
  strcat(filename, ".so");
}


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

x86 assembly (clang, -O2):
<make_filename>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strcat@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c".so\00"
define void @make_filename(i8* %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %1, i8* %0)
%4 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
int SDL_imageFilterShiftRightMMX(unsigned char *Src1, unsigned char *Dest,
                                 int length, unsigned char N,
                                 unsigned char *Mask) {
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterShiftRightMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    %r8,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SDL_imageFilterShiftRightMMX(i8* %0, i8* %1, i32 %2, i8 zeroext %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8 %3, i8* %9
store i8* %4, i8** %10
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterShiftRightMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i8 zeroext %3, i8* nocapture readnone %4) {
ret i32 0
}
/* Type definitions */
struct quat {
  int dummy;
};
struct mat3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat3_rotation_quaternion(float *, float *);
__attribute__((always_)) struct mat3 *
psmat3_rotation_quaternion(struct mat3 *result, struct quat *q) {
  mat3_rotation_quaternion((float *)result, (float *)q);
  return result;
}


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

x86 assembly (clang, -O2):
<psmat3_rotation_quaternion>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mat3_rotation_quaternion@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.mat3 = type { i32 }
%struct.quat = type { i32 }
define %struct.mat3* @psmat3_rotation_quaternion(%struct.mat3* %0, %struct.quat* %1) {
%3 = alloca %struct.mat3*
%4 = alloca %struct.quat*
store %struct.mat3* %0, %struct.mat3** %3
store %struct.quat* %1, %struct.quat** %4
%5 = load %struct.mat3*, %struct.mat3** %3
%6 = bitcast %struct.mat3* %5 to float*
%7 = load %struct.quat*, %struct.quat** %4
%8 = bitcast %struct.quat* %7 to float*
%9 = call i32 @mat3_rotation_quaternion(float* %6, float* %8)
%10 = load %struct.mat3*, %struct.mat3** %3
ret %struct.mat3* %10
}

LLVM IR (-O2):
%struct.mat3 = type { i32 }
%struct.quat = type { i32 }
define %struct.mat3* @psmat3_rotation_quaternion(%struct.mat3* returned %0, %struct.quat* %1) {
%3 = bitcast %struct.mat3* %0 to float*
%4 = bitcast %struct.quat* %1 to float*
%5 = tail call i32 @mat3_rotation_quaternion(float* %3, float* %4)
ret %struct.mat3* %0
}
/* Variables and functions */
char *ptsname(int);
int ptsname_compat(int fd, char **buf) {
  if ((*buf = ptsname(fd)) == NULL)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ptsname_compat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ptsname@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1144 <ptsname_compat+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    114b <ptsname_compat+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptsname_compat>:
push   %rbx
mov    %rsi,%rbx
call   1030 <ptsname@plt>
mov    %rax,(%rbx)
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ptsname_compat(i32 %0, i8** nocapture writeonly %1) {
%3 = tail call i8* @ptsname(i32 %0)
store i8* %3, i8** %1
%4 = icmp eq i8* %3, null
%5 = sext i1 %4 to i32
ret i32 %5
}
void foo353() {}


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

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

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

LLVM IR (-O2):
define void @foo353() {
ret void
}
int fun1283() { return 1283; }


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

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

LLVM IR (-O0):
define i32 @fun1283() {
ret i32 1283
}

LLVM IR (-O2):
define i32 @fun1283() {
ret i32 1283
}
/* Variables and functions */
int get2();
int get4();
unsigned getint(int type) { return type == 3 ? get2() : get4(); }


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    1144 <getint+0x24>
mov    $0x0,%al
call   1040 <get2@plt>
mov    %eax,-0x8(%rbp)
jmp    114e <getint+0x2e>
mov    $0x0,%al
call   1030 <get4@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
xor    %eax,%eax
cmp    $0x3,%edi
jne    112c <getint+0xc>
jmp    1040 <get2@plt>
jmp    1030 <get4@plt>

LLVM IR (-O0):
define i32 @getint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @get2()
br label %9
7: ; preds = %1
%8 = call i32 (...) @get4()
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @getint(i32 %0) {
%2 = icmp eq i32 %0, 3
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @get2()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @get4()
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %4, %3 ], [ %6, %5 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ _bad_return_address(int);
void bad_return_l1dataB(void) { _bad_return_address(0xFF900000); }


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

x86 assembly (clang, -O2):
<bad_return_l1dataB>:
mov    $0xff900000,%edi
jmp    1030 <_bad_return_address@plt>

LLVM IR (-O0):
define void @bad_return_l1dataB() {
%1 = call i32 @_bad_return_address(i32 -7340032)
ret void
}

LLVM IR (-O2):
define void @bad_return_l1dataB() {
%1 = tail call i32 @_bad_return_address(i32 -7340032)
ret void
}
int factorial(int arg) {
  int result;
  if (arg < 0)
    return -1;
  for (result = 1; result > 0 && arg > 1; arg--) {
    result *= arg;
  }
  if (result <= 0)
    return -1;
  return result;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <factorial+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <factorial+0x81>
movl   $0x1,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    113d <factorial+0x3d>
cmpl   $0x1,-0x8(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    114d <factorial+0x4d>
jmp    1165 <factorial+0x65>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <factorial+0x24>
cmpl   $0x0,-0xc(%rbp)
jg     117b <factorial+0x7b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <factorial+0x81>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
test   %edi,%edi
js     113c <factorial+0x3c>
mov    $0x1,%eax
cmp    $0x2,%edi
jb     113b <factorial+0x3b>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   %edi,%ecx
test   %ecx,%ecx
jle    1131 <factorial+0x31>
lea    -0x1(%rdi),%eax
cmp    $0x2,%edi
mov    %eax,%edi
ja     1120 <factorial+0x20>
test   %ecx,%ecx
mov    $0xffffffff,%eax
cmovg  %ecx,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @factorial(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 1
br i1 %4, label %5, label %16
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 1, %3 ]
%7 = phi i32 [ %9, %5 ], [ %0, %3 ]
%8 = mul nsw i32 %6, %7
%9 = add nsw i32 %7, -1
%10 = icmp sgt i32 %8, 0
%11 = icmp ugt i32 %7, 2
%12 = and i1 %10, %11
br i1 %12, label %5, label %13
13: ; preds = %5
%14 = icmp slt i32 %8, 1
%15 = select i1 %14, i32 -1, i32 %8
br label %16
16: ; preds = %13, %3, %1
%17 = phi i32 [ -1, %1 ], [ 1, %3 ], [ %15, %13 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ charrep(char, int);
int /*<<< orphan*/ printf(char *);
void display_wakeup_footer(void) {
  charrep('-', 44);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<display_wakeup_footer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2d,%edi
mov    $0x2c,%esi
call   1040 <charrep@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_wakeup_footer>:
push   %rax
mov    $0x2d,%edi
mov    $0x2c,%esi
call   1040 <charrep@plt>
lea    0xec9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\0A\00"
define void @display_wakeup_footer() {
%1 = call i32 @charrep(i8 signext 45, i32 44)
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"\0A\00"
define void @display_wakeup_footer() {
%1 = tail call i32 @charrep(i8 signext 45, i32 44)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printUsage(void) {
  printf("./resize n infile outfile\n");
  printf("n - an integer between 1 and 100 inclusive.\n");
  printf("infile - name of file to be resized.\n");
  printf("outfile - name of file to write to.\n");
  return;
}


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

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"./resize n infile outfile\0A\00"
@.str.1 = [45 x i8] c"n - an integer between 1 and 100 inclusive.\0A\00"
@.str.2 = [38 x i8] c"infile - name of file to be resized.\0A\00"
@.str.3 = [37 x i8] c"outfile - name of file to write to.\0A\00"
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [26 x i8] c"./resize n infile outfile\00"
@str.4 = [44 x i8] c"n - an integer between 1 and 100 inclusive.\00"
@str.5 = [37 x i8] c"infile - name of file to be resized.\00"
@str.6 = [36 x i8] c"outfile - name of file to write to.\00"
define void @printUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *strdup(char const *);
char *xstrdup(const char *s) {
  char *result = strdup(s);
  if (result == NULL) {
    fprintf(stderr, "memory exhausted\n");
    fflush(stderr);
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1191 <xstrdup+0x51>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
call   1060 <strdup@plt>
test   %rax,%rax
je     114d <xstrdup+0xd>
pop    %rbx
ret
mov    0x2e8c(%rip),%rbx
mov    (%rbx),%edi
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"memory exhausted\0A\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 @fflush(i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"memory exhausted\0A\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fflush(i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xf3() {
  Assert_real((isalpha(243) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              1220, ("isalpha should be 0 for 0xf3"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xf3>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf3,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4c4,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xf3>:
push   %rax
mov    $0xf3,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4c4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xf3\00"
define void @t_isalpha_0xf3() {
%1 = call i64 @isalpha(i32 243)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1220, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xf3\00"
define void @t_isalpha_0xf3() {
%1 = tail call i64 @isalpha(i32 243)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1220, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
char *mutabor_stpcpy(char *restrict TO, const char *restrict FROM) {
  while (((*(TO++)) = (*(FROM++))))
    ;
  return TO;
}


x86 assembly (clang, -O0):
<mutabor_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113b <mutabor_stpcpy+0x3b>
jmp    110c <mutabor_stpcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutabor_stpcpy>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <mutabor_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @mutabor_stpcpy(i8* noalias writeonly %0, i8* noalias nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %8
}
/* Variables and functions */
double exp(double);
double AUX2bp1a(double x) { return 1.0 + exp(x); }


x86 assembly (clang, -O0):
<AUX2bp1a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUX2bp1a>:
push   %rax
call   1030 <exp@plt>
addsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @AUX2bp1a(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @exp(double %3)
%5 = fadd double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @AUX2bp1a(double %0) {
%2 = tail call double @exp(double %0)
%3 = fadd double %2, 1.000000e+00
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exynos_5410_gpio_write_mask(unsigned int, unsigned int,
                                               unsigned int);
void odroid_xu_gpio_write_22(unsigned int data) {
  unsigned int bank_offset = 0x0C40;
  unsigned int bit_index = 7;
  exynos_5410_gpio_write_mask(bank_offset, ((data & 1U) << bit_index),
                              (1U << bit_index));
}


x86 assembly (clang, -O0):
<odroid_xu_gpio_write_22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xc40,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
and    $0x1,%esi
mov    -0xc(%rbp),%ecx
shl    %cl,%esi
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
call   1030 <exynos_5410_gpio_write_mask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odroid_xu_gpio_write_22>:
shl    $0x7,%edi
movzbl %dil,%esi
mov    $0xc40,%edi
mov    $0x80,%edx
jmp    1030 <exynos_5410_gpio_write_mask@plt>

LLVM IR (-O0):
define void @odroid_xu_gpio_write_22(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 3136, i32* %3
store i32 7, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = and i32 %6, 1
%8 = load i32, i32* %4
%9 = shl i32 %7, %8
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = call i32 @exynos_5410_gpio_write_mask(i32 %5, i32 %9, i32 %11)
ret void
}

LLVM IR (-O2):
define void @odroid_xu_gpio_write_22(i32 %0) {
%2 = shl i32 %0, 7
%3 = and i32 %2, 128
%4 = tail call i32 @exynos_5410_gpio_write_mask(i32 3136, i32 %3, i32 128)
ret void
}
void _TFC4Blog6Authorg10identifierSS() {}


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

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

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

LLVM IR (-O2):
define void @_TFC4Blog6Authorg10identifierSS() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void init_rnd(void) { srand(time(0)); }


x86 assembly (clang, -O0):
<init_rnd>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rnd>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @init_rnd() {
%1 = call i32 @time(i32 0)
%2 = call i32 @srand(i32 %1)
ret void
}

LLVM IR (-O2):
define void @init_rnd() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
ret void
}