xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  int x = 10, y = 20, z;
  float m = 10.24, n = 9.68, o;
  z = y - x;
  o = m - n;
  printf("integer subtraction: %d\n", z);
  printf("floating point subtraction: %f\n", o);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
movss  0xecf(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xebe(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"integer subtraction: %d\0A\00"
@.str.1 = [32 x i8] c"floating point subtraction: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
store float 0x40247AE140000000, float* %5
store float 0x40235C2900000000, float* %6
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = sub nsw i32 %8, %9
store i32 %10, i32* %4
%11 = load float, float* %5
%12 = load float, float* %6
%13 = fsub float %11, %12
store float %13, float* %7
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), float %15)
%17 = load float, float* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), float %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"integer subtraction: %d\0A\00"
@.str.1 = [32 x i8] c"floating point subtraction: %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), float 0x3FE1EB8400000000)
ret i32 0
}
/* Variables and functions */
long double cos(long double);
long double sin(long double);
void __attribute__((visibility("hidden")))
sincosl(long double x, long double *psin, long double *pcos) {
  *psin = sin(x);
  *pcos = cos(x);
}


x86 assembly (clang, -O0):
<sincosl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sin@plt>
mov    -0x18(%rbp),%rax
fstpt  (%rax)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <cos@plt>
mov    -0x20(%rbp),%rax
fstpt  (%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sincosl>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1030 <sin@plt>
fstpt  (%rbx)
fldt   0x1c(%rsp)
fstpt  (%rsp)
call   1040 <cos@plt>
fstpt  (%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define hidden void @sincosl(x86_fp80 %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
store x86_fp80 %0, x86_fp80* %4
store x86_fp80* %1, x86_fp80** %5
store x86_fp80* %2, x86_fp80** %6
%7 = load x86_fp80, x86_fp80* %4
%8 = call x86_fp80 @sin(x86_fp80 %7)
%9 = load x86_fp80*, x86_fp80** %5
store x86_fp80 %8, x86_fp80* %9
%10 = load x86_fp80, x86_fp80* %4
%11 = call x86_fp80 @cos(x86_fp80 %10)
%12 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %11, x86_fp80* %12
ret void
}

LLVM IR (-O2):
define hidden void @sincosl(x86_fp80 %0, x86_fp80* nocapture writeonly %1, x86_fp80* nocapture writeonly %2) {
%4 = tail call x86_fp80 @sin(x86_fp80 %0)
store x86_fp80 %4, x86_fp80* %1
%5 = tail call x86_fp80 @cos(x86_fp80 %0)
store x86_fp80 %5, x86_fp80* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tstat {
  int dummy;
};
struct sstat {
  int dummy;
};

/* Variables and functions */
int gendskline(struct sstat *, char *, char);
int dskline(struct sstat *ss, struct tstat *ts, struct tstat **ps, int nactproc,
            time_t deltasec, time_t deltatic, time_t hz, int osvers, int osrel,
            int ossub, char *tstamp, int ppres, int ntrun, int ntslpi,
            int ntslpu, int pexit, int pzombie) {
  return gendskline(ss, tstamp, 'd');
}


x86 assembly (clang, -O0):
<dskline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x60(%rbp),%eax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x30(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gendskline@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dskline>:
mov    0x28(%rsp),%rsi
mov    $0x64,%edx
jmp    1030 <gendskline@plt>

LLVM IR (-O0):
%struct.sstat = type { i32 }
%struct.tstat = type { i32 }
define i32 @dskline(%struct.sstat* %0, %struct.tstat* %1, %struct.tstat** %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i8* %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = alloca %struct.sstat*
%19 = alloca %struct.tstat*
%20 = alloca %struct.tstat**
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i8*
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
store %struct.sstat* %0, %struct.sstat** %18
store %struct.tstat* %1, %struct.tstat** %19
store %struct.tstat** %2, %struct.tstat*** %20
store i32 %3, i32* %21
store i32 %4, i32* %22
store i32 %5, i32* %23
store i32 %6, i32* %24
store i32 %7, i32* %25
store i32 %8, i32* %26
store i32 %9, i32* %27
store i8* %10, i8** %28
store i32 %11, i32* %29
store i32 %12, i32* %30
store i32 %13, i32* %31
store i32 %14, i32* %32
store i32 %15, i32* %33
store i32 %16, i32* %34
%35 = load %struct.sstat*, %struct.sstat** %18
%36 = load i8*, i8** %28
%37 = call i32 @gendskline(%struct.sstat* %35, i8* %36, i8 signext 100)
ret i32 %37
}

LLVM IR (-O2):
%struct.sstat = type { i32 }
%struct.tstat = type { i32 }
define i32 @dskline(%struct.sstat* %0, %struct.tstat* nocapture readnone %1, %struct.tstat** nocapture readnone %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i8* %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = tail call i32 @gendskline(%struct.sstat* %0, i8* %10, i8 signext 100)
ret i32 %18
}
void usb_flush(void) {}


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

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

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

LLVM IR (-O2):
define void @usb_flush() {
ret void
}
/* Variables and functions */
float getBackupBatteryLevel();
int getBackupBatteryStatus() {
  float backupBatteryPercentage = getBackupBatteryLevel();
  if (backupBatteryPercentage >= 106) {
    return 3;
  } else {
    if (backupBatteryPercentage <= 50) {
      if (backupBatteryPercentage <= 20) {
        return 2;
      } else {
        return 1;
      }
    } else {
      return 0;
    }
  }
}


x86 assembly (clang, -O0):
<getBackupBatteryStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getBackupBatteryLevel@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xecf(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1146 <getBackupBatteryStatus+0x36>
movl   $0x3,-0x4(%rbp)
jmp    1189 <getBackupBatteryStatus+0x79>
movss  0xeb6(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1182 <getBackupBatteryStatus+0x72>
movss  0xea8(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1176 <getBackupBatteryStatus+0x66>
movl   $0x2,-0x4(%rbp)
jmp    1189 <getBackupBatteryStatus+0x79>
movl   $0x1,-0x4(%rbp)
jmp    1189 <getBackupBatteryStatus+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBackupBatteryStatus>:
push   %rax
xor    %eax,%eax
call   1030 <getBackupBatteryLevel@plt>
mov    $0x3,%eax
ucomiss 0xedc(%rip),%xmm0
jae    114b <getBackupBatteryStatus+0x3b>
movss  0xed6(%rip),%xmm1
ucomiss %xmm0,%xmm1
mov    $0x0,%eax
jb     114b <getBackupBatteryStatus+0x3b>
movss  0xec8(%rip),%xmm1
ucomiss %xmm0,%xmm1
mov    $0x2,%eax
sbb    $0x0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getBackupBatteryStatus() {
%1 = alloca i32
%2 = alloca float
%3 = call float (...) @getBackupBatteryLevel()
store float %3, float* %2
%4 = load float, float* %2
%5 = fcmp oge float %4, 1.060000e+02
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 3, i32* %1
br label %16
7: ; preds = %0
%8 = load float, float* %2
%9 = fcmp ole float %8, 5.000000e+01
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load float, float* %2
%12 = fcmp ole float %11, 2.000000e+01
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 2, i32* %1
br label %16
14: ; preds = %10
store i32 1, i32* %1
br label %16
15: ; preds = %7
store i32 0, i32* %1
br label %16
16: ; preds = %15, %14, %13, %6
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @getBackupBatteryStatus() {
%1 = tail call float (...) @getBackupBatteryLevel()
%2 = fcmp ult float %1, 1.060000e+02
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = fcmp ugt float %1, 5.000000e+01
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = fcmp ugt float %1, 2.000000e+01
%7 = select i1 %6, i32 1, i32 2
br label %8
8: ; preds = %3, %5, %0
%9 = phi i32 [ 3, %0 ], [ %7, %5 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ transform(char *);
int main() {
  transform("9+(3-1)*5+8/2");
  printf("\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <transform@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"9+(3-1)*5+8/2\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @transform(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"9+(3-1)*5+8/2\00"
define i32 @main() {
%1 = tail call i32 @transform(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mySink(int, int, int);
int mySource1();
void testConfigurationSinks() {
  int x = mySource1();
  mySink(x, 1, 2);
  mySink(1, x, 2);
  mySink(1, 2, x);
}


x86 assembly (clang, -O0):
<testConfigurationSinks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <mySource1@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <mySink@plt>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <mySink@plt>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <mySink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testConfigurationSinks>:
push   %rbx
xor    %eax,%eax
call   1030 <mySource1@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <mySink@plt>
mov    $0x1,%edi
mov    %ebx,%esi
mov    $0x2,%edx
call   1040 <mySink@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    %ebx,%edx
pop    %rbx
jmp    1040 <mySink@plt>

LLVM IR (-O0):
define void @testConfigurationSinks() {
%1 = alloca i32
%2 = call i32 (...) @mySource1()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @mySink(i32 %3, i32 1, i32 2)
%5 = load i32, i32* %1
%6 = call i32 @mySink(i32 1, i32 %5, i32 2)
%7 = load i32, i32* %1
%8 = call i32 @mySink(i32 1, i32 2, i32 %7)
ret void
}

LLVM IR (-O2):
define void @testConfigurationSinks() {
%1 = tail call i32 (...) @mySource1()
%2 = tail call i32 @mySink(i32 %1, i32 1, i32 2)
%3 = tail call i32 @mySink(i32 1, i32 %1, i32 2)
%4 = tail call i32 @mySink(i32 1, i32 2, i32 %1)
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *barebox_calloc(size_t n, size_t elem_size) {
  return calloc(n, elem_size);
}


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

x86 assembly (clang, -O2):
<barebox_calloc>:
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @barebox_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strlen(char *);
void strcat(char *d, const char *s) {
  d += strlen(d);
  strcpy(d, s);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @strcat(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @strcpy(i8* %5, i8* %1)
ret void
}
void _Jv_ThrowBadArrayIndex() {}


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

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

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

LLVM IR (-O2):
define void @_Jv_ThrowBadArrayIndex() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AllocateImageRGB24(char const *, int, int, int,
                                      unsigned char *);
void rt_define_image(const char *name, signed int xs, signed int ys,
                     signed int zs, unsigned char *rgb) {
  AllocateImageRGB24(name, xs, ys, zs, rgb);
}


x86 assembly (clang, -O0):
<rt_define_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1030 <AllocateImageRGB24@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_define_image>:
jmp    1030 <AllocateImageRGB24@plt>

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

LLVM IR (-O2):
define void @rt_define_image(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = tail call i32 @AllocateImageRGB24(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
bool startwith(const char *str, const char *pre) {
  return strncmp(pre, str, strlen(pre)) == 0;
}


x86 assembly (clang, -O0):
<startwith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startwith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @startwith(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @startwith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %1, i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
struct sembuf {
  int sem_op;
  scalar_t__ sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int semop(int, struct sembuf *, int);
void sem_lock(int sem_set_id) {
  struct sembuf sem_op;
  int ret = -1;
  sem_op.sem_num = 0;
  sem_op.sem_op = -1;
  sem_op.sem_flg = 0;
  if ((ret = semop(sem_set_id, &sem_op, 1)) < 0) {
    perror("sem_lock error ");
  }
}


x86 assembly (clang, -O0):
<sem_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x24(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1040 <semop@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1172 <sem_lock+0x52>
lea    0xe93(%rip),%rdi
call   1030 <perror@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_lock>:
sub    $0x18,%rsp
movl   $0xffffffff,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
mov    %rsp,%rsi
mov    $0x1,%edx
call   1040 <semop@plt>
test   %eax,%eax
js     1149 <sem_lock+0x29>
add    $0x18,%rsp
ret
lea    0xeb0(%rip),%rdi
call   1030 <perror@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i64, i64 }
@.str = [16 x i8] c"sem_lock error \00"
define void @sem_lock(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sembuf
%4 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 2
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 0
store i32 -1, i32* %6
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 1
store i64 0, i64* %7
%8 = load i32, i32* %2
%9 = call i32 @semop(i32 %8, %struct.sembuf* %3, i32 1)
store i32 %9, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i64, i64 }
@.str = [16 x i8] c"sem_lock error \00"
define void @sem_lock(i32 %0) {
%2 = alloca %struct.sembuf
%3 = bitcast %struct.sembuf* %2 to i8*
%4 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 0
store i32 -1, i32* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 1
%6 = bitcast i64* %5 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %6
%7 = call i32 @semop(i32 %0, %struct.sembuf* %2, i32 1)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ isspace(char);
char next_c(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
void skip_ws(FILE *scene_file) {
  ((void)0);
  char c = next_c(scene_file);
  while (isspace(c)) {
    c = next_c(scene_file);
  }
  ungetc(c, scene_file);
  ((void)0);
}


x86 assembly (clang, -O0):
<skip_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <next_c@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     116c <skip_ws+0x3c>
mov    -0x8(%rbp),%rdi
call   1030 <next_c@plt>
mov    %al,-0x9(%rbp)
jmp    1148 <skip_ws+0x18>
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1050 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_ws>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
call   1030 <next_c@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1159 <skip_ws+0x29>
mov    %r14,%rdi
jmp    1140 <skip_ws+0x10>
movsbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ungetc@plt>

LLVM IR (-O0):
define void @skip_ws(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call signext i8 @next_c(i32* %4)
store i8 %5, i8* %3
br label %6
6: ; preds = %10, %1
%7 = load i8, i8* %3
%8 = call i64 @isspace(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32*, i32** %2
%12 = call signext i8 @next_c(i32* %11)
store i8 %12, i8* %3
br label %6
13: ; preds = %6
%14 = load i8, i8* %3
%15 = load i32*, i32** %2
%16 = call i32 @ungetc(i8 signext %14, i32* %15)
ret void
}

LLVM IR (-O2):
define void @skip_ws(i32* %0) {
%2 = tail call signext i8 @next_c(i32* %0)
%3 = tail call i64 @isspace(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1, %5
%6 = tail call signext i8 @next_c(i32* %0)
%7 = tail call i64 @isspace(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %1
%10 = phi i8 [ %2, %1 ], [ %6, %5 ]
%11 = tail call i32 @ungetc(i8 signext %10, i32* %0)
ret void
}
__attribute__((no, noclone)) signed __int128 t113_2sub(signed __int128 y) {
  signed __int128 x = (1);
  signed __int128 r;
  if (__builtin_sub_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t113_2sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
sub    %rsi,%rdx
sbb    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    116e <t113_2sub+0x5e>
jmp    1175 <t113_2sub+0x65>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t113_2sub>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
mov    $0x1,%ebx
sub    %rdi,%rbx
sbb    %rsi,%r14
jno    112b <t113_2sub+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t113_2sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 1, i128* %6
%12 = load i128, i128* %6
%13 = load i128, i128* %5
%14 = call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t113_2sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 1, i128 %6)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
char MCP4461_GetValue(int, int);
char getHeadStepper2Current(void) { return MCP4461_GetValue(0x58, 0x01); }


x86 assembly (clang, -O0):
<getHeadStepper2Current>:
push   %rbp
mov    %rsp,%rbp
mov    $0x58,%edi
mov    $0x1,%esi
call   1030 <MCP4461_GetValue@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHeadStepper2Current>:
mov    $0x58,%edi
mov    $0x1,%esi
jmp    1030 <MCP4461_GetValue@plt>

LLVM IR (-O0):
define signext i8 @getHeadStepper2Current() {
%1 = call signext i8 @MCP4461_GetValue(i32 88, i32 1)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @getHeadStepper2Current() {
%1 = tail call signext i8 @MCP4461_GetValue(i32 88, i32 1)
ret i8 %1
}
/* Variables and functions */
int /*<<< orphan*/ diag(char *, void *);
int /*<<< orphan*/ fail(char const *);
int /*<<< orphan*/ pass(char const *);
void isnt_p(void *got, void *expected, const char *description) {
  if (got != expected)
    pass(description);
  else {
    fail(description);
    diag("got address %p but expected any other address", got);
  }
}


x86 assembly (clang, -O0):
<isnt_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1160 <isnt_p+0x30>
mov    -0x18(%rbp),%rdi
call   1040 <pass@plt>
jmp    1179 <isnt_p+0x49>
mov    -0x18(%rbp),%rdi
call   1030 <fail@plt>
mov    -0x8(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1050 <diag@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnt_p>:
cmp    %rsi,%rdi
je     113d <isnt_p+0xd>
mov    %rdx,%rdi
jmp    1040 <pass@plt>
push   %rbx
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1030 <fail@plt>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <diag@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"got address %p but expected any other address\00"
define void @isnt_p(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = icmp ne i8* %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = call i32 @pass(i8* %11)
br label %18
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = call i32 @fail(i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @diag(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"got address %p but expected any other address\00"
define void @isnt_p(i8* %0, i8* readnone %1, i8* %2) {
%4 = icmp eq i8* %0, %1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @pass(i8* %2)
br label %10
7: ; preds = %3
%8 = tail call i32 @fail(i8* %2)
%9 = tail call i32 @diag(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %7, %5
ret void
}
int test_imm_D7int8_mem(signed char *val) {
  return ((*val) & (0xD7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D7int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xd7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D7int8_mem>:
testb  $0xd7,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D7int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 215
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_D7int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -41
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ isfname(int);
int tofname(int c) { return isfname(c) ? c : '_'; }


x86 assembly (clang, -O0):
<tofname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isfname@plt>
cmp    $0x0,%rax
je     1138 <tofname+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <tofname+0x35>
mov    $0x5f,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <tofname+0x35>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tofname>:
push   %rbx
mov    %edi,%ebx
call   1030 <isfname@plt>
test   %rax,%rax
mov    $0x5f,%eax
cmovne %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @tofname(i32 %0) {
%2 = tail call i64 @isfname(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 95, i32 %0
ret i32 %4
}
float det2x2(float *a, float *b, float *c, float *d) {
  float result = (*a) * (*d) - (*c) * (*b);
  return result;
}


x86 assembly (clang, -O0):
<det2x2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<det2x2>:
movss  (%rsi),%xmm1
mulss  (%rdx),%xmm1
movss  (%rdi),%xmm0
mulss  (%rcx),%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @det2x2(float* %0, float* %1, float* %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store float* %3, float** %8
%10 = load float*, float** %5
%11 = load float, float* %10
%12 = load float*, float** %8
%13 = load float, float* %12
%14 = load float*, float** %7
%15 = load float, float* %14
%16 = load float*, float** %6
%17 = load float, float* %16
%18 = fmul float %15, %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %11, float %13, float %19)
store float %20, float* %9
%21 = load float, float* %9
ret float %21
}

LLVM IR (-O2):
define float @det2x2(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3) {
%5 = load float, float* %0
%6 = load float, float* %3
%7 = load float, float* %2
%8 = load float, float* %1
%9 = fneg float %7
%10 = fmul float %8, %9
%11 = tail call float @llvm.fmuladd.f32(float %5, float %6, float %10)
ret float %11
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int genrand(char *buf, int count) {
  int i;
  srand(time(0));
  for (i = 0; i < count; i++)
    buf[i] = rand() % 128;
}


x86 assembly (clang, -O0):
<genrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1188 <genrand+0x58>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1154 <genrand+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genrand>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    1174 <genrand+0x44>
mov    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0x80,%ecx
sub    %ecx,%eax
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <genrand+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @genrand(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 128
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %12, i8* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("ezp-i2c [gauge|security] ...\n");
  printf("ezp-i2c gauge [voltage|host|client] ...\n");
  printf("ezp-i2c gauge host [booting|ready|sleep]\n");
  exit(0);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"ezp-i2c [gauge|security] ...\0A\00"
@.str.1 = [41 x i8] c"ezp-i2c gauge [voltage|host|client] ...\0A\00"
@.str.2 = [42 x i8] c"ezp-i2c gauge host [booting|ready|sleep]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [29 x i8] c"ezp-i2c [gauge|security] ...\00"
@str.3 = [40 x i8] c"ezp-i2c gauge [voltage|host|client] ...\00"
@str.4 = [41 x i8] c"ezp-i2c gauge host [booting|ready|sleep]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
long geq(unsigned long a, unsigned long b) { return a >= b; }


x86 assembly (clang, -O0):
<geq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setae  %al
and    $0x1,%al
movzbl %al,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<geq>:
xor    %eax,%eax
cmp    %rsi,%rdi
setae  %al
ret

LLVM IR (-O0):
define i64 @geq(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp uge i64 %5, %6
%8 = zext i1 %7 to i32
%9 = sext i32 %8 to i64
ret i64 %9
}

LLVM IR (-O2):
define i64 @geq(i64 %0, i64 %1) {
%3 = icmp uge i64 %0, %1
%4 = zext i1 %3 to i64
ret i64 %4
}
int heap_right(int i) { return ((i << 1) | 0x01); }


x86 assembly (clang, -O0):
<heap_right>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
or     $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_right>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @heap_right(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 1
%5 = or i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @heap_right(i32 %0) {
%2 = shl i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
int adds_si_test1(int a, int b, int c) {
  int d = a + b;
  if (d <= 0)
    return a + c;
  else
    return b + d + c;
}


x86 assembly (clang, -O0):
<adds_si_test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     112e <adds_si_test1+0x2e>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113a <adds_si_test1+0x3a>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adds_si_test1>:
lea    (%rsi,%rdi,1),%ecx
lea    (%rsi,%rcx,1),%eax
test   %ecx,%ecx
cmovle %edi,%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @adds_si_test1(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = icmp slt i32 %4, 1
%6 = add nsw i32 %4, %1
%7 = select i1 %5, i32 %0, i32 %6
%8 = add nsw i32 %7, %2
ret i32 %8
}
/* Variables and functions */
int get_dimlen(char const *, char *);
int read_mosaic_ntiles(const char *mosaic_file) {
  int ntiles;
  ntiles = get_dimlen(mosaic_file, "ntiles");
  return ntiles;
}


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

x86 assembly (clang, -O2):
<read_mosaic_ntiles>:
lea    0xee9(%rip),%rsi
jmp    1030 <get_dimlen@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"ntiles\00"
define i32 @read_mosaic_ntiles(i8* %0) {
%2 = tail call i32 @get_dimlen(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
adrreg0indreg1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((p0[10000000]) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0indreg1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x4c4b400(%rax),%xmm1
04
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1146 <adrreg0indreg1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <adrreg0indreg1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0indreg1>:
movsd  (%rcx),%xmm0
xor    %eax,%eax
ucomisd 0x4c4b400(%rdx),%xmm0
04
setae  %al
ret

LLVM IR (-O0):
define i32 @adrreg0indreg1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double*, double** %12
%15 = getelementptr inbounds double, double* %14, i64 10000000
%16 = load double, double* %15
%17 = load double*, double** %13
%18 = load double, double* %17
%19 = fcmp ole double %16, %18
br i1 %19, label %20, label %21
20: ; preds = %6
store i32 1, i32* %7
br label %22
21: ; preds = %6
store i32 0, i32* %7
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
define i32 @adrreg0indreg1(double %0, double %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture %5) {
%7 = getelementptr inbounds double, double* %4, i64 10000000
%8 = load double, double* %7
%9 = load double, double* %5
%10 = fcmp ole double %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t _ntohs(uint16_t n) { return ntohs(n); }


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

x86 assembly (clang, -O2):
<_ntohs>:
jmp    1030 <ntohs@plt>

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

LLVM IR (-O2):
define i32 @_ntohs(i32 %0) {
%2 = tail call i32 @ntohs(i32 %0)
ret i32 %2
}
int Operand_bt2_encode(unsigned int *valp) {
  int error;
  error = (*valp & ~(0x7 << 1)) != 0;
  *valp = *valp >> 1;
  return error;
}


x86 assembly (clang, -O0):
<Operand_bt2_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xfffffff1,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shr    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_bt2_encode>:
mov    (%rdi),%ecx
xor    %eax,%eax
test   $0xfffffff1,%ecx
setne  %al
shr    %ecx
mov    %ecx,(%rdi)
ret

LLVM IR (-O0):
define i32 @Operand_bt2_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = and i32 %5, -15
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = lshr i32 %10, 1
%12 = load i32*, i32** %2
store i32 %11, i32* %12
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @Operand_bt2_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, -15
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = lshr i32 %2, 1
store i32 %6, i32* %0
ret i32 %5
}
int test_imm_61uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x61 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_61uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0x61,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_61uint64_highword_mem>:
testb  $0x61,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_61uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 97
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_61uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 416611827712
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned microval(int n, int d) {
  return (unsigned)((256.0 * (n - 1.0)) + (d - 1.0));
}


x86 assembly (clang, -O0):
<microval>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xee9(%rip),%xmm2
subsd  %xmm2,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
subsd  %xmm2,%xmm1
movsd  0xedc(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<microval>:
cvtsi2sd %edi,%xmm0
movsd  0xef4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sd %esi,%xmm2
mulsd  0xeec(%rip),%xmm0
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i32 @microval(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 = sitofp i32 %5 to double
%7 = fsub double %6, 1.000000e+00
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to double
%10 = fsub double %9, 1.000000e+00
%11 = call double @llvm.fmuladd.f64(double 2.560000e+02, double %7, double %10)
%12 = fptoui double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @microval(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = fadd double %3, -1.000000e+00
%5 = sitofp i32 %1 to double
%6 = fadd double %5, -1.000000e+00
%7 = tail call double @llvm.fmuladd.f64(double %4, double 2.560000e+02, double %6)
%8 = fptoui double %7 to i32
ret i32 %8
}