xunge/DecIR huggingface dataset:
void gtk_binding_entry_remove() {}


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

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

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

LLVM IR (-O2):
define void @gtk_binding_entry_remove() {
ret void
}
void clear_nvector(double *vec, long n) {
  register long i;
  for (i = 0; i <= n; i++)
    vec[i] = 0;
}


x86 assembly (clang, -O0):
<clear_nvector>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1143 <clear_nvector+0x43>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <clear_nvector+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_nvector>:
test   %rsi,%rsi
js     1129 <clear_nvector+0x19>
push   %rax
lea    0x8(,%rsi,8),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @clear_nvector(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca i64
store double* %0, double** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp sle i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds double, double* %11, i64 %12
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %10
%15 = load i64, i64* %5
%16 = add nsw i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @clear_nvector(double* nocapture writeonly %0, i64 %1) {
%3 = icmp slt i64 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = shl i64 %1, 3
%7 = add i64 %6, 8
br label %8
8: ; preds = %4, %2
ret void
}
void XSharpSendClose(void *dpy, unsigned long window) {}


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

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

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

LLVM IR (-O2):
define void @XSharpSendClose(i8* nocapture %0, i64 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void down_arrow(void) { printf("Hey, you pressed the down arrow! \n"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"Hey, you pressed the down arrow! \0A\00"
define void @down_arrow() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"Hey, you pressed the down arrow! \00"
define void @down_arrow() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MD5toa(char *, char *);
int /*<<< orphan*/ toMD5X(char const *, int, char *);
void toMD5Y(const char *str, int len, char md5[]) {
  char digest[16];
  toMD5X(str, len, digest);
  MD5toa(digest, md5);
}


x86 assembly (clang, -O0):
<toMD5Y>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1030 <toMD5X@plt>
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <MD5toa@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toMD5Y>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsp,%r14
mov    %r14,%rdx
call   1030 <toMD5X@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <MD5toa@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @toMD5Y(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [16 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%11 = call i32 @toMD5X(i8* %8, i32 %9, i8* %10)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i32 @MD5toa(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
define void @toMD5Y(i8* %0, i32 %1, i8* %2) {
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%6 = call i32 @toMD5X(i8* %0, i32 %1, i8* %5)
%7 = call i32 @MD5toa(i8* %5, i8* %2)
ret void
}
/* Variables and functions */
int median2(int, int);
int handle(int n, int hex) {
  int m, r = n;
  while (n != 0) {
    m = median2(n, hex);
    r += n % hex * m;
    n = (n - (n % hex)) / hex;
  }
  return r;
}


x86 assembly (clang, -O0):
<handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     116d <handle+0x5d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <median2@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0x14(%rbp),%eax
sub    %edx,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1124 <handle+0x14>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     113f <handle+0x2f>
mov    %esi,%r14d
mov    %edi,%ebp
mov    %edi,%ebx
nop
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <median2@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %r14d
imul   %ecx,%edx
add    %edx,%ebp
mov    %eax,%ebx
test   %eax,%eax
jne    1120 <handle+0x10>
jmp    1141 <handle+0x31>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @handle(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* %3
store i32 %7, i32* %6
br label %8
8: ; preds = %11, %2
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @median2(i32 %12, i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = srem i32 %15, %16
%18 = load i32, i32* %5
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %6
%21 = add nsw i32 %20, %19
store i32 %21, i32* %6
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = srem i32 %23, %24
%26 = sub nsw i32 %22, %25
%27 = load i32, i32* %4
%28 = sdiv i32 %26, %27
store i32 %28, i32* %3
br label %8
29: ; preds = %8
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
define i32 @handle(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ %0, %2 ]
%7 = tail call i32 @median2(i32 %6, i32 %1)
%8 = srem i32 %6, %1
%9 = mul nsw i32 %8, %7
%10 = add nsw i32 %9, %5
%11 = sdiv i32 %6, %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ %10, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ *ARG_gets();
char ARG_count() {
  char count = 1;
  while (ARG_gets() != NULL)
    count++;
  return count;
}


x86 assembly (clang, -O0):
<ARG_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x1(%rbp)
mov    $0x0,%al
call   1030 <ARG_gets@plt>
cmp    $0x0,%rax
je     113a <ARG_count+0x2a>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    111c <ARG_count+0xc>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ARG_count>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <ARG_gets@plt>
add    $0x1,%bl
test   %rax,%rax
jne    1120 <ARG_count+0x10>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @ARG_count() {
%1 = alloca i8
store i8 1, i8* %1
br label %2
2: ; preds = %5, %0
%3 = call i32* (...) @ARG_gets()
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8, i8* %1
%7 = add i8 %6, 1
store i8 %7, i8* %1
br label %2
8: ; preds = %2
%9 = load i8, i8* %1
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @ARG_count() {
br label %1
1: ; preds = %1, %0
%2 = phi i8 [ 1, %0 ], [ %5, %1 ]
%3 = tail call i32* (...) @ARG_gets()
%4 = icmp eq i32* %3, null
%5 = add i8 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
ret i8 %2
}
int __libc_current_sigrtmax() { return 64; }


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

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

LLVM IR (-O0):
define i32 @__libc_current_sigrtmax() {
ret i32 64
}

LLVM IR (-O2):
define i32 @__libc_current_sigrtmax() {
ret i32 64
}
/* Variables and functions */
int ff_up(int);
double ff_d_up(double x) {
  return 2. * (ff_up(2. * x + 1.) - ff_up(2. * x - 1.));
}


x86 assembly (clang, -O0):
<ff_d_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ff_up@plt>
mov    %eax,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ff_up@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe91(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_d_up>:
push   %rbx
sub    $0x10,%rsp
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xed9(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <ff_up@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
addsd  0xec4(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ff_up@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @ff_d_up(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %3, double 1.000000e+00)
%5 = fptosi double %4 to i32
%6 = call i32 @ff_up(i32 %5)
%7 = load double, double* %2
%8 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %7, double -1.000000e+00)
%9 = fptosi double %8 to i32
%10 = call i32 @ff_up(i32 %9)
%11 = sub nsw i32 %6, %10
%12 = sitofp i32 %11 to double
%13 = fmul double 2.000000e+00, %12
ret double %13
}

LLVM IR (-O2):
define double @ff_d_up(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double 1.000000e+00)
%3 = fptosi double %2 to i32
%4 = tail call i32 @ff_up(i32 %3)
%5 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%6 = fptosi double %5 to i32
%7 = tail call i32 @ff_up(i32 %6)
%8 = sub nsw i32 %4, %7
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 2.000000e+00
ret double %10
}
int test_imm_C4int16_reg(short val) {
  return ((val) & (0xC4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C4int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xc4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C4int16_reg>:
test   $0xc4,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C4int16_reg(i16 signext %0) {
%2 = and i16 %0, 196
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct _Locale_name_hint {
  int dummy;
};
struct _Locale_ctype {
  int dummy;
};

/* Variables and functions */
struct _Locale_name_hint *_Locale_get_ctype_hint(struct _Locale_ctype *ctype) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct._Locale_name_hint = type { i32 }
%struct._Locale_ctype = type { i32 }
define %struct._Locale_name_hint* @_Locale_get_ctype_hint(%struct._Locale_ctype* %0) {
%2 = alloca %struct._Locale_ctype*
store %struct._Locale_ctype* %0, %struct._Locale_ctype** %2
ret %struct._Locale_name_hint* null
}

LLVM IR (-O2):
%struct._Locale_name_hint = type { i32 }
%struct._Locale_ctype = type { i32 }
define noalias %struct._Locale_name_hint* @_Locale_get_ctype_hint(%struct._Locale_ctype* nocapture readnone %0) {
ret %struct._Locale_name_hint* null
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int cal(int, int);
int main(int argc, char **argv) {
  int ret = cal(1, 2);
  if (ret != 8)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <cal@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
je     1159 <main+0x39>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <cal@plt>
cmp    $0x8,%eax
jne    1139 <main+0x19>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @cal(i32 1, i32 2)
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @cal(i32 1, i32 2)
%4 = icmp eq i32 %3, 8
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i32 0
}
int substr_count(char needle, char const *haystack) {
  int k = 0;
  while (*haystack++) {
    if (needle == *haystack)
      k++;
  }
  return k;
}


x86 assembly (clang, -O0):
<substr_count>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     114e <substr_count+0x4e>
movsbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1149 <substr_count+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <substr_count+0x15>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<substr_count>:
cmpb   $0x0,(%rsi)
je     1126 <substr_count+0x26>
add    $0x1,%rsi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
xor    %edx,%edx
cmp    %dil,%cl
sete   %dl
add    %edx,%eax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <substr_count+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @substr_count(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %0
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %7, %11
%13 = icmp eq i8 %9, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %15
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
pid_t getpid(void) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<getpid>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<getpid>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @getpid() {
%1 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define i32 @getpid() {
%1 = tail call i32 @_exit(i32 -1)
unreachable
}
void swap(float *a, float *b) {
  float c = *a;
  *a = *b;
  *b = c;
}


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

x86 assembly (clang, -O2):
<swap>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  %xmm1,(%rdi)
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @swap(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = load float, float* %6
store float %7, float* %5
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = load float*, float** %3
store float %9, float* %10
%11 = load float, float* %5
%12 = load float*, float** %4
store float %11, float* %12
ret void
}

LLVM IR (-O2):
define void @swap(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
store float %4, float* %0
store float %3, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
void *realloc(void *, unsigned int);
int /*<<< orphan*/ stderr;
void *xrealloc(void *pt, unsigned int size) {
  void *ptnew = realloc(pt, size);
  if (!ptnew) {
    fprintf(stderr, "%s: Out of memory!\n", "xrealloc");
    exit(2);
  }
  return ptnew;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <xrealloc+0x50>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
lea    0xea3(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
lea    0xec0(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"%s: Out of memory!\0A\00"
@.str.1 = [9 x i8] c"xrealloc\00"
define i8* @xrealloc(i8* %0, i32 %1) {
%3 = tail call i8* @realloc(i8* %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 2)
unreachable
9: ; preds = %2
ret i8* %3
}
int not_picked4() { return 11; }


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

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

LLVM IR (-O0):
define i32 @not_picked4() {
ret i32 11
}

LLVM IR (-O2):
define i32 @not_picked4() {
ret i32 11
}
/* Type definitions */
struct defmoduleItemHeader {
  int dummy;
};
struct constructHeader {
  int dummy;
};

/* Variables and functions */
struct defmoduleItemHeader *GetConstructModuleItem(struct constructHeader *);
struct defmoduleItemHeader *EnvGetDefclassModule(void *theEnv, void *theClass) {
  return GetConstructModuleItem((struct constructHeader *)theClass);
}


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

x86 assembly (clang, -O2):
<EnvGetDefclassModule>:
mov    %rsi,%rdi
jmp    1030 <GetConstructModuleItem@plt>

LLVM IR (-O0):
%struct.defmoduleItemHeader = type { i32 }
%struct.constructHeader = type { i32 }
define %struct.defmoduleItemHeader* @EnvGetDefclassModule(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 = bitcast i8* %5 to %struct.constructHeader*
%7 = call %struct.defmoduleItemHeader* @GetConstructModuleItem(%struct.constructHeader* %6)
ret %struct.defmoduleItemHeader* %7
}

LLVM IR (-O2):
%struct.defmoduleItemHeader = type { i32 }
%struct.constructHeader = type { i32 }
define %struct.defmoduleItemHeader* @EnvGetDefclassModule(i8* nocapture readnone %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.constructHeader*
%4 = tail call %struct.defmoduleItemHeader* @GetConstructModuleItem(%struct.constructHeader* %3)
ret %struct.defmoduleItemHeader* %4
}
int cvmx_atomic_get32(volatile int *ptr) { return *ptr; }


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

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

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

LLVM IR (-O2):
define i32 @cvmx_atomic_get32(i32* %0) {
%2 = load volatile i32, i32* %0
ret i32 %2
}
void lgtd_lifx_bulb_set_ambient_light(struct lgtd_lifx_bulb *bulb,
                                      float illuminance) {
  (void)bulb;
  (void)illuminance;
}


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

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

LLVM IR (-O0):
%struct.lgtd_lifx_bulb = type opaque
define void @lgtd_lifx_bulb_set_ambient_light(%struct.lgtd_lifx_bulb* %0, float %1) {
%3 = alloca %struct.lgtd_lifx_bulb*
%4 = alloca float
store %struct.lgtd_lifx_bulb* %0, %struct.lgtd_lifx_bulb** %3
store float %1, float* %4
%5 = load %struct.lgtd_lifx_bulb*, %struct.lgtd_lifx_bulb** %3
%6 = load float, float* %4
ret void
}

LLVM IR (-O2):
%struct.lgtd_lifx_bulb = type opaque
define void @lgtd_lifx_bulb_set_ambient_light(%struct.lgtd_lifx_bulb* nocapture %0, float %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int __VERIFIER_nondet_int();
int id(int);
void main() {
  int input = __VERIFIER_nondet_int();
  int result = id(input);
  if (result == 20) {
    __VERIFIER_error();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <id@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jne    115e <main+0x2e>
mov    $0x0,%al
call   1040 <__VERIFIER_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%edi
call   1050 <id@plt>
cmp    $0x14,%eax
jne    114c <main+0x1c>
xor    %eax,%eax
pop    %rcx
jmp    1040 <__VERIFIER_error@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @id(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 20
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @__VERIFIER_error()
br label %10
10: ; preds = %8, %0
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 @id(i32 %1)
%3 = icmp eq i32 %2, 20
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @__VERIFIER_error()
br label %6
6: ; preds = %4, %0
ret void
}
int standby_int_query(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @standby_int_query() {
ret i32 0
}
float fabsf(float x) {
  float t;
  __asm__ __volatile__("pcmpeqd %0, %0" : "=x"(t));
  __asm__ __volatile__("psrld   $1, %0" : "+x"(t));
  __asm__ __volatile__("andps   %1, %0" : "+x"(x) : "x"(t));
  return x;
}


x86 assembly (clang, -O0):
<fabsf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
pcmpeqd %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
psrld  $0x1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
andps  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabsf>:
pcmpeqd %xmm1,%xmm1
psrld  $0x1,%xmm1
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fabsf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = call float asm sideeffect "pcmpeqd $0, $0", "=x,~{dirflag},~{fpsr},~{flags}"()
store float %4, float* %3
%5 = load float, float* %3
%6 = call float asm sideeffect "psrld $$1, $0", "=x,0,~{dirflag},~{fpsr},~{flags}"(float %5)
store float %6, float* %3
%7 = load float, float* %2
%8 = load float, float* %3
%9 = call float asm sideeffect "andps $1, $0", "=x,x,0,~{dirflag},~{fpsr},~{flags}"(float %8, float %7)
store float %9, float* %2
%10 = load float, float* %2
ret float %10
}

LLVM IR (-O2):
define float @fabsf(float %0) {
%2 = tail call float asm sideeffect "pcmpeqd $0, $0", "=x,~{dirflag},~{fpsr},~{flags}"()
%3 = tail call float asm sideeffect "psrld $$1, $0", "=x,0,~{dirflag},~{fpsr},~{flags}"(float %2)
%4 = tail call float asm sideeffect "andps $1, $0", "=x,x,0,~{dirflag},~{fpsr},~{flags}"(float %3, float %0)
ret float %4
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int setenv(char *, char *, int);
int main() {
  const char *key = "PWD";
  char *val;
  int i = setenv("MY", "name", 1);
  val = getenv("PATH");
  printf("%s\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec4(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xeb1(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"PWD\00"
@.str.1 = [3 x i8] c"MY\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [5 x i8] c"PATH\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 %5, i32* %4
%6 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"MY\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [5 x i8] c"PATH\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 @setenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
double wavegen_sawtooth(double);
double wavegen_square(double time) {
  double duty = 0.5;
  return wavegen_sawtooth(time) - wavegen_sawtooth(time - duty);
}


x86 assembly (clang, -O0):
<wavegen_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <wavegen_sawtooth@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <wavegen_sawtooth@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wavegen_square>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <wavegen_sawtooth@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xecd(%rip),%xmm0
call   1030 <wavegen_sawtooth@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @wavegen_square(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 5.000000e-01, double* %3
%4 = load double, double* %2
%5 = call double @wavegen_sawtooth(double %4)
%6 = load double, double* %2
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = call double @wavegen_sawtooth(double %8)
%10 = fsub double %5, %9
ret double %10
}

LLVM IR (-O2):
define double @wavegen_square(double %0) {
%2 = tail call double @wavegen_sawtooth(double %0)
%3 = fadd double %0, -5.000000e-01
%4 = tail call double @wavegen_sawtooth(double %3)
%5 = fsub double %2, %4
ret double %5
}
/* Variables and functions */
int jtag_write_bit(int);
int tap_set_shift_dr(void) {
  int err = 0x0;
  err |= jtag_write_bit((0x02));
  err |= jtag_write_bit(0);
  err |= jtag_write_bit(0);
  return err;
}


x86 assembly (clang, -O0):
<tap_set_shift_dr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1030 <jtag_write_bit@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %edi,%edi
call   1030 <jtag_write_bit@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %edi,%edi
call   1030 <jtag_write_bit@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tap_set_shift_dr>:
push   %rbp
push   %rbx
push   %rax
mov    $0x2,%edi
call   1030 <jtag_write_bit@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1030 <jtag_write_bit@plt>
mov    %eax,%ebp
or     %ebx,%ebp
xor    %edi,%edi
call   1030 <jtag_write_bit@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @tap_set_shift_dr() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @jtag_write_bit(i32 2)
%3 = load i32, i32* %1
%4 = or i32 %3, %2
store i32 %4, i32* %1
%5 = call i32 @jtag_write_bit(i32 0)
%6 = load i32, i32* %1
%7 = or i32 %6, %5
store i32 %7, i32* %1
%8 = call i32 @jtag_write_bit(i32 0)
%9 = load i32, i32* %1
%10 = or i32 %9, %8
store i32 %10, i32* %1
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @tap_set_shift_dr() {
%1 = tail call i32 @jtag_write_bit(i32 2)
%2 = tail call i32 @jtag_write_bit(i32 0)
%3 = or i32 %2, %1
%4 = tail call i32 @jtag_write_bit(i32 0)
%5 = or i32 %3, %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int OptIs(const char *cmd, const char *opt) {
  return (cmd[0] == '-' && cmd[1] == '-' && strcmp(cmd + 2, opt) == 0) ? 1 : 0;
}


x86 assembly (clang, -O0):
<OptIs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x11(%rbp)
jne    1166 <OptIs+0x56>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x11(%rbp)
jne    1166 <OptIs+0x56>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OptIs>:
push   %rax
xor    %eax,%eax
cmpb   $0x2d,(%rdi)
jne    1132 <OptIs+0x22>
cmpb   $0x2d,0x1(%rdi)
jne    1132 <OptIs+0x22>
add    $0x2,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @OptIs(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 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 45
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8*, i8** %4
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br label %22
22: ; preds = %16, %10, %2
%23 = phi i1 [ false, %10 ], [ false, %2 ], [ %21, %16 ]
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 1, i32 0
ret i32 %25
}

LLVM IR (-O2):
define i32 @OptIs(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 45
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = tail call i64 @strcmp(i8* %10, i8* %1)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %5, %2
%15 = phi i32 [ 0, %5 ], [ 0, %2 ], [ %13, %9 ]
ret i32 %15
}
int dimension(const int idx) {
  int rval;
  if (idx == 11)
    rval = 2;
  else if (idx == 14)
    rval = 1;
  else
    rval = 3;
  return (rval);
}


x86 assembly (clang, -O0):
<dimension>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xb,-0x4(%rbp)
jne    111d <dimension+0x1d>
movl   $0x2,-0x8(%rbp)
jmp    113f <dimension+0x3f>
cmpl   $0xe,-0x4(%rbp)
jne    1133 <dimension+0x33>
movl   $0x1,-0x8(%rbp)
jmp    113a <dimension+0x3a>
movl   $0x3,-0x8(%rbp)
jmp    113f <dimension+0x3f>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dimension>:
xor    %eax,%eax
cmp    $0xe,%edi
setne  %al
lea    (%rax,%rax,1),%ecx
add    $0x1,%ecx
cmp    $0xb,%edi
mov    $0x2,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @dimension(i32 %0) {
%2 = icmp eq i32 %0, 14
%3 = select i1 %2, i32 1, i32 3
%4 = icmp eq i32 %0, 11
%5 = select i1 %4, i32 2, i32 %3
ret i32 %5
}
/* Variables and functions */
char *strcpy(char *restrict s1, const char *restrict s2) {
  size_t n;
  for (n = 0; s2[n] != '\0'; ++n) {
    s1[n] = s2[n];
  }
  s1[n] = '\0';
  return s1;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1150 <strcpy+0x50>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%dl
xor    %ecx,%ecx
test   %dl,%dl
je     1120 <strcpy+0x20>
nopl   0x0(%rax,%rax,1)
mov    %dl,(%rax,%rcx,1)
movzbl 0x1(%rsi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
movb   $0x0,(%rax,%rcx,1)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* noalias returned writeonly %0, i8* noalias nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i64 [ %9, %5 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %6, i8* %8
%9 = add i64 %7, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i64 [ 0, %2 ], [ %9, %5 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8 0, i8* %15
ret i8* %0
}
long double cosl(long double x) {
  long double xsquare = x * x;
  return 1 - xsquare / 2 + xsquare * xsquare / 24 -
         xsquare * xsquare * xsquare / 720 +
         xsquare * xsquare * xsquare * xsquare / 40320;
}


x86 assembly (clang, -O0):
<cosl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fmul   %st,%st(0)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
flds   0xee5(%rip)
fdivr  %st(1),%st
fld1
faddp  %st,%st(1)
fld    %st(1)
fmul   %st(2),%st
flds   0xed9(%rip)
fdivr  %st(1),%st
faddp  %st,%st(2)
fmul   %st(2),%st
flds   0xed1(%rip)
fdivr  %st(1),%st
faddp  %st,%st(2)
fmulp  %st,%st(2)
flds   0xec9(%rip)
fdivrp %st,%st(2)
faddp  %st,%st(1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosl>:
fldt   0x8(%rsp)
fmul   %st,%st(0)
fld    %st(0)
fmuls  0xef2(%rip)
fld1
faddp  %st,%st(1)
fld    %st(1)
fmul   %st(2),%st
fld    %st(0)
fdivs  0xee6(%rip)
faddp  %st,%st(2)
fmul   %st(2),%st
fld    %st(0)
fdivs  0xede(%rip)
faddp  %st,%st(2)
fmulp  %st,%st(2)
fxch   %st(1)
fdivs  0xed6(%rip)
faddp  %st,%st(1)
ret

LLVM IR (-O0):
define x86_fp80 @cosl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* %2
%5 = load x86_fp80, x86_fp80* %2
%6 = fmul x86_fp80 %4, %5
store x86_fp80 %6, x86_fp80* %3
%7 = load x86_fp80, x86_fp80* %3
%8 = fdiv x86_fp80 %7, 0xK40008000000000000000
%9 = fsub x86_fp80 0xK3FFF8000000000000000, %8
%10 = load x86_fp80, x86_fp80* %3
%11 = load x86_fp80, x86_fp80* %3
%12 = fmul x86_fp80 %10, %11
%13 = fdiv x86_fp80 %12, 0xK4003C000000000000000
%14 = fadd x86_fp80 %9, %13
%15 = load x86_fp80, x86_fp80* %3
%16 = load x86_fp80, x86_fp80* %3
%17 = fmul x86_fp80 %15, %16
%18 = load x86_fp80, x86_fp80* %3
%19 = fmul x86_fp80 %17, %18
%20 = fdiv x86_fp80 %19, 0xK4008B400000000000000
%21 = fsub x86_fp80 %14, %20
%22 = load x86_fp80, x86_fp80* %3
%23 = load x86_fp80, x86_fp80* %3
%24 = fmul x86_fp80 %22, %23
%25 = load x86_fp80, x86_fp80* %3
%26 = fmul x86_fp80 %24, %25
%27 = load x86_fp80, x86_fp80* %3
%28 = fmul x86_fp80 %26, %27
%29 = fdiv x86_fp80 %28, 0xK400E9D80000000000000
%30 = fadd x86_fp80 %21, %29
ret x86_fp80 %30
}

LLVM IR (-O2):
define x86_fp80 @cosl(x86_fp80 %0) {
%2 = fmul x86_fp80 %0, %0
%3 = fmul x86_fp80 %2, 0xK3FFE8000000000000000
%4 = fsub x86_fp80 0xK3FFF8000000000000000, %3
%5 = fmul x86_fp80 %2, %2
%6 = fdiv x86_fp80 %5, 0xK4003C000000000000000
%7 = fadd x86_fp80 %4, %6
%8 = fmul x86_fp80 %2, %5
%9 = fdiv x86_fp80 %8, 0xK4008B400000000000000
%10 = fsub x86_fp80 %7, %9
%11 = fmul x86_fp80 %2, %8
%12 = fdiv x86_fp80 %11, 0xK400E9D80000000000000
%13 = fadd x86_fp80 %10, %12
ret x86_fp80 %13
}
signed short font_probe(struct tff_file_hdr *tff) { return 1; }


x86 assembly (clang, -O0):
<font_probe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%ax
cwtl
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tff_file_hdr = type opaque
define signext i16 @font_probe(%struct.tff_file_hdr* %0) {
%2 = alloca %struct.tff_file_hdr*
store %struct.tff_file_hdr* %0, %struct.tff_file_hdr** %2
ret i16 1
}

LLVM IR (-O2):
%struct.tff_file_hdr = type opaque
define signext i16 @font_probe(%struct.tff_file_hdr* nocapture readnone %0) {
ret i16 1
}
/* Type definitions */
typedef scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ lseek(int, scalar_t__, int);
int /*<<< orphan*/ perror(char *);
void lseek_X(int fd, off_t offset, int whence) {
  off_t seek = lseek(fd, offset, whence);
  if (seek == (off_t)-1) {
    do {
      perror("lseek");
      exit(EXIT_FAILURE);
    } while (0);
  }
}


x86 assembly (clang, -O0):
<lseek_X>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <lseek@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0xffffffffffffffff,-0x20(%rbp)
jne    117f <lseek_X+0x4f>
jmp    1165 <lseek_X+0x35>
lea    0xe94(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lseek_X>:
push   %rax
call   1030 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
je     113e <lseek_X+0xe>
pop    %rax
ret
lea    0xebb(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"lseek\00"
@EXIT_FAILURE = global i32 0
define void @lseek_X(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i64, i64* %5
%10 = load i32, i32* %6
%11 = call i64 @lseek(i32 %8, i64 %9, i32 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = icmp eq i64 %12, -1
br i1 %13, label %14, label %20
14: ; preds = %3
br label %15
15: ; preds = %14
%16 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; No predecessors!
br label %20
20: ; preds = %19, %3
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"lseek\00"
@EXIT_FAILURE = global i32 0
define void @lseek_X(i32 %0, i64 %1, i32 %2) {
%4 = tail call i64 @lseek(i32 %0, i64 %1, i32 %2)
%5 = icmp eq i64 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %3
ret void
}
/* Variables and functions */
size_t snprintf(char *, size_t, char *, int const);
size_t convert_inttostr(const void *integer, size_t sizeof_int, char *out,
                        size_t out_len) {
  if (sizeof_int == sizeof(int)) {
    const int *ptr = integer;
    return snprintf(out, out_len, "%d", *ptr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<convert_inttostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x4,-0x18(%rbp)
jne    115e <convert_inttostr+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
lea    0xeb0(%rip),%rdx
call   1030 <snprintf@plt>
mov    %rax,-0x8(%rbp)
jmp    1166 <convert_inttostr+0x56>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_inttostr>:
cmp    $0x4,%rsi
jne    112f <convert_inttostr+0x1f>
mov    (%rdi),%eax
lea    0xee1(%rip),%r8
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
mov    %eax,%ecx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i64 @convert_inttostr(i8* nocapture %0, i64 %1, i8* %2, i64 %3) {
%5 = icmp eq i64 %1, 4
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = bitcast i8* %0 to i32*
%8 = load i32, i32* %7
%9 = tail call i64 @snprintf(i8* %2, i64 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %4, %6
%11 = phi i64 [ %9, %6 ], [ 0, %4 ]
ret i64 %11
}