xunge/DecIR huggingface dataset:
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ printf(char *);
void *createMemory(size_t count, size_t size) {
  void *result = calloc(count, size);
  if (!result)
    printf("Allocate memory error\n");
  return result;
}


x86 assembly (clang, -O0):
<createMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <createMemory+0x38>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createMemory>:
push   %rbx
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <createMemory+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Allocate memory error\0A\00"
define i8* @createMemory(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@str = [22 x i8] c"Allocate memory error\00"
define noalias i8* @createMemory(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *substring(const char *str, int start, int len) {
  char *substr = (char *)malloc(len + 1);
  memcpy(substr, &str[start], len);
  substr[len] = '\0';
  return substr;
}


x86 assembly (clang, -O0):
<substring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<substring>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%rbx),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
movslq %r15d,%rsi
add    %r14,%rsi
mov    %rax,%rdi
mov    %ebx,%edx
call   1030 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @substring(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i32, i32* %6
%18 = call i32 @memcpy(i8* %12, i8* %16, i32 %17)
%19 = load i8*, i8** %7
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @substring(i8* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @memcpy(i8* %6, i8* %8, i32 %2)
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
store i8 0, i8* %11
ret i8* %6
}
char *zgtdir() { return ("(directory unknown)"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"(directory unknown)\00"
define i8* @zgtdir() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [20 x i8] c"(directory unknown)\00"
define i8* @zgtdir() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}
double qdc_conv_q_mVns(int q) { return q * 0.036468506 * 2.0; }


x86 assembly (clang, -O0):
<qdc_conv_q_mVns>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xef4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee0(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<qdc_conv_q_mVns>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @qdc_conv_q_mVns(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 0x3FA2AC0001353CD6
%6 = fmul double %5, 2.000000e+00
ret double %6
}

LLVM IR (-O2):
define double @qdc_conv_q_mVns(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x3FA2AC0001353CD6
%4 = fmul double %3, 2.000000e+00
ret double %4
}
/* Variables and functions */
double CDFNormal(double);
double LBinormal(double, double, double);
double CDFBinormal(double h1, double h2, double r) {
  return (LBinormal(h1, h2, r) + CDFNormal(h1) + CDFNormal(h2) - 1);
}


x86 assembly (clang, -O0):
<CDFBinormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <LBinormal@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <CDFNormal@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <CDFNormal@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe77(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CDFBinormal>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <LBinormal@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <CDFNormal@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <CDFNormal@plt>
addsd  (%rsp),%xmm0
addsd  0xe99(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @CDFBinormal(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call double @LBinormal(double %7, double %8, double %9)
%11 = load double, double* %4
%12 = call double @CDFNormal(double %11)
%13 = fadd double %10, %12
%14 = load double, double* %5
%15 = call double @CDFNormal(double %14)
%16 = fadd double %13, %15
%17 = fsub double %16, 1.000000e+00
ret double %17
}

LLVM IR (-O2):
define double @CDFBinormal(double %0, double %1, double %2) {
%4 = tail call double @LBinormal(double %0, double %1, double %2)
%5 = tail call double @CDFNormal(double %0)
%6 = fadd double %4, %5
%7 = tail call double @CDFNormal(double %1)
%8 = fadd double %6, %7
%9 = fadd double %8, -1.000000e+00
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dtor1() { printf("Destroy1!\n"); }


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"Destroy1!\00"
define void @dtor1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
#define SIGALRM 129
#define SIGCHLD 128
int /*<<< orphan*/ wait(int *);
void sig_handler(int sig) {
  int retval;
  switch (sig) {
  case SIGCHLD:
    wait(&retval);
    break;
  case SIGALRM:
    break;
  }
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x80,%eax
je     1144 <sig_handler+0x34>
jmp    1131 <sig_handler+0x21>
mov    -0xc(%rbp),%eax
sub    $0x81,%eax
je     1152 <sig_handler+0x42>
jmp    1157 <sig_handler+0x47>
lea    -0x8(%rbp),%rdi
call   1030 <wait@plt>
jmp    1157 <sig_handler+0x47>
jmp    1157 <sig_handler+0x47>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
cmp    $0x80,%edi
jne    1127 <sig_handler+0x17>
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <wait@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 128, label %5
i32 129, label %7
]
5: ; preds = %1
%6 = call i32 @wait(i32* %3)
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %5
ret void
}

LLVM IR (-O2):
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i32 %0, 128
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @wait(i32* %2)
br label %7
7: ; preds = %1, %5
ret void
}
int isleap(int y) {
  int a = 0;
  if (y % 4 == 0)
    a = 1;
  if (y % 100 == 0)
    a = 0;
  if (y % 400 == 0)
    a = 1;
  return (a);
}


x86 assembly (clang, -O0):
<isleap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1129 <isleap+0x29>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1144 <isleap+0x44>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115f <isleap+0x5f>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isleap>:
test   $0x3,%dil
sete   %al
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
and    %al,%dl
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @isleap(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp ne i32 %4, 0
%6 = and i1 %5, %3
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %8, %6
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int nrf_802154_pib_pan_coord_get();
bool nrf_802154_pan_coord_get(void) { return nrf_802154_pib_pan_coord_get(); }


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

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

LLVM IR (-O0):
define i32 @nrf_802154_pan_coord_get() {
%1 = call i32 (...) @nrf_802154_pib_pan_coord_get()
ret i32 %1
}

LLVM IR (-O2):
define i32 @nrf_802154_pan_coord_get() {
%1 = tail call i32 (...) @nrf_802154_pib_pan_coord_get()
ret i32 %1
}
/* Variables and functions */
void cc3_camera_set_auto_white_balance(bool awb) {}


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

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

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

LLVM IR (-O2):
define void @cc3_camera_set_auto_white_balance(i32 %0) {
ret void
}
/* Variables and functions */
int _f(int, int, double const, double const *);
double _g_3(const double omega, const double vertices_omegas[4]) {
  return (3 * _f(1, 3, omega, vertices_omegas) *
          _f(2, 3, omega, vertices_omegas) /
          (vertices_omegas[3] - vertices_omegas[0]));
}


x86 assembly (clang, -O0):
<_g_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <_f@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <_f@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_g_3>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
call   1030 <_f@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x3,%esi
movsd  (%rsp),%xmm0
mov    %rbx,%rdx
call   1030 <_f@plt>
imul   %ebp,%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x18(%rbx),%xmm1
subsd  (%rbx),%xmm1
divsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @_g_3(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
store double %0, double* %3
store double* %1, double** %4
%5 = load double, double* %3
%6 = load double*, double** %4
%7 = call i32 @_f(i32 1, i32 3, double %5, double* %6)
%8 = mul nsw i32 3, %7
%9 = load double, double* %3
%10 = load double*, double** %4
%11 = call i32 @_f(i32 2, i32 3, double %9, double* %10)
%12 = mul nsw i32 %8, %11
%13 = sitofp i32 %12 to double
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 3
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = fdiv double %13, %20
ret double %21
}

LLVM IR (-O2):
define double @_g_3(double %0, double* %1) {
%3 = tail call i32 @_f(i32 1, i32 3, double %0, double* %1)
%4 = mul nsw i32 %3, 3
%5 = tail call i32 @_f(i32 2, i32 3, double %0, double* %1)
%6 = mul nsw i32 %4, %5
%7 = sitofp i32 %6 to double
%8 = getelementptr inbounds double, double* %1, i64 3
%9 = load double, double* %8
%10 = load double, double* %1
%11 = fsub double %9, %10
%12 = fdiv double %7, %11
ret double %12
}
/* Variables and functions */
int zrand();
int randi(int a, int b) {
  int L = b - a;
  int P = 1;
  int x;
  while (P < L) {
    P <<= 1;
  }
  do {
    x = zrand() & (P - 1);
  } while (x > L);
  return x + a;
}


x86 assembly (clang, -O0):
<randi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1148 <randi+0x38>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <randi+0x1e>
jmp    114d <randi+0x3d>
mov    $0x0,%al
call   1030 <zrand@plt>
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     114d <randi+0x3d>
mov    -0x14(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randi>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
sub    %edi,%ebp
mov    $0x1,%eax
mov    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
cmp    %ebp,%ebx
jl     1120 <randi+0x10>
add    $0xffffffff,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <zrand@plt>
and    %ebx,%eax
cmp    %ebp,%eax
jg     1130 <randi+0x20>
add    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @randi(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 1, %2 ], [ %7, %4 ]
%6 = icmp slt i32 %5, %3
%7 = shl i32 %5, 1
br i1 %6, label %4, label %8
8: ; preds = %4
%9 = add nsw i32 %5, -1
br label %10
10: ; preds = %8, %10
%11 = tail call i32 (...) @zrand()
%12 = and i32 %11, %9
%13 = icmp sgt i32 %12, %3
br i1 %13, label %10, label %14
14: ; preds = %10
%15 = add nsw i32 %12, %0
ret i32 %15
}
/* Variables and functions */
float smrand_uniform_do();
void smrand_uniform(int n, float *y) {
  while (n--) {
    y[n] = smrand_uniform_do();
  }
}


x86 assembly (clang, -O0):
<smrand_uniform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     114c <smrand_uniform+0x3c>
mov    $0x0,%al
call   1030 <smrand_uniform_do@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    111f <smrand_uniform+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smrand_uniform>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
je     1146 <smrand_uniform+0x36>
mov    %edi,%r15d
movslq %edi,%rax
lea    (%rsi,%rax,4),%r14
add    $0xfffffffffffffffc,%r14
neg    %r15d
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <smrand_uniform_do@plt>
movss  %xmm0,(%r14,%rbx,4)
add    $0xffffffffffffffff,%rbx
cmp    %ebx,%r15d
jne    1130 <smrand_uniform+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @smrand_uniform(i32 %0, float* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = sext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = tail call float (...) @smrand_uniform_do()
%10 = getelementptr inbounds float, float* %1, i64 %8
store float %9, float* %10
%11 = trunc i64 %8 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
int main() {
  char *aba = "asdf";
  printf(""
         "whotchu think\nYou can do this,\nYou can do that\nAnd then there's "
         "this %s\nAnd that too\n%s\n%p\n%x\n"
         "",
         aba, aba, aba, &aba);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%r8
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rcx
mov    %rcx,(%rsp)
lea    0xee2(%rip),%rdi
mov    %rsp,%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"asdf\00"
@.str.1 = [95 x i8] c"whotchu think\0AYou can do this,\0AYou can do that\0AAnd then there's this %s\0AAnd that too\0A%s\0A%p\0A%x\0A\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = load i8*, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3, i8* %4, i8** %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"asdf\00"
@.str.1 = [95 x i8] c"whotchu think\0AYou can do this,\0AYou can do that\0AAnd then there's this %s\0AAnd that too\0A%s\0A%p\0A%x\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
void *__VERIFIER_nondet_pointer() {
  void *initialValue;
  int byteOffset = 0;
  uint8_t *initialValueAsByte = (uint8_t *)&initialValue;
  for (; byteOffset < sizeof(void *); ++byteOffset) {
    initialValueAsByte[byteOffset] = 0;
  }
  return initialValue;
}


x86 assembly (clang, -O0):
<__VERIFIER_nondet_pointer>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x8,%rax
jae    113f <__VERIFIER_nondet_pointer+0x3f>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1113 <__VERIFIER_nondet_pointer+0x13>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @__VERIFIER_nondet_pointer() {
ret i8* null
}
unsigned int median(const unsigned int *hist, unsigned int count) {
  count /= 2;
  const unsigned int *p = hist;
  unsigned int sum = *p;
  while (sum < count) {
    ++p;
    sum += *p;
  }
  return (p - hist);
}


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    114e <median+0x4e>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1125 <median+0x25>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<median>:
shr    %esi
mov    (%rdi),%ecx
mov    %rdi,%rax
cmp    %esi,%ecx
jae    111b <median+0x1b>
mov    %rdi,%rax
xchg   %ax,%ax
add    0x4(%rax),%ecx
add    $0x4,%rax
cmp    %esi,%ecx
jb     1110 <median+0x10>
sub    %rdi,%rax
shr    $0x2,%rax
ret

LLVM IR (-O0):
define i32 @median(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = udiv i32 %7, 2
store i32 %8, i32* %4
%9 = load i32*, i32** %3
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
store i32 %11, i32* %6
br label %12
12: ; preds = %16, %2
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp ult i32 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %5
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = load i32, i32* %6
%22 = add i32 %21, %20
store i32 %22, i32* %6
br label %12
23: ; preds = %12
%24 = load i32*, i32** %5
%25 = load i32*, i32** %3
%26 = ptrtoint i32* %24 to i64
%27 = ptrtoint i32* %25 to i64
%28 = sub i64 %26, %27
%29 = sdiv exact i64 %28, 4
%30 = trunc i64 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @median(i32* %0, i32 %1) {
%3 = lshr i32 %1, 1
%4 = load i32, i32* %0
%5 = icmp ult i32 %4, %3
br i1 %5, label %6, label %13
6: ; preds = %2, %6
%7 = phi i32 [ %11, %6 ], [ %4, %2 ]
%8 = phi i32* [ %9, %6 ], [ %0, %2 ]
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = add i32 %10, %7
%12 = icmp ult i32 %11, %3
br i1 %12, label %6, label %13
13: ; preds = %6, %2
%14 = phi i32* [ %0, %2 ], [ %9, %6 ]
%15 = ptrtoint i32* %14 to i64
%16 = ptrtoint i32* %0 to i64
%17 = sub i64 %15, %16
%18 = lshr exact i64 %17, 2
%19 = trunc i64 %18 to i32
ret i32 %19
}
/* Variables and functions */
int in_byte(unsigned short);
int /*<<< orphan*/ out_byte(unsigned short, unsigned char);
void IRQ_set_mask(unsigned char IRQline) {
  unsigned short port;
  unsigned char value;
  if (IRQline < 8) {
    port = (0x20 + 1);
  } else {
    port = (0xA0 + 1);
    IRQline -= 8;
  }
  value = in_byte(port) | (1 << IRQline);
  out_byte(port, value);
}


x86 assembly (clang, -O0):
<IRQ_set_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x8,%eax
jge    1146 <IRQ_set_mask+0x26>
movw   $0x21,-0x4(%rbp)
jmp    1156 <IRQ_set_mask+0x36>
movw   $0xa1,-0x4(%rbp)
movzbl -0x1(%rbp),%eax
sub    $0x8,%eax
mov    %al,-0x1(%rbp)
movzwl -0x4(%rbp),%edi
call   1030 <in_byte@plt>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%ax
movzwl %ax,%edi
movzbl -0x5(%rbp),%esi
call   1040 <out_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRQ_set_mask>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    %edi,%eax
sub    $0x8,%al
movzbl %al,%ebp
cmovb  %edi,%ebp
setae  %bl
shl    $0x7,%ebx
or     $0x21,%ebx
mov    %ebx,%edi
call   1030 <in_byte@plt>
bts    %ebp,%eax
movzbl %al,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <out_byte@plt>

LLVM IR (-O0):
define void @IRQ_set_mask(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i16
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %9
8: ; preds = %1
store i16 33, i16* %3
br label %14
9: ; preds = %1
store i16 161, i16* %3
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = sub nsw i32 %11, 8
%13 = trunc i32 %12 to i8
store i8 %13, i8* %2
br label %14
14: ; preds = %9, %8
%15 = load i16, i16* %3
%16 = call i32 @in_byte(i16 zeroext %15)
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = shl i32 1, %18
%20 = or i32 %16, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %4
%22 = load i16, i16* %3
%23 = load i8, i8* %4
%24 = call i32 @out_byte(i16 zeroext %22, i8 zeroext %23)
ret void
}

LLVM IR (-O2):
define void @IRQ_set_mask(i8 zeroext %0) {
%2 = icmp ult i8 %0, 8
%3 = add i8 %0, -8
%4 = select i1 %2, i16 33, i16 161
%5 = select i1 %2, i8 %0, i8 %3
%6 = tail call i32 @in_byte(i16 zeroext %4)
%7 = zext i8 %5 to i32
%8 = shl nuw i32 1, %7
%9 = or i32 %6, %8
%10 = trunc i32 %9 to i8
%11 = tail call i32 @out_byte(i16 zeroext %4, i8 zeroext %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wcsprintf(char *, char const *, ...);
void wcsprt_auxd(const char *name, double value) {
  if ((value == 987654321.0e99)) {
    wcsprintf("   %s: UNDEFINED\n", name);
  } else {
    wcsprintf("   %s:  %15.9f\n", name, value);
  }
}


x86 assembly (clang, -O0):
<wcsprt_auxd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1155 <wcsprt_auxd+0x45>
jp     1155 <wcsprt_auxd+0x45>
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <wcsprintf@plt>
jmp    116c <wcsprt_auxd+0x5c>
mov    -0x8(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <wcsprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsprt_auxd>:
mov    %rdi,%rsi
ucomisd 0xee5(%rip),%xmm0
jne    112d <wcsprt_auxd+0x1d>
jp     112d <wcsprt_auxd+0x1d>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
jmp    1030 <wcsprintf@plt>
lea    0xee6(%rip),%rdi
mov    $0x1,%al
jmp    1030 <wcsprintf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c" %s: UNDEFINED\0A\00"
@.str.1 = [16 x i8] c" %s: %15.9f\0A\00"
define void @wcsprt_auxd(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oeq double %5, 0x565AEA1D6E56E1C8
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 (i8*, i8*, ...) @wcsprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load double, double* %4
%13 = call i32 (i8*, i8*, ...) @wcsprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %11, double %12)
br label %14
14: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c" %s: UNDEFINED\0A\00"
@.str.1 = [16 x i8] c" %s: %15.9f\0A\00"
define void @wcsprt_auxd(i8* %0, double %1) {
%3 = fcmp oeq double %1, 0x565AEA1D6E56E1C8
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, i8*, ...) @wcsprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i8*, ...) @wcsprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0, double %1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fabs(double);
double fmod(int /*<<< orphan*/, int /*<<< orphan*/);
double fmodulo(double x, double y) { return fmod(fabs(x), fabs(y)); }


x86 assembly (clang, -O0):
<fmodulo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <fabs@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <fabs@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <fmod@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmodulo>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
call   1040 <fabs@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <fmod@plt>

LLVM IR (-O0):
define double @fmodulo(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call i32 @fabs(double %5)
%7 = load double, double* %4
%8 = call i32 @fabs(double %7)
%9 = call double @fmod(i32 %6, i32 %8)
ret double %9
}

LLVM IR (-O2):
define double @fmodulo(double %0, double %1) {
%3 = tail call i32 @fabs(double %0)
%4 = tail call i32 @fabs(double %1)
%5 = tail call double @fmod(i32 %3, i32 %4)
ret double %5
}
/* Variables and functions */
scalar_t__ test_spu_dma_channel(int);
int test_spu_dma() {
  int i;
  for (i = 0; i < 4; i++) {
    if (test_spu_dma_channel(i) != 0) {
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<test_spu_dma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    115a <test_spu_dma+0x4a>
mov    -0x8(%rbp),%edi
call   1030 <test_spu_dma_channel@plt>
cmp    $0x0,%rax
je     1147 <test_spu_dma+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <test_spu_dma+0x4a>
jmp    114c <test_spu_dma+0x3c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <test_spu_dma+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_spu_dma>:
push   %rax
xor    %edi,%edi
call   1030 <test_spu_dma_channel@plt>
test   %rax,%rax
jne    1145 <test_spu_dma+0x35>
mov    $0x1,%edi
call   1030 <test_spu_dma_channel@plt>
test   %rax,%rax
jne    1145 <test_spu_dma+0x35>
mov    $0x2,%edi
call   1030 <test_spu_dma_channel@plt>
test   %rax,%rax
jne    1145 <test_spu_dma+0x35>
mov    $0x3,%edi
call   1030 <test_spu_dma_channel@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @test_spu_dma() {
%1 = tail call i64 @test_spu_dma_channel(i32 0)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %11
3: ; preds = %0
%4 = tail call i64 @test_spu_dma_channel(i32 1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = tail call i64 @test_spu_dma_channel(i32 2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i64 @test_spu_dma_channel(i32 3)
br label %11
11: ; preds = %9, %6, %3, %0
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ lcd_home();
int /*<<< orphan*/ lcd_init();
void nklcd_init() {
  lcd_init();
  lcd_home();
}


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

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

LLVM IR (-O0):
define void @nklcd_init() {
%1 = call i32 (...) @lcd_init()
%2 = call i32 (...) @lcd_home()
ret void
}

LLVM IR (-O2):
define void @nklcd_init() {
%1 = tail call i32 (...) @lcd_init()
%2 = tail call i32 (...) @lcd_home()
ret void
}
void __clear_bit(int nr, volatile unsigned long *addr) {
  __asm__ __volatile__("btrl %1,%0"
                       : "=m"((*(volatile long *)addr))
                       : "Ir"(nr));
}


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

x86 assembly (clang, -O2):
<__clear_bit>:
btr    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @__clear_bit(i32 %0, i64* %1) {
tail call void asm sideeffect "btrl $1,$0", "=*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0)
ret void
}
/* Variables and functions */
char const *weak_l1();
const char *sibcall_weak_l1(void) { return weak_l1(); }


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

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

LLVM IR (-O0):
define i8* @sibcall_weak_l1() {
%1 = call i8* (...) @weak_l1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @sibcall_weak_l1() {
%1 = tail call i8* (...) @weak_l1()
ret i8* %1
}
/* Variables and functions */
unsigned short dxl_read_word(unsigned char, int);
unsigned short getCCWAngleLimit(unsigned char id) {
  return dxl_read_word(id, (8));
}


x86 assembly (clang, -O0):
<getCCWAngleLimit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x8,%esi
movzbl -0x1(%rbp),%edi
call   1030 <dxl_read_word@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCCWAngleLimit>:
mov    $0x8,%esi
jmp    1030 <dxl_read_word@plt>

LLVM IR (-O0):
define zeroext i16 @getCCWAngleLimit(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call zeroext i16 @dxl_read_word(i8 zeroext %3, i32 8)
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @getCCWAngleLimit(i8 zeroext %0) {
%2 = tail call zeroext i16 @dxl_read_word(i8 zeroext %0, i32 8)
ret i16 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t readl(void *ptr) {
  uint32_t *data = ptr;
  return *data;
}


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

x86 assembly (clang, -O2):
<readl>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @readl(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @readl(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
long foo1(y, x)
register int x;
register long y;
{ return x - y; }


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

x86 assembly (clang, -O2):
<foo1>:
movslq %esi,%rax
sub    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @foo1(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @foo1(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = sub nsw i64 %3, %0
ret i64 %4
}
int adjust(int number) { return number % (39 + 1); }


x86 assembly (clang, -O0):
<adjust>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x28,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
shl    $0x3,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @adjust(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 40
ret i32 %4
}

LLVM IR (-O2):
define i32 @adjust(i32 %0) {
%2 = srem i32 %0, 40
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ derefI(int *);
void notCheckedForCallee(int *arg2) { derefI(arg2); }


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

x86 assembly (clang, -O2):
<notCheckedForCallee>:
jmp    1030 <derefI@plt>

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

LLVM IR (-O2):
define void @notCheckedForCallee(i32* %0) {
%2 = tail call i32 @derefI(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ grtestmod_write(int, int);
fail(int dev) {
  grtestmod_write(1, dev);
  return (0);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <grtestmod_write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    %edi,%esi
mov    $0x1,%edi
call   1030 <grtestmod_write@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @fail(i32 %0) {
%2 = tail call i32 @grtestmod_write(i32 1, i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f(int *);
int main() {
  int y;
  f(&y);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @f(i32* %1)
ret i32 0
}
/* Variables and functions */
int errno;
scalar_t__ madvise(void *, size_t, int);
int posix_madvise(void *addr, size_t len, int advise) {
  return madvise(addr, len, advise) ? errno : 0;
}


x86 assembly (clang, -O0):
<posix_madvise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <madvise@plt>
cmp    $0x0,%rax
je     114e <posix_madvise+0x3e>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <posix_madvise+0x48>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <posix_madvise+0x48>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_madvise>:
push   %rax
call   1030 <madvise@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1129 <posix_madvise+0x19>
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @posix_madvise(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = call i64 @madvise(i8* %7, i64 %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i32, i32* @errno
br label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %12
%16 = phi i32 [ %13, %12 ], [ 0, %14 ]
ret i32 %16
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @posix_madvise(i8* %0, i64 %1, i32 %2) {
%4 = tail call i64 @madvise(i8* %0, i64 %1, i32 %2)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* @errno
%7 = select i1 %5, i32 0, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ print_tap_result(char *, unsigned long, char const *,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ safe_printf(char *);
void tap_ok_va(unsigned long testnum, const char *msg, va_list ap) {
  print_tap_result("ok", testnum, msg, ap);
  safe_printf("\n");
}


x86 assembly (clang, -O0):
<tap_ok_va>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xebb(%rip),%rdi
call   1040 <print_tap_result@plt>
lea    0xeb2(%rip),%rdi
call   1030 <safe_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tap_ok_va>:
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xed0(%rip),%rdi
call   1040 <print_tap_result@plt>
lea    0xec7(%rip),%rdi
pop    %rax
jmp    1030 <safe_printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ok\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @tap_ok_va(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @print_tap_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %7, i8* %8, i32 %9)
%11 = call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ok\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @tap_ok_va(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @print_tap_result(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %1, i32 %2)
%5 = tail call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _Z4loopv();
int /*<<< orphan*/ _Z5setupv();
int main(int argc, char **argv) {
  _Z5setupv();
  while (1) {
    _Z4loopv();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <_Z5setupv@plt>
mov    $0x0,%al
call   1030 <_Z4loopv@plt>
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <_Z5setupv@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <_Z4loopv@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @_Z5setupv()
br label %7
7: ; preds = %2, %7
%8 = call i32 (...) @_Z4loopv()
br label %7
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @_Z5setupv()
br label %4
4: ; preds = %2, %4
%5 = tail call i32 (...) @_Z4loopv()
br label %4
}