xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ system(char *);
int ShowImageSys(char *img_name) {
  char *ptr;
  ptr = (char *)malloc(100 * sizeof(char));
  sprintf(ptr, "display ../scenes/images/%s", img_name);
  if (system(ptr))
    return -1;
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<ShowImageSys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe97(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%rax
je     118d <ShowImageSys+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <ShowImageSys+0x5d>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowImageSys>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea5(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1185 <ShowImageSys+0x45>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"display ../scenes/images/%s\00"
define i32 @ShowImageSys(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = call i64 @malloc(i32 100)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %4
%11 = call i64 @system(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %17
14: ; preds = %1
%15 = load i8*, i8** %4
%16 = call i32 @free(i8* %15)
store i32 0, i32* %2
br label %17
17: ; preds = %14, %13
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@.str = [28 x i8] c"display ../scenes/images/%s\00"
define i32 @ShowImageSys(i8* %0) {
%2 = tail call i64 @malloc(i32 100)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i64 @system(i8* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @free(i8* %3)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ 0, %7 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int mostrarText(char cadena[]) {
  int i;
  for (i = 0; cadena[i] != 0; i++)
    ;
  printf("%s", cadena);
  return i;
}


x86 assembly (clang, -O0):
<mostrarText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114b <mostrarText+0x3b>
jmp    113d <mostrarText+0x2d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <mostrarText+0x13>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostrarText>:
push   %rbx
mov    %rdi,%rsi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rsi,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <mostrarText+0x10>
add    $0xffffffff,%ebx
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @mostrarText(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %9
}
/* Variables and functions */
bool isPrime(int n) {
  int i;
  if (n % 2 == 0) {
    return true;
  }
  for (i = 3; i * i <= n; i += 2) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1127 <isPrime+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1174 <isPrime+0x74>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116d <isPrime+0x6d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    115a <isPrime+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1174 <isPrime+0x74>
jmp    115f <isPrime+0x5f>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <isPrime+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%ecx
test   $0x1,%dil
je     1135 <isPrime+0x35>
cmp    $0x9,%edi
jl     1135 <isPrime+0x35>
mov    $0x3,%esi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1138 <isPrime+0x38>
add    $0x2,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jle    1120 <isPrime+0x20>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = icmp slt i32 %0, 9
%5 = or i1 %3, %4
br i1 %5, label %14, label %9
6: ; preds = %9
%7 = mul nsw i32 %13, %13
%8 = icmp sgt i32 %7, %0
br i1 %8, label %14, label %9
9: ; preds = %1, %6
%10 = phi i32 [ %13, %6 ], [ 3, %1 ]
%11 = srem i32 %0, %10
%12 = icmp eq i32 %11, 0
%13 = add nuw nsw i32 %10, 2
br i1 %12, label %14, label %6
14: ; preds = %9, %6, %1
%15 = phi i32 [ 1, %1 ], [ 0, %9 ], [ 1, %6 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("--usage--:\n-t [process/access/log]\n-f controled file or folder\n-d "
         "degree[0/1/2] (0 means black, 1 means gray, 2 means protect)\n-m "
         "actoin[0/1] (0 means add, 1 means del)\n");
}


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

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

LLVM IR (-O0):
@.str = [170 x i8] c"--usage--:\0A-t [process/access/log]\0A-f controled file or folder\0A-d degree[0/1/2] (0 means black, 1 means gray, 2 means protect)\0A-m actoin[0/1] (0 means add, 1 means del)\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [169 x i8] c"--usage--:\0A-t [process/access/log]\0A-f controled file or folder\0A-d degree[0/1/2] (0 means black, 1 means gray, 2 means protect)\0A-m actoin[0/1] (0 means add, 1 means del)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([169 x i8], [169 x i8]* @str, i64 0, i64 0))
ret void
}
void NilTests(void) {}


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

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

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

LLVM IR (-O2):
define void @NilTests() {
ret void
}
/* Variables and functions */
char *_strstr_word(char const *, char const *, int /*<<< orphan*/, int,
                   int /*<<< orphan*/);
char *strstr_word_prefix(const char *haystack, const char *needle) {
  return _strstr_word(haystack, needle, 0, 1, 0);
}


x86 assembly (clang, -O0):
<strstr_word_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r8d,%r8d
mov    $0x1,%ecx
mov    %r8d,%edx
call   1030 <_strstr_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstr_word_prefix>:
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1030 <_strstr_word@plt>

LLVM IR (-O0):
define i8* @strstr_word_prefix(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 = load i8*, i8** %4
%7 = call i8* @_strstr_word(i8* %5, i8* %6, i32 0, i32 1, i32 0)
ret i8* %7
}

LLVM IR (-O2):
define i8* @strstr_word_prefix(i8* %0, i8* %1) {
%3 = tail call i8* @_strstr_word(i8* %0, i8* %1, i32 0, i32 1, i32 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ redecl5();
void use128() { redecl5(); }


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

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

LLVM IR (-O0):
define void @use128() {
%1 = call i32 (...) @redecl5()
ret void
}

LLVM IR (-O2):
define void @use128() {
%1 = tail call i32 (...) @redecl5()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getText(char *, int);
int /*<<< orphan*/ insertionSort(char *, int);
int /*<<< orphan*/ printArray(char *, int);
int /*<<< orphan*/ printf(char *);
void main() {
  char array[10];
  printf("Type away!: ");
  getText(array, 10);
  printArray(array, 10);
  insertionSort(array, 10);
  printArray(array, 10);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1060 <getText@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1040 <insertionSort@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <getText@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <insertionSort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Type away!: \00"
define void @main() {
%1 = alloca [10 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @getText(i8* %3, i32 10)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = call i32 @printArray(i8* %5, i32 10)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @insertionSort(i8* %7, i32 10)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%10 = call i32 @printArray(i8* %9, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Type away!: \00"
define void @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @getText(i8* %2, i32 10)
%5 = call i32 @printArray(i8* %2, i32 10)
%6 = call i32 @insertionSort(i8* %2, i32 10)
%7 = call i32 @printArray(i8* %2, i32 10)
ret void
}
void mdp4_dtv_overlay_blt_stop(struct msm_fb_data_type *mfd) {}


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_dtv_overlay_blt_stop(%struct.msm_fb_data_type* nocapture %0) {
ret void
}
/* Variables and functions */
char *memcpy(int /*<<< orphan*/, char const *, size_t);
int strlen(char const *);
int /*<<< orphan*/ xmalloc(size_t);
char *xstrdup(const char *s) {
  size_t n = strlen(s) + 1;
  return memcpy(xmalloc(n), s, n);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <xmalloc@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1040 <xmalloc@plt>
mov    %eax,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <memcpy@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = call i32 @xmalloc(i64 %8)
%10 = load i8*, i8** %2
%11 = load i64, i64* %3
%12 = call i8* @memcpy(i32 %9, i8* %10, i64 %11)
ret i8* %12
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i32 @xmalloc(i64 %4)
%6 = tail call i8* @memcpy(i32 %5, i8* %0, i64 %4)
ret i8* %6
}
/* Variables and functions */
double sqrt(float);
double Mag(float N1, float N2, float N3) {
  return (sqrt(N1 * N1 + N2 * N2 + N3 * N3));
}


x86 assembly (clang, -O0):
<Mag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mag>:
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm2,%xmm2
addss  %xmm2,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @Mag(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %4
%9 = load float, float* %5
%10 = load float, float* %5
%11 = fmul float %9, %10
%12 = call float @llvm.fmuladd.f32(float %7, float %8, float %11)
%13 = load float, float* %6
%14 = load float, float* %6
%15 = call float @llvm.fmuladd.f32(float %13, float %14, float %12)
%16 = call double @sqrt(float %15)
ret double %16
}

LLVM IR (-O2):
define double @Mag(float %0, float %1, float %2) {
%4 = fmul float %1, %1
%5 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %4)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = tail call double @sqrt(float %6)
ret double %7
}
void bugerror(message) char *message;
{ error2error("compiler bug - ", message); }


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

x86 assembly (clang, -O2):
<bugerror>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <error2error@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"compiler bug - \00"
define void @bugerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error2error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"compiler bug - \00"
define void @bugerror(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error2error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ in_range(int const, char, float);
scalar_t__ is_hexdig(int const);
bool is_xdigit(const int c) { return is_hexdig(c) || in_range(c, 'a', 'f'); }


x86 assembly (clang, -O0):
<is_xdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_hexdig@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1164 <is_xdigit+0x44>
mov    -0x4(%rbp),%edi
mov    $0x61,%esi
movss  0xeab(%rip),%xmm0
call   1040 <in_range@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_xdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_hexdig@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <is_xdigit+0x17>
pop    %rbx
ret
movss  0xec1(%rip),%xmm0
mov    %ebx,%edi
mov    $0x61,%esi
call   1040 <in_range@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_xdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @is_hexdig(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @in_range(i32 %7, i8 signext 97, float 1.020000e+02)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_xdigit(i32 %0) {
%2 = tail call i64 @is_hexdig(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @in_range(i32 %0, i8 signext 97, float 1.020000e+02)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
struct wl_proxy {
  int dummy;
};
struct wl_data_offer {
  int dummy;
};

/* Variables and functions */
void *wl_proxy_get_user_data(struct wl_proxy *);
void *wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer) {
  return wl_proxy_get_user_data((struct wl_proxy *)wl_data_offer);
}


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

x86 assembly (clang, -O2):
<wl_data_offer_get_user_data>:
jmp    1030 <wl_proxy_get_user_data@plt>

LLVM IR (-O0):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_data_offer_get_user_data(%struct.wl_data_offer* %0) {
%2 = alloca %struct.wl_data_offer*
store %struct.wl_data_offer* %0, %struct.wl_data_offer** %2
%3 = load %struct.wl_data_offer*, %struct.wl_data_offer** %2
%4 = bitcast %struct.wl_data_offer* %3 to %struct.wl_proxy*
%5 = call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.wl_data_offer = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_data_offer_get_user_data(%struct.wl_data_offer* %0) {
%2 = bitcast %struct.wl_data_offer* %0 to %struct.wl_proxy*
%3 = tail call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %2)
ret i8* %3
}
int test_imm_8Duint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x8D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Duint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 141
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int f134(int *);
int f135(int *p) { return f134(p); }


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

x86 assembly (clang, -O2):
<f135>:
jmp    1030 <f134@plt>

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

LLVM IR (-O2):
define i32 @f135(i32* %0) {
%2 = tail call i32 @f134(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ heartbeat_forever();
int /*<<< orphan*/ leds_init();
int /*<<< orphan*/ leds_shut();
int c_entry(void) {
  leds_init();
  heartbeat_forever();
  leds_shut();
  return 0;
}


x86 assembly (clang, -O0):
<c_entry>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <leds_init@plt>
mov    $0x0,%al
call   1030 <heartbeat_forever@plt>
mov    $0x0,%al
call   1050 <leds_shut@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_entry>:
push   %rax
xor    %eax,%eax
call   1040 <leds_init@plt>
xor    %eax,%eax
call   1030 <heartbeat_forever@plt>
xor    %eax,%eax
call   1050 <leds_shut@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @c_entry() {
%1 = call i32 (...) @leds_init()
%2 = call i32 (...) @heartbeat_forever()
%3 = call i32 (...) @leds_shut()
ret i32 0
}

LLVM IR (-O2):
define i32 @c_entry() {
%1 = tail call i32 (...) @leds_init()
%2 = tail call i32 (...) @heartbeat_forever()
%3 = tail call i32 (...) @leds_shut()
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
void clear_newlines(void) {
  int c;
  do {
    c = getchar();
  } while (c != '\n' && c != EOF);
}


x86 assembly (clang, -O0):
<clear_newlines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1143 <clear_newlines+0x33>
mov    -0x4(%rbp),%eax
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1118 <clear_newlines+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_newlines>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1130 <clear_newlines+0x20>
cmp    (%rbx),%eax
jne    1120 <clear_newlines+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @clear_newlines() {
%1 = alloca i32
br label %2
2: ; preds = %11, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
br label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %1
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %2, label %13
13: ; preds = %11
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @clear_newlines() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @getchar()
%3 = icmp ne i32 %2, 10
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %2, %4
%6 = select i1 %3, i1 %5, i1 false
br i1 %6, label %1, label %7
7: ; preds = %1
ret void
}
int rapl_get_cpu_id() {
  unsigned int eax, ebx, ecx, edx;
  eax = 1;
  ecx = 0;
  asm volatile("cpuid"
               : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
               : "0"(eax), "2"(ecx));
  return eax;
}


x86 assembly (clang, -O0):
<rapl_get_cpu_id>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
cpuid
mov    %eax,-0xc(%rbp)
mov    %ebx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<rapl_get_cpu_id>:
push   %rbx
mov    $0x1,%eax
xor    %ecx,%ecx
cpuid
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rapl_get_cpu_id() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %1
store i32 0, i32* %3
%5 = load i32, i32* %1
%6 = load i32, i32* %3
%7 = call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
%8 = extractvalue { i32, i32, i32, i32 } %7, 0
%9 = extractvalue { i32, i32, i32, i32 } %7, 1
%10 = extractvalue { i32, i32, i32, i32 } %7, 2
%11 = extractvalue { i32, i32, i32, i32 } %7, 3
store i32 %8, i32* %1
store i32 %9, i32* %2
store i32 %10, i32* %3
store i32 %11, i32* %4
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @rapl_get_cpu_id() {
%1 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 1, i32 0)
%2 = extractvalue { i32, i32, i32, i32 } %1, 0
ret i32 %2
}
/* Variables and functions */
unsigned int strlen(const char *s) {
  const char *sc;
  for (sc = s; *sc != '\0'; ++sc)
    ;
  return sc - s;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1136 <strlen+0x36>
jmp    1125 <strlen+0x25>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
unsigned long long __blsfill_u64(unsigned long long);
unsigned long long test__blsfill_u64(unsigned long long a) {
  return __blsfill_u64(a);
}


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

x86 assembly (clang, -O2):
<test__blsfill_u64>:
jmp    1030 <__blsfill_u64@plt>

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

LLVM IR (-O2):
define i64 @test__blsfill_u64(i64 %0) {
%2 = tail call i64 @__blsfill_u64(i64 %0)
ret i64 %2
}
/* Type definitions */
struct aiocb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int aio_cancel(int fildes, struct aiocb *aiocbp) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<aio_cancel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aio_cancel>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.aiocb = type { i32 }
@ENOSYS = global i32 0
define i32 @aio_cancel(i32 %0, %struct.aiocb* %1) {
%3 = alloca i32
%4 = alloca %struct.aiocb*
store i32 %0, i32* %3
store %struct.aiocb* %1, %struct.aiocb** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb = type { i32 }
@ENOSYS = global i32 0
define i32 @aio_cancel(i32 %0, %struct.aiocb* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
float sqrtf(float);
void sqrt_ff(float *ret, float f) { (*ret) = sqrtf(f); }


x86 assembly (clang, -O0):
<sqrt_ff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sqrtf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt_ff>:
push   %rbx
mov    %rdi,%rbx
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1122 <sqrt_ff+0x12>
sqrtss %xmm0,%xmm0
jmp    1127 <sqrt_ff+0x17>
call   1030 <sqrtf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sqrt_ff(float* nocapture writeonly %0, float %1) {
%3 = tail call float @sqrtf(float %1)
store float %3, float* %0
ret void
}
/* Variables and functions */
scalar_t__ EINTR;
int close(int);
scalar_t__ errno;
int signalSafeClose(int fd) {
  bool interrupted;
  int retVal;
  do {
    retVal = close(fd);
    interrupted = ((retVal == -1) && (errno == EINTR));
  } while (interrupted);
  return retVal;
}


x86 assembly (clang, -O0):
<signalSafeClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jne    114f <signalSafeClose+0x3f>
mov    0x2ea4(%rip),%rax
mov    (%rax),%rax
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111b <signalSafeClose+0xb>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalSafeClose>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%r14
mov    0x2eb3(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    1144 <signalSafeClose+0x34>
mov    (%r15),%rcx
cmp    %rcx,(%r14)
je     1130 <signalSafeClose+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @signalSafeClose(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i64, i64* @errno
%12 = load i64, i64* @EINTR
%13 = icmp eq i64 %11, %12
br label %14
14: ; preds = %10, %5
%15 = phi i1 [ false, %5 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
br label %17
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
br i1 %19, label %5, label %20
20: ; preds = %17
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @signalSafeClose(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @close(i32 %0)
%4 = icmp eq i32 %3, -1
%5 = load i64, i64* @errno
%6 = load i64, i64* @EINTR
%7 = icmp eq i64 %5, %6
%8 = select i1 %4, i1 %7, i1 false
br i1 %8, label %2, label %9
9: ; preds = %2
ret i32 %3
}
double bound(double a, double b, double c) {
  return (a >= c ? a : b < a ? a : b > c ? c : b);
}


x86 assembly (clang, -O0):
<bound>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1132 <bound+0x32>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1192 <bound+0x92>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1155 <bound+0x55>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1188 <bound+0x88>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1174 <bound+0x74>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    117e <bound+0x7e>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bound>:
movapd %xmm2,%xmm3
minsd  %xmm1,%xmm3
cmplesd %xmm0,%xmm2
movapd %xmm2,%xmm4
andnpd %xmm3,%xmm4
andpd  %xmm0,%xmm2
orpd   %xmm4,%xmm2
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @bound(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %6
%9 = fcmp oge double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load double, double* %4
br label %30
12: ; preds = %3
%13 = load double, double* %5
%14 = load double, double* %4
%15 = fcmp olt double %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load double, double* %4
br label %28
18: ; preds = %12
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load double, double* %6
br label %26
24: ; preds = %18
%25 = load double, double* %5
br label %26
26: ; preds = %24, %22
%27 = phi double [ %23, %22 ], [ %25, %24 ]
br label %28
28: ; preds = %26, %16
%29 = phi double [ %17, %16 ], [ %27, %26 ]
br label %30
30: ; preds = %28, %10
%31 = phi double [ %11, %10 ], [ %29, %28 ]
ret double %31
}

LLVM IR (-O2):
define double @bound(double %0, double %1, double %2) {
%4 = fcmp oge double %0, %2
%5 = fcmp olt double %1, %0
%6 = or i1 %5, %4
%7 = fcmp ogt double %1, %2
%8 = select i1 %7, double %2, double %1
%9 = select i1 %6, double %0, double %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ esc_handle(char);
void escbatch(char *s) {
  for (; *s; s++) {
    esc_handle(*s);
  }
}


x86 assembly (clang, -O0):
<escbatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <escbatch+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <esc_handle@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <escbatch+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escbatch>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <escbatch+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <esc_handle@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <escbatch+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @escbatch(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @esc_handle(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
float __nv_sinhf(float);
float sinhf(float __a) { return __nv_sinhf(__a); }


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

x86 assembly (clang, -O2):
<sinhf>:
jmp    1030 <__nv_sinhf@plt>

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

LLVM IR (-O2):
define float @sinhf(float %0) {
%2 = tail call float @__nv_sinhf(float %0)
ret float %2
}
/* Variables and functions */
long long __rthal_generic_ullimd(long long, unsigned int, unsigned int);
__attribute__((__const__)) long long
__rthal_generic_llimd(long long op, unsigned m, unsigned d) {
  long long ret;
  int sign = 0;
  if (op < 0LL) {
    sign = 1;
    op = -op;
  }
  ret = __rthal_generic_ullimd(op, m, d);
  return sign ? -ret : ret;
}


x86 assembly (clang, -O0):
<__rthal_generic_llimd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1145 <__rthal_generic_llimd+0x35>
movl   $0x1,-0x1c(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <__rthal_generic_ullimd@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1171 <__rthal_generic_llimd+0x61>
xor    %eax,%eax
sub    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1179 <__rthal_generic_llimd+0x69>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rthal_generic_llimd>:
push   %rbx
mov    %rdi,%rbx
neg    %rdi
cmovs  %rbx,%rdi
call   1030 <__rthal_generic_ullimd@plt>
mov    %rax,%rcx
neg    %rcx
test   %rbx,%rbx
cmovs  %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @__rthal_generic_llimd(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
%9 = load i64, i64* %4
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
store i32 1, i32* %8
%12 = load i64, i64* %4
%13 = sub nsw i64 0, %12
store i64 %13, i64* %4
br label %14
14: ; preds = %11, %3
%15 = load i64, i64* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i64 @__rthal_generic_ullimd(i64 %15, i32 %16, i32 %17)
store i64 %18, i64* %7
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = load i64, i64* %7
%23 = sub nsw i64 0, %22
br label %26
24: ; preds = %14
%25 = load i64, i64* %7
br label %26
26: ; preds = %24, %21
%27 = phi i64 [ %23, %21 ], [ %25, %24 ]
ret i64 %27
}

LLVM IR (-O2):
define i64 @__rthal_generic_llimd(i64 %0, i32 %1, i32 %2) {
%4 = icmp slt i64 %0, 0
%5 = sub nsw i64 0, %0
%6 = select i1 %4, i64 %5, i64 %0
%7 = tail call i64 @__rthal_generic_ullimd(i64 %6, i32 %1, i32 %2)
%8 = sub nsw i64 0, %7
%9 = select i1 %4, i64 %8, i64 %7
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ ft_free(char *);
char *ft_strjoin(char *, char *);
char *i_equal_zero(char *c, char *result) {
  char *new;
  new = ft_strjoin(c, result);
  ft_free(c);
  ft_free(result);
  return (new);
}


x86 assembly (clang, -O0):
<i_equal_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ft_strjoin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ft_free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_equal_zero>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <ft_strjoin@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <ft_free@plt>
mov    %r14,%rdi
call   1030 <ft_free@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @i_equal_zero(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @ft_strjoin(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %3
%10 = call i32 @ft_free(i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @ft_free(i8* %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define i8* @i_equal_zero(i8* %0, i8* %1) {
%3 = tail call i8* @ft_strjoin(i8* %0, i8* %1)
%4 = tail call i32 @ft_free(i8* %0)
%5 = tail call i32 @ft_free(i8* %1)
ret i8* %3
}
int disablePorts(unsigned short int base, unsigned short int count) {
  return 1;
}


x86 assembly (clang, -O0):
<disablePorts>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @disablePorts(i16 zeroext %0, i16 zeroext %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *calloc(int, size_t);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
int /*<<< orphan*/ stderr;
void *ag_malloc(size_t sz) {
  void *r;
  r = calloc(1, sz);
  if (!r) {
    fprintf(stderr, "malloc [%d] failed\n", sz);
    abort();
  }
  return r;
}


x86 assembly (clang, -O0):
<ag_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1179 <ag_malloc+0x49>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe93(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ag_malloc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
call   1040 <calloc@plt>
test   %rax,%rax
je     1148 <ag_malloc+0x18>
pop    %rbx
ret
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"malloc [%d] failed\0A\00"
define i8* @ag_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @calloc(i32 1, i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"malloc [%d] failed\0A\00"
define i8* @ag_malloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ OS_disable_interrupts(unsigned long *);
int /*<<< orphan*/ OS_enable_interrupts(unsigned long);
int dma_is_completed(int);
int blender_block_is_completed(int transfer_size_8bit) {
  int finished;
  unsigned long ie;
  OS_disable_interrupts(&ie);
  finished = dma_is_completed(transfer_size_8bit);
  OS_enable_interrupts(ie);
  return finished;
}


x86 assembly (clang, -O0):
<blender_block_is_completed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <OS_disable_interrupts@plt>
mov    -0x4(%rbp),%edi
call   1040 <dma_is_completed@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <OS_enable_interrupts@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blender_block_is_completed>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rdi
call   1050 <OS_disable_interrupts@plt>
mov    %ebx,%edi
call   1040 <dma_is_completed@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   1030 <OS_enable_interrupts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @blender_block_is_completed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %2
%5 = call i32 @OS_disable_interrupts(i64* %4)
%6 = load i32, i32* %2
%7 = call i32 @dma_is_completed(i32 %6)
store i32 %7, i32* %3
%8 = load i64, i64* %4
%9 = call i32 @OS_enable_interrupts(i64 %8)
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @blender_block_is_completed(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @OS_disable_interrupts(i64* %2)
%5 = call i32 @dma_is_completed(i32 %0)
%6 = load i64, i64* %2
%7 = call i32 @OS_enable_interrupts(i64 %6)
ret i32 %5
}
/* Variables and functions */
int strcmp(char *, char *);
int cmp(void *a, void *b) {
  char *as = (char *)a;
  char *bs = (char *)b;
  return strcmp(as, bs);
}


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

x86 assembly (clang, -O2):
<cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}