xunge/DecIR huggingface dataset:
/* Variables and functions */
double sqrt(int);
double CircularEaseIn(double p) { return 1 - sqrt(1 - (p * p)); }


x86 assembly (clang, -O0):
<CircularEaseIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CircularEaseIn>:
push   %rax
mulsd  %xmm0,%xmm0
movsd  0xee3(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sqrt@plt>
movsd  0xece(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @CircularEaseIn(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fneg double %3
%6 = call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
%7 = fptosi double %6 to i32
%8 = call double @sqrt(i32 %7)
%9 = fsub double 1.000000e+00, %8
ret double %9
}

LLVM IR (-O2):
define double @CircularEaseIn(double %0) {
%2 = fneg double %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double 1.000000e+00)
%4 = fptosi double %3 to i32
%5 = tail call double @sqrt(i32 %4)
%6 = fsub double 1.000000e+00, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ SendFrame(int, unsigned char *, unsigned char *, int);
void SendLTFrame(int newtFd, unsigned char seqNo, unsigned char *info,
                 int infoLen) {
  unsigned char ltFrameHead[3] = {
      '\x02',
      '\x04',
  };
  ltFrameHead[2] = seqNo;
  SendFrame(newtFd, ltFrameHead, info, infoLen);
  return;
}


x86 assembly (clang, -O0):
<SendLTFrame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0xed1(%rip),%ax
mov    %ax,-0x17(%rbp)
mov    0xec9(%rip),%al
mov    %al,-0x15(%rbp)
mov    -0x5(%rbp),%al
mov    %al,-0x15(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x17(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <SendFrame@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendLTFrame>:
push   %rax
movw   $0x402,0x4(%rsp)
mov    %sil,0x6(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <SendFrame@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.SendLTFrame.ltFrameHead = [3 x i8] c"\02\04\00"
define void @SendLTFrame(i32 %0, i8 zeroext %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [3 x i8]
store i32 %0, i32* %5
store i8 %1, i8* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = bitcast [3 x i8]* %9 to i8*
%11 = load i8, i8* %6
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 2
store i8 %11, i8* %12
%13 = load i32, i32* %5
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @SendFrame(i32 %13, i8* %14, i8* %15, i32 %16)
ret void
}

LLVM IR (-O2):
define void @SendLTFrame(i32 %0, i8 zeroext %1, i8* %2, i32 %3) {
%5 = alloca [3 x i8]
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%7 = bitcast [3 x i8]* %5 to i16*
store i16 1026, i16* %7
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 2
store i8 %1, i8* %8
%9 = call i32 @SendFrame(i32 %0, i8* %6, i8* %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printExit(void) { printf("Exit Logged\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Exit Logged\00"
define void @printExit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
int playerWins(int player, int dealer) {
  if (player > 21)
    return 0;
  if (dealer > 21)
    return 1;
  if (dealer > player)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<playerWins>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x15,-0x8(%rbp)
jle    1120 <playerWins+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1155 <playerWins+0x55>
cmpl   $0x15,-0xc(%rbp)
jle    1136 <playerWins+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <playerWins+0x55>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114e <playerWins+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <playerWins+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<playerWins>:
xor    %eax,%eax
cmp    $0x15,%edi
jg     1118 <playerWins+0x18>
mov    $0x1,%eax
cmp    $0x15,%esi
jg     1118 <playerWins+0x18>
xor    %eax,%eax
cmp    %edi,%esi
setle  %al
ret

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

LLVM IR (-O2):
define i32 @playerWins(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 21
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = icmp sgt i32 %1, 21
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = icmp sle i32 %1, %0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %6, %4, %2
%10 = phi i32 [ 0, %2 ], [ 1, %4 ], [ %8, %6 ]
ret i32 %10
}
int NHanoiMoves(int n) {
  int sum = 0;
  if (n == 1) {
    return 1;
  } else {
    sum += NHanoiMoves(n - 1);
    sum += 1;
    sum += NHanoiMoves(n - 1);
    return sum;
  }
}


x86 assembly (clang, -O0):
<NHanoiMoves>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1138 <NHanoiMoves+0x28>
movl   $0x1,-0x4(%rbp)
jmp    1169 <NHanoiMoves+0x59>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <NHanoiMoves@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <NHanoiMoves@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NHanoiMoves>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     112c <NHanoiMoves+0x1c>
push   %rax
add    $0xffffffff,%edi
call   1030 <NHanoiMoves@plt>
add    %eax,%eax
add    $0x1,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @NHanoiMoves(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %9, %5 ], [ 1, %1 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call i32 @NHanoiMoves(i32 %6)
%8 = shl i32 %7, 1
%9 = or i32 %8, 1
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
uid_t getgid(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @getgid() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
void foo(int i, int j) { bar(i, j); }


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

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = tail call i32 @bar(i32 %0, i32 %1)
ret void
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct datafile_list {
  int dummy;
};
struct datafile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_prepend(struct genlist *, struct datafile *);
void datafile_list_prepend(struct datafile_list *tthis, struct datafile *pfoo) {
  genlist_prepend(((struct genlist *)(tthis)), pfoo);
}


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

x86 assembly (clang, -O2):
<datafile_list_prepend>:
jmp    1030 <genlist_prepend@plt>

LLVM IR (-O0):
%struct.datafile_list = type { i32 }
%struct.datafile = type { i32 }
%struct.genlist = type { i32 }
define void @datafile_list_prepend(%struct.datafile_list* %0, %struct.datafile* %1) {
%3 = alloca %struct.datafile_list*
%4 = alloca %struct.datafile*
store %struct.datafile_list* %0, %struct.datafile_list** %3
store %struct.datafile* %1, %struct.datafile** %4
%5 = load %struct.datafile_list*, %struct.datafile_list** %3
%6 = bitcast %struct.datafile_list* %5 to %struct.genlist*
%7 = load %struct.datafile*, %struct.datafile** %4
%8 = call i32 @genlist_prepend(%struct.genlist* %6, %struct.datafile* %7)
ret void
}

LLVM IR (-O2):
%struct.datafile_list = type { i32 }
%struct.datafile = type { i32 }
%struct.genlist = type { i32 }
define void @datafile_list_prepend(%struct.datafile_list* %0, %struct.datafile* %1) {
%3 = bitcast %struct.datafile_list* %0 to %struct.genlist*
%4 = tail call i32 @genlist_prepend(%struct.genlist* %3, %struct.datafile* %1)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *jason_Malloc(size_t *size) {
  void *ret = malloc(*size);
  if (ret == NULL) {
    *size = 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<jason_Malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <jason_Malloc+0x32>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jason_Malloc>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     1123 <jason_Malloc+0x13>
pop    %rbx
ret
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @jason_Malloc(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
store i64 0, i64* %0
br label %6
6: ; preds = %5, %1
ret i8* %3
}
/* Type definitions */
struct mat4 {
  int dummy;
};
struct mat3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat4_assign_mat3(float *, float *);
__attribute__((always_)) struct mat4 *psmat4_assign_mat3(struct mat4 *result,
                                                         struct mat3 *m) {
  mat4_assign_mat3((float *)result, (float *)m);
  return result;
}


x86 assembly (clang, -O0):
<psmat4_assign_mat3>:
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 <mat4_assign_mat3@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.mat4 = type { i32 }
%struct.mat3 = type { i32 }
define %struct.mat4* @psmat4_assign_mat3(%struct.mat4* returned %0, %struct.mat3* %1) {
%3 = bitcast %struct.mat4* %0 to float*
%4 = bitcast %struct.mat3* %1 to float*
%5 = tail call i32 @mat4_assign_mat3(float* %3, float* %4)
ret %struct.mat4* %0
}
/* Variables and functions */
int f(int *);
int *malloc(int);
int main(void) {
  int a[5];
  int *b = malloc(sizeof(int) * 5);
  return f(a) + f(b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <f@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
call   1030 <f@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <f@plt>
add    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @malloc(i32 20)
store i32* %4, i32** %3
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = call i32 @f(i32* %5)
%7 = load i32*, i32** %3
%8 = call i32 @f(i32* %7)
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32* @malloc(i32 20)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @f(i32* %4)
%6 = call i32 @f(i32* %3)
%7 = add nsw i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int detect();
int /*<<< orphan*/ printf(char *);
void get_libname(void) {
  if (detect() == 2) {
    printf("loongson3a\n");
  } else if (detect() == 3) {
    printf("loongson3b\n");
  } else {
    printf("mips32\n");
  }
}


x86 assembly (clang, -O0):
<get_libname>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    1145 <get_libname+0x25>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <get_libname+0x57>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    1166 <get_libname+0x46>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <get_libname+0x52>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <get_libname+0x57>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_libname>:
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    113a <get_libname+0x1a>
lea    0xede(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x3,%eax
lea    0xebc(%rip),%rax
lea    0xeae(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"loongson3a\0A\00"
@.str.1 = [12 x i8] c"loongson3b\0A\00"
@.str.2 = [8 x i8] c"mips32\0A\00"
define void @get_libname() {
%1 = call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %13
5: ; preds = %0
%6 = call i32 (...) @detect()
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %5
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
br label %13
13: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"mips32\00"
@str.3 = [11 x i8] c"loongson3b\00"
@str.4 = [11 x i8] c"loongson3a\00"
define void @get_libname() {
%1 = tail call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 (...) @detect()
%5 = icmp eq i32 %4, 3
%6 = select i1 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
br label %7
7: ; preds = %3, %0
%8 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0), %0 ], [ %6, %3 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret void
}
void _min(int *a, int b) {
  if (*a > b)
    *a = b;
}


x86 assembly (clang, -O0):
<_min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jle    1123 <_min+0x23>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_min>:
cmp    %esi,(%rdi)
jle    1106 <_min+0x6>
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @_min(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = icmp sgt i32 %3, %1
br i1 %4, label %5, label %6
5: ; preds = %2
store i32 %1, i32* %0
br label %6
6: ; preds = %5, %2
ret void
}
trim(str) {
  register char *cp;
  cp = str;
  while (*cp)
    cp++;
  while (*--cp == ' ')
    ;
  cp++;
  *cp++ = '\n';
  *cp++ = 0;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112d <trim+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110f <trim+0xf>
jmp    1132 <trim+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    1153 <trim+0x53>
jmp    1132 <trim+0x32>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0xa,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
movslq %edi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x0,(%rax)
lea    0x1(%rax),%rax
jne    1110 <trim+0x10>
nopl   0x0(%rax)
cmpb   $0x20,-0x2(%rax)
lea    -0x1(%rax),%rax
je     1120 <trim+0x20>
movw   $0xa,(%rax)
ret

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

LLVM IR (-O2):
define i32 @trim(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = phi i8* [ %3, %1 ], [ %8, %4 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %9, label %4
9: ; preds = %4, %9
%10 = phi i8* [ %11, %9 ], [ %5, %4 ]
%11 = getelementptr inbounds i8, i8* %10, i64 -1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 32
br i1 %13, label %9, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %10, i64 1
store i8 10, i8* %10
store i8 0, i8* %15
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ settftpmode(char *);
void setbinary(int argc, char *argv[]) { settftpmode("octet"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"octet\00"
define void @setbinary(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @settftpmode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"octet\00"
define void @setbinary(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @settftpmode(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
char function(char test[]) { return test[2]; }


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

x86 assembly (clang, -O2):
<function>:
mov    0x2(%rdi),%al
ret

LLVM IR (-O0):
define signext i8 @function(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = load i8, i8* %4
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @function(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
ret i8 %3
}
void strength_result4(int *data) {
  int i;
  if (data[1]) {
    i = 42;
    goto here;
  }
  i = 0;
  do {
    i = i + 21;
  here:
    data[data[2]] = 2;
  } while (i < data[3]);
}


x86 assembly (clang, -O0):
<strength_result4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     1122 <strength_result4+0x22>
movl   $0x2a,-0xc(%rbp)
jmp    1132 <strength_result4+0x32>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x15,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x8(%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jl     1129 <strength_result4+0x29>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strength_result4>:
mov    $0x2a,%eax
xor    %ecx,%ecx
cmpl   $0x0,0x4(%rdi)
jne    1112 <strength_result4+0x12>
add    $0x15,%ecx
mov    %ecx,%eax
movslq 0x8(%rdi),%rcx
movl   $0x2,(%rdi,%rcx,4)
mov    %eax,%ecx
cmp    0xc(%rdi),%eax
jl     110d <strength_result4+0xd>
ret

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

LLVM IR (-O2):
define void @strength_result4(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1, %8
%6 = phi i32 [ %9, %8 ], [ 0, %1 ]
%7 = add nsw i32 %6, 21
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ %7, %5 ], [ 42, %1 ]
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
store i32 2, i32* %13
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = icmp slt i32 %9, %15
br i1 %16, label %5, label %17
17: ; preds = %8
ret void
}
unsigned long long int rdtsc(void) {
  unsigned long long int x, y;
  for (;;) {
    __asm__ volatile("rdtsc" : "=A"(x));
    __asm__ volatile("rdtsc" : "=A"(y));
    if (y - x < 1000)
      return y;
  }
}


x86 assembly (clang, -O0):
<rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %rax,-0x8(%rbp)
rdtsc
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cmp    $0x3e8,%rax
jae    112a <rdtsc+0x2a>
mov    -0x10(%rbp),%rax
pop    %rbp
ret
jmp    1104 <rdtsc+0x4>

x86 assembly (clang, -O2):
<rdtsc>:
rdtsc
mov    %rax,%rcx
rdtsc
mov    %rax,%rdx
sub    %rcx,%rdx
cmp    $0x3e7,%rdx
ja     1100 <rdtsc>
ret

LLVM IR (-O0):
define i64 @rdtsc() {
%1 = alloca i64
%2 = alloca i64
br label %3
3: ; preds = %12, %0
%4 = call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %4, i64* %1
%5 = call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = load i64, i64* %1
%8 = sub i64 %6, %7
%9 = icmp ult i64 %8, 1000
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i64, i64* %2
ret i64 %11
12: ; preds = %3
br label %3
}

LLVM IR (-O2):
define i64 @rdtsc() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
%3 = tail call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
%4 = sub i64 %3, %2
%5 = icmp ult i64 %4, 1000
br i1 %5, label %6, label %1
6: ; preds = %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
usage(char *name, int rc) {
  printf("usage: %s --addr x.x.x.x [--mask x.x.x.x] "
         "[--net x.x.x.x] [--gw x.x.x.x] [--if x] [--help]\n",
         name);
  exit(rc);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [92 x i8] c"usage: %s --addr x.x.x.x [--mask x.x.x.x] [--net x.x.x.x] [--gw x.x.x.x] [--if x] [--help]\0A\00"
define i32 @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [92 x i8] c"usage: %s --addr x.x.x.x [--mask x.x.x.x] [--net x.x.x.x] [--gw x.x.x.x] [--if x] [--help]\0A\00"
define i32 @usage(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ PicocParse(char const *, char *, int /*<<< orphan*/, int,
                              int /*<<< orphan*/, int);
char *PlatformReadFile(char const *);
int /*<<< orphan*/ strlen(char *);
void PicocPlatformScanFile(const char *FileName) {
  char *SourceStr = PlatformReadFile(FileName);
  PicocParse(FileName, SourceStr, strlen(SourceStr), 1, 0, 1);
}


x86 assembly (clang, -O0):
<PicocPlatformScanFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <PlatformReadFile@plt>
mov    %rax,-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
mov    $0x1,%r9d
xor    %r8d,%r8d
mov    %r9d,%ecx
call   1040 <PicocParse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PicocPlatformScanFile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <PlatformReadFile@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <PicocParse@plt>

LLVM IR (-O0):
define void @PicocPlatformScanFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @PlatformReadFile(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @PicocParse(i8* %6, i8* %7, i32 %9, i32 1, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @PicocPlatformScanFile(i8* %0) {
%2 = tail call i8* @PlatformReadFile(i8* %0)
%3 = tail call i32 @strlen(i8* %2)
%4 = tail call i32 @PicocParse(i8* %0, i8* %2, i32 %3, i32 1, i32 0, i32 1)
ret void
}
/* Variables and functions */
int comparef2(long const, long const);
int __ltsf2(float a, float b) {
  return comparef2((*(const long *)&a), (*(const long *)&b));
}


x86 assembly (clang, -O0):
<__ltsf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    -0x4(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <comparef2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ltsf2>:
movss  %xmm0,-0x8(%rsp)
movss  %xmm1,-0x10(%rsp)
mov    -0x8(%rsp),%rdi
mov    -0x10(%rsp),%rsi
jmp    1030 <comparef2@plt>

LLVM IR (-O0):
define i32 @__ltsf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = bitcast float* %3 to i64*
%6 = load i64, i64* %5
%7 = bitcast float* %4 to i64*
%8 = load i64, i64* %7
%9 = call i32 @comparef2(i64 %6, i64 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @__ltsf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = bitcast float* %3 to i64*
%6 = load i64, i64* %5
%7 = bitcast float* %4 to i64*
%8 = load i64, i64* %7
%9 = tail call i32 @comparef2(i64 %6, i64 %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_S5K83A(unsigned short uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_S5K83A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_S5K83A>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_S5K83A(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = trunc i16 %5 to i8
%7 = load i16, i16* %4
%8 = trunc i16 %7 to i8
%9 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %6, i8 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_S5K83A(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = trunc i16 %1 to i8
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %3, i8 zeroext %4)
ret void
}
void bn_add_words(void) {}


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

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

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

LLVM IR (-O2):
define void @bn_add_words() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void *s_malloc(int n) {
  void *p = 0;
  if (n > 0)
    p = (void *)malloc(n);
  return p;
}


x86 assembly (clang, -O0):
<s_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1139 <s_malloc+0x29>
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_malloc>:
test   %edi,%edi
jle    111f <s_malloc+0xf>
push   %rax
call   1030 <malloc@plt>
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @s_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %3
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
br label %10
10: ; preds = %6, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @s_malloc(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i64 @malloc(i32 %0)
%5 = inttoptr i64 %4 to i8*
br label %6
6: ; preds = %3, %1
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void write6502(uint16_t address, uint8_t value) {}


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

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

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

LLVM IR (-O2):
define void @write6502(i32 %0, i32 %1) {
ret void
}
int main() {
  unsigned long a = 0;
  unsigned long b = 7;
  return a / b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x7,-0x18(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store i64 7, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
%6 = udiv i64 %4, %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int GCD(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("%d\n", GCD(27, 3));
  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    $0x1b,%edi
mov    $0x3,%esi
call   1040 <GCD@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1b,%edi
mov    $0x3,%esi
call   1040 <GCD@plt>
lea    0xec9(%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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @GCD(i32 27, i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @GCD(i32 27, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ UART1_ERR_DriverIRQHandler();
__attribute__((weak)) void UART1_ERR_IRQHandler(void) {
  UART1_ERR_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @UART1_ERR_IRQHandler() {
%1 = call i32 (...) @UART1_ERR_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @UART1_ERR_IRQHandler() {
%1 = tail call i32 (...) @UART1_ERR_DriverIRQHandler()
ret void
}
void GB_IDENTITY_f_FP64(double *z, const double *x) { (*z) = (*x); }


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

x86 assembly (clang, -O2):
<GB_IDENTITY_f_FP64>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
define void @GB_IDENTITY_f_FP64(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
store double %3, double* %0
ret void
}
void foo602(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo602(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Entity_destroy(int);
void Entity_close() {
  int id;
  for (id = 0; id < 256; ++id)
    Entity_destroy(id);
}


x86 assembly (clang, -O0):
<Entity_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1142 <Entity_close+0x32>
mov    -0x4(%rbp),%edi
call   1030 <Entity_destroy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <Entity_close+0xf>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Entity_close() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @Entity_destroy(i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
int step_size(unsigned int level) {
  return ((11 + level) < (15) ? (11 + level) : (15));
}


x86 assembly (clang, -O0):
<step_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb,%eax
cmp    $0xf,%eax
jae    1124 <step_size+0x24>
mov    -0x4(%rbp),%eax
add    $0xb,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <step_size+0x31>
mov    $0xf,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <step_size+0x31>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<step_size>:
lea    0xb(%rdi),%ecx
cmp    $0xf,%ecx
mov    $0xf,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @step_size(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 11, %3
%5 = icmp ult i32 %4, 15
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add i32 11, %7
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %6
%11 = phi i32 [ %8, %6 ], [ 15, %9 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @step_size(i32 %0) {
%2 = add i32 %0, 11
%3 = icmp ult i32 %2, 15
%4 = select i1 %3, i32 %2, i32 15
ret i32 %4
}
int create_battery_charge() {}


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

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

LLVM IR (-O0):
define i32 @create_battery_charge() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @create_battery_charge() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ suffix();
void f_empty_while_loop_suffix() {
  while (1) {
  }
  suffix();
}


x86 assembly (clang, -O0):
<f_empty_while_loop_suffix>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <f_empty_while_loop_suffix+0x9>
jmp    1109 <f_empty_while_loop_suffix+0x9>

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

LLVM IR (-O0):
define void @f_empty_while_loop_suffix() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @f_empty_while_loop_suffix() {
br label %1
1: ; preds = %0, %1
br label %1
}
unsigned short inw(unsigned short port) {
  short data;
  __asm__("inw %1, %0" : "=a"(data) : "dN"(port));
  return data;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
void fbcon_fb_unregistered(struct fb_info *info) {}


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

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

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

LLVM IR (-O2):
%struct.fb_info = type opaque
define void @fbcon_fb_unregistered(%struct.fb_info* nocapture %0) {
ret void
}
int _Locale_tolower(struct _Locale_ctype *__DUMMY_PAR1, int __DUMMY_PAR) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct._Locale_ctype = type opaque
define i32 @_Locale_tolower(%struct._Locale_ctype* %0, i32 %1) {
%3 = alloca %struct._Locale_ctype*
%4 = alloca i32
store %struct._Locale_ctype* %0, %struct._Locale_ctype** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct._Locale_ctype = type opaque
define i32 @_Locale_tolower(%struct._Locale_ctype* nocapture readnone %0, i32 %1) {
ret i32 0
}
int memlockall(void) { return (-1); }


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

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

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

LLVM IR (-O2):
define i32 @memlockall() {
ret i32 -1
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int a[], int l, int r) {
  int j;
  if (l < r) {
    j = partition(a, l, r);
    quick_sort(a, l, j - 1);
    quick_sort(a, j + 1, r);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}