xunge/DecIR huggingface dataset:
/* Variables and functions */
int coco_options_read(char const *, char const *, char *, int *);
int coco_options_read_int(const char *options, const char *name, int *pointer) {
  return coco_options_read(options, name, " %i", pointer);
}


x86 assembly (clang, -O0):
<coco_options_read_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdx
call   1030 <coco_options_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coco_options_read_int>:
mov    %rdx,%rcx
lea    0xee6(%rip),%rdx
jmp    1030 <coco_options_read@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" %i\00"
define i32 @coco_options_read_int(i8* %0, i8* %1, i32* %2) {
%4 = tail call i32 @coco_options_read(i8* %0, i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
ret i32 %4
}
void mov_from_cr8(void) {
  unsigned long cr8;
  asm volatile("mov %%cr8, %0" : "=r"(cr8));
}


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

x86 assembly (clang, -O2):
<mov_from_cr8>:
mov    %cr8,%rax
ret

LLVM IR (-O0):
define void @mov_from_cr8() {
%1 = alloca i64
%2 = call i64 asm sideeffect "mov %cr8, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
ret void
}

LLVM IR (-O2):
define void @mov_from_cr8() {
%1 = tail call i64 asm sideeffect "mov %cr8, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
char *strchr(char const *, char);
char *__strchrnul(const char *s, int c) {
  char *result = strchr(s, c);
  if (result == 0)
    result = strchr(s, '\0');
  return result;
}


x86 assembly (clang, -O0):
<__strchrnul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
movsbl %al,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114c <__strchrnul+0x3c>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__strchrnul>:
push   %rbx
mov    %rdi,%rbx
movsbl %sil,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1134 <__strchrnul+0x14>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @__strchrnul(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 = trunc i32 %7 to i8
%9 = call i8* @strchr(i8* %6, i8 signext %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i8* @strchr(i8* %13, i8 signext 0)
store i8* %14, i8** %5
br label %15
15: ; preds = %12, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @__strchrnul(i8* %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %6, %2
%10 = phi i8* [ %8, %6 ], [ %4, %2 ]
ret i8* %10
}
void SSMR3GetStrZEx(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3GetStrZEx() {
ret void
}
int backtrace(void **buffer, int size) {
  (void)buffer;
  (void)size;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @backtrace(i8** nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int f414(int *);
int f415(int *p) { return f414(p); }


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

x86 assembly (clang, -O2):
<f415>:
jmp    1030 <f414@plt>

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

LLVM IR (-O2):
define i32 @f415(i32* %0) {
%2 = tail call i32 @f414(i32* %0)
ret i32 %2
}
int MapsWithMe_GetMaxBufferSize(int nameSize) {
  return ((nameSize == 0) ? 17 : 17 + 3 * nameSize + 1);
}


x86 assembly (clang, -O0):
<MapsWithMe_GetMaxBufferSize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    111e <MapsWithMe_GetMaxBufferSize+0x1e>
mov    $0x11,%eax
mov    %eax,-0x8(%rbp)
jmp    112b <MapsWithMe_GetMaxBufferSize+0x2b>
imul   $0x3,-0x4(%rbp),%eax
add    $0x11,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MapsWithMe_GetMaxBufferSize>:
test   %edi,%edi
lea    0x12(%rdi,%rdi,2),%ecx
mov    $0x11,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @MapsWithMe_GetMaxBufferSize(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = mul nsw i32 %0, 3
%4 = add nsw i32 %3, 18
%5 = select i1 %2, i32 17, i32 %4
ret i32 %5
}
/* Type definitions */
struct zbuf {
  int dummy;
};
typedef int n;

/* Variables and functions */
void *__zbuf_push(struct zbuf *, int, int);
void *znl_push(struct zbuf *zb, size_t n) {
  return (__zbuf_push(zb, (((n) + 3) & ~3), 1));
}


x86 assembly (clang, -O0):
<znl_push>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
add    $0x3,%rax
and    $0xfffffffffffffffc,%rax
mov    %eax,%esi
mov    $0x1,%edx
call   1030 <__zbuf_push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<znl_push>:
add    $0x3,%esi
and    $0xfffffffc,%esi
mov    $0x1,%edx
jmp    1030 <__zbuf_push@plt>

LLVM IR (-O0):
%struct.zbuf = type { i32 }
define i8* @znl_push(%struct.zbuf* %0, i64 %1) {
%3 = alloca %struct.zbuf*
%4 = alloca i64
store %struct.zbuf* %0, %struct.zbuf** %3
store i64 %1, i64* %4
%5 = load %struct.zbuf*, %struct.zbuf** %3
%6 = load i64, i64* %4
%7 = add i64 %6, 3
%8 = and i64 %7, -4
%9 = trunc i64 %8 to i32
%10 = call i8* @__zbuf_push(%struct.zbuf* %5, i32 %9, i32 1)
ret i8* %10
}

LLVM IR (-O2):
%struct.zbuf = type { i32 }
define i8* @znl_push(%struct.zbuf* %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = add i32 %3, 3
%5 = and i32 %4, -4
%6 = tail call i8* @__zbuf_push(%struct.zbuf* %0, i32 %5, i32 1)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int ch = 97;
  int i = 97;
  ch += 2;
  i += 2;
  printf("value of ch: %c; value of i: %c \n", ch, i);
  printf("value of ch: %i; value of i: %i \n", ch, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x61,-0x8(%rbp)
movl   $0x61,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x63,%esi
mov    $0x63,%edx
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x63,%esi
mov    $0x63,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"value of ch: %c; value of i: %c \0A\00"
@.str.1 = [34 x i8] c"value of ch: %i; value of i: %i \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 97, i32* %2
store i32 97, i32* %3
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 2
store i32 %5, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 2
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"value of ch: %c; value of i: %c \0A\00"
@.str.1 = [34 x i8] c"value of ch: %i; value of i: %i \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 99, i32 99)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 99, i32 99)
ret i32 0
}
/* Variables and functions */
int fabs(double);
int is_zero(double x) { return fabs(x) < 1e-7; }


x86 assembly (clang, -O0):
<is_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xecd(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_zero>:
push   %rax
call   1030 <fabs@plt>
xor    %ecx,%ecx
test   %eax,%eax
setle  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_zero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fcmp olt double %5, 0x3E7AD7F29ABCAF48
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_zero(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp slt i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int mysum(int, int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a = 3;
  int b = 20;
  int d = 15;
  int e = 9;
  int c = 0;
  c = mysum(a, b, d, e);
  printf("%d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0xf,-0x10(%rbp)
movl   $0x9,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <mysum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x14,%esi
mov    $0xf,%edx
mov    $0x9,%ecx
call   1040 <mysum@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store i32 20, i32* %3
store i32 15, i32* %4
store i32 9, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @mysum(i32 %7, i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @mysum(i32 3, i32 20, i32 15, i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ CMT_runTests();
int main() {
  CMT_runTests();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <CMT_runTests@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @CMT_runTests()
ret i32 0
}
/* Variables and functions */
scalar_t__ __cc_db_larger(double const *, double const *, double const *);
int __cc_db_in_range_o_c(const double rd, const double small,
                         const double large, const double res) {
  return __cc_db_larger(&rd, &small, &res) &&
         !__cc_db_larger(&rd, &large, &res);
}


x86 assembly (clang, -O0):
<__cc_db_in_range_o_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <__cc_db_larger@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     116c <__cc_db_in_range_o_c+0x5c>
lea    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <__cc_db_larger@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cc_db_in_range_o_c>:
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm3,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <__cc_db_larger@plt>
test   %rax,%rax
je     1169 <__cc_db_in_range_o_c+0x59>
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <__cc_db_larger@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x28,%rsp
ret
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @__cc_db_in_range_o_c(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = call i64 @__cc_db_larger(double* %5, double* %6, double* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = call i64 @__cc_db_larger(double* %5, double* %7, double* %8)
%13 = icmp ne i64 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %11, %4
%16 = phi i1 [ false, %4 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @__cc_db_in_range_o_c(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = call i64 @__cc_db_larger(double* %5, double* %6, double* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = call i64 @__cc_db_larger(double* %5, double* %7, double* %8)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %4
%16 = phi i32 [ 0, %4 ], [ %14, %11 ]
ret i32 %16
}
/* Variables and functions */
unsigned long bit_mask(unsigned long);
int test_bit(unsigned long *bitset, unsigned long bit) {
  unsigned long *addr, mask;
  addr = bitset + (bit / (sizeof(unsigned long) * 8));
  mask = bit_mask(bit);
  return ((*addr & mask) != 0);
}


x86 assembly (clang, -O0):
<test_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x6,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <bit_mask@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
and    -0x20(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bit>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rbx
shr    $0x6,%rbx
mov    %rsi,%rdi
call   1030 <bit_mask@plt>
xor    %ecx,%ecx
test   %rax,(%r14,%rbx,8)
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @test_bit(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%7 = load i64*, i64** %3
%8 = load i64, i64* %4
%9 = udiv i64 %8, 64
%10 = getelementptr inbounds i64, i64* %7, i64 %9
store i64* %10, i64** %5
%11 = load i64, i64* %4
%12 = call i64 @bit_mask(i64 %11)
store i64 %12, i64* %6
%13 = load i64*, i64** %5
%14 = load i64, i64* %13
%15 = load i64, i64* %6
%16 = and i64 %14, %15
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @test_bit(i64* nocapture %0, i64 %1) {
%3 = lshr i64 %1, 6
%4 = getelementptr inbounds i64, i64* %0, i64 %3
%5 = tail call i64 @bit_mask(i64 %1)
%6 = load i64, i64* %4
%7 = and i64 %6, %5
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int getcury(int /*<<< orphan*/);
int /*<<< orphan*/ stdscr;
int nmstermio_get_cursor_row(void) { return getcury(stdscr); }


x86 assembly (clang, -O0):
<nmstermio_get_cursor_row>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <getcury@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmstermio_get_cursor_row>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getcury@plt>

LLVM IR (-O0):
@stdscr = global i32 0
define i32 @nmstermio_get_cursor_row() {
%1 = load i32, i32* @stdscr
%2 = call i32 @getcury(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdscr = global i32 0
define i32 @nmstermio_get_cursor_row() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @getcury(i32 %1)
ret i32 %2
}
int test_imm_F9uint16_reg(unsigned short val) {
  return ((val) & (0xF9 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F9uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 249
%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_F9uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 249
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_A5uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xA5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A5uint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 165
%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_A5uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 165
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int SIGALRM;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void my_alrm_handler(int sigval) {
  if (sigval == SIGALRM) {
    printf("ring ring!\n");
    return;
  } else
    exit(1);
}


x86 assembly (clang, -O0):
<my_alrm_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    114f <my_alrm_handler+0x2f>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<my_alrm_handler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <my_alrm_handler+0x19>
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGALRM = global i32 0
@.str = [12 x i8] c"ring ring!\0A\00"
define void @my_alrm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGALRM
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
8: ; preds = %1
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@SIGALRM = global i32 0
@str = [11 x i8] c"ring ring!\00"
define void @my_alrm_handler(i32 %0) {
%2 = load i32, i32* @SIGALRM
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
6: ; preds = %1
%7 = tail call i32 @exit(i32 1)
unreachable
}
void evtchn_close() {}


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

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

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

LLVM IR (-O2):
define void @evtchn_close() {
ret void
}
void fa84(int n) {
  {
    int b[n];
    {
      int c[n];
      0;
    }
    {
      int d[n];
    a:
      goto a;
      0;
    };
    int e[n];
    0;
  };
  {
    int f[n];
    {
      int g[n];
      0;
    };
    {
      int h[n];
      0;
    };
    ;
    int i[n];
    0;
  };
  ;
  int j[n];
  0;
}


x86 assembly (clang, -O0):
<fa84>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
jmp    113f <fa84+0x3f>

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

LLVM IR (-O0):
define void @fa84(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
store i32 %0, i32* %2
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %3
%22 = alloca i32, i64 %20
store i64 %20, i64* %4
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
store i8* %25, i8** %5
%26 = alloca i32, i64 %24
store i64 %24, i64* %6
%27 = load i8*, i8** %5
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %7
%31 = alloca i32, i64 %29
store i64 %29, i64* %8
br label %32
32: ; preds = %32, %1
br label %32
33: ; No predecessors!
%34 = load i32, i32* %2
%35 = zext i32 %34 to i64
%36 = alloca i32, i64 %35
store i64 %35, i64* %9
%37 = load i8*, i8** %3
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
%40 = call i8* @llvm.stacksave()
store i8* %40, i8** %10
%41 = alloca i32, i64 %39
store i64 %39, i64* %11
%42 = load i32, i32* %2
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
store i8* %44, i8** %12
%45 = alloca i32, i64 %43
store i64 %43, i64* %13
%46 = load i8*, i8** %12
%47 = load i32, i32* %2
%48 = zext i32 %47 to i64
%49 = call i8* @llvm.stacksave()
store i8* %49, i8** %14
%50 = alloca i32, i64 %48
store i64 %48, i64* %15
%51 = load i8*, i8** %14
%52 = load i32, i32* %2
%53 = zext i32 %52 to i64
%54 = alloca i32, i64 %53
store i64 %53, i64* %16
%55 = load i8*, i8** %10
%56 = load i32, i32* %2
%57 = zext i32 %56 to i64
%58 = call i8* @llvm.stacksave()
store i8* %58, i8** %17
%59 = alloca i32, i64 %57
store i64 %57, i64* %18
%60 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @fa84(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void INT_Excep_ICU_SWINT2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_ICU_SWINT2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ImprimirMenu();
int LeerOpcion();
int Menu() {
  ImprimirMenu();
  return LeerOpcion();
}


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

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

LLVM IR (-O0):
define i32 @Menu() {
%1 = call i32 (...) @ImprimirMenu()
%2 = call i32 (...) @LeerOpcion()
ret i32 %2
}

LLVM IR (-O2):
define i32 @Menu() {
%1 = tail call i32 (...) @ImprimirMenu()
%2 = tail call i32 (...) @LeerOpcion()
ret i32 %2
}
void product(long double *result, const long double x, long double *unused) {
  *result *= x;
}


x86 assembly (clang, -O0):
<product>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
fstpt  -0x20(%rbp)
mov    %rsi,-0x28(%rbp)
fldt   -0x20(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fmulp  %st,%st(1)
fstpt  (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<product>:
fldt   0x8(%rsp)
fldt   (%rdi)
fmulp  %st,%st(1)
fstpt  (%rdi)
ret

LLVM IR (-O0):
define void @product(x86_fp80* %0, x86_fp80 %1, x86_fp80* %2) {
%4 = alloca x86_fp80*
%5 = alloca x86_fp80
%6 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %4
store x86_fp80 %1, x86_fp80* %5
store x86_fp80* %2, x86_fp80** %6
%7 = load x86_fp80, x86_fp80* %5
%8 = load x86_fp80*, x86_fp80** %4
%9 = load x86_fp80, x86_fp80* %8
%10 = fmul x86_fp80 %9, %7
store x86_fp80 %10, x86_fp80* %8
ret void
}

LLVM IR (-O2):
define void @product(x86_fp80* nocapture %0, x86_fp80 %1, x86_fp80* nocapture readnone %2) {
%4 = load x86_fp80, x86_fp80* %0
%5 = fmul x86_fp80 %4, %1
store x86_fp80 %5, x86_fp80* %0
ret void
}
int num(char a) {
  int rank, k, c;
  if ('a' <= a && a <= 'z')
    rank = a - 'a' + 'Z' - 'A' + 1;
  if ('A' <= a && a <= 'Z')
    rank = a - 'A';
  k = rank % ('Z' - 'A' + 1);
  c = rank / ('Z' - 'A' + 1);
  return c + 2 * k;
}


x86 assembly (clang, -O0):
<num>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     113b <num+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     113b <num+0x3b>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0x5a,%eax
sub    $0x41,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1163 <num+0x63>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1163 <num+0x63>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num>:
lea    -0x41(%rdi),%eax
lea    0xffb9(%rdi),%ecx
add    $0xffbf,%edi
cmp    $0x1a,%al
cmovae %ecx,%edi
movswl %di,%eax
imul   $0x4ec5,%eax,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x13,%eax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%edi
movswl %di,%ecx
lea    (%rax,%rcx,2),%eax
ret

LLVM IR (-O0):
define i32 @num(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp sle i32 97, %7
br i1 %8, label %9, label %20
9: ; preds = %1
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 122
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 97
%17 = add nsw i32 %16, 90
%18 = sub nsw i32 %17, 65
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %13, %9, %1
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp sle i32 65, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 90
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 65
store i32 %31, i32* %3
br label %32
32: ; preds = %28, %24, %20
%33 = load i32, i32* %3
%34 = srem i32 %33, 26
store i32 %34, i32* %4
%35 = load i32, i32* %3
%36 = sdiv i32 %35, 26
store i32 %36, i32* %5
%37 = load i32, i32* %5
%38 = load i32, i32* %4
%39 = mul nsw i32 2, %38
%40 = add nsw i32 %37, %39
ret i32 %40
}

LLVM IR (-O2):
define i32 @num(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -97
%4 = icmp ult i8 %3, 26
%5 = add nsw i32 %2, 65465
%6 = select i1 %4, i32 %5, i32 undef
%7 = add i8 %0, -65
%8 = icmp ult i8 %7, 26
%9 = add nsw i32 %2, 65471
%10 = select i1 %8, i32 %9, i32 %6
%11 = trunc i32 %10 to i16
%12 = srem i16 %11, 26
%13 = sext i16 %12 to i32
%14 = sdiv i16 %11, 26
%15 = sext i16 %14 to i32
%16 = shl nsw i32 %13, 1
%17 = add nsw i32 %16, %15
ret i32 %17
}
int digit_sum(int n) {
  int sum = 0;
  if (n < 0)
    n = -n;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}


x86 assembly (clang, -O0):
<digit_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1120 <digit_sum+0x20>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1125 <digit_sum+0x25>
cmpl   $0x0,-0x4(%rbp)
je     1153 <digit_sum+0x53>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1125 <digit_sum+0x25>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit_sum>:
test   %edi,%edi
je     113c <digit_sum+0x3c>
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
xor    %eax,%eax
nopl   (%rax)
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
add    %edi,%eax
add    $0x9,%edx
cmp    $0x12,%edx
ja     1110 <digit_sum+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @digit_sum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 0, %3 ]
%7 = phi i32 [ %10, %5 ], [ %4, %3 ]
%8 = srem i32 %7, 10
%9 = add nsw i32 %6, %8
%10 = sdiv i32 %7, 10
%11 = add i32 %7, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int ioctl(int, int, void *);
int /*<<< orphan*/ perror(char *);
int eioctl(int fd, int command, void *param, char *emsg) {
  int r;
  if ((r = ioctl(fd, command, param)) < 0) {
    perror(emsg);
    exit(1);
  }
  return r;
}


x86 assembly (clang, -O0):
<eioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    1174 <eioctl+0x44>
mov    -0x18(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eioctl>:
push   %rbx
mov    %rcx,%rbx
call   1030 <ioctl@plt>
test   %eax,%eax
js     113f <eioctl+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
define i32 @eioctl(i32 %0, i32 %1, i8* %2, i8* nocapture %3) {
%5 = tail call i32 @ioctl(i32 %0, i32 %1, i8* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i32 @perror(i8* %3)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ run_test(int);
int run_all_tests() {
  for (int i = 1; i < 7; i++) {
    if (!run_test(i))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<run_all_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1159 <run_all_tests+0x49>
mov    -0x8(%rbp),%edi
call   1030 <run_test@plt>
cmp    $0x0,%eax
jne    1146 <run_all_tests+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1160 <run_all_tests+0x50>
jmp    114b <run_all_tests+0x3b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <run_all_tests+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_all_tests>:
push   %rbx
mov    $0x1,%edi
call   1030 <run_test@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     116a <run_all_tests+0x5a>
mov    $0x2,%edi
call   1030 <run_test@plt>
test   %eax,%eax
je     116a <run_all_tests+0x5a>
mov    $0x3,%edi
call   1030 <run_test@plt>
test   %eax,%eax
je     116a <run_all_tests+0x5a>
mov    $0x4,%edi
call   1030 <run_test@plt>
test   %eax,%eax
je     116a <run_all_tests+0x5a>
mov    $0x5,%edi
call   1030 <run_test@plt>
test   %eax,%eax
je     116a <run_all_tests+0x5a>
mov    $0x6,%edi
call   1030 <run_test@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @run_all_tests() {
%1 = tail call i32 @run_test(i32 1)
%2 = icmp eq i32 %1, 0
br i1 %2, label %19, label %3
3: ; preds = %0
%4 = tail call i32 @run_test(i32 2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = tail call i32 @run_test(i32 3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %6
%10 = tail call i32 @run_test(i32 4)
%11 = icmp eq i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = tail call i32 @run_test(i32 5)
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = tail call i32 @run_test(i32 6)
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %12, %9, %6, %3, %0
%20 = phi i32 [ 0, %0 ], [ 0, %3 ], [ 0, %6 ], [ 0, %9 ], [ 0, %12 ], [ %18, %15 ]
ret i32 %20
}
int condition_a(char c) { return c == 'a'; }


x86 assembly (clang, -O0):
<condition_a>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<condition_a>:
xor    %eax,%eax
cmp    $0x61,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @condition_a(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 97
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @condition_a(i8 signext %0) {
%2 = icmp eq i8 %0, 97
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0x3f() {
  Assert_real((iscntrl(63) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              320, ("iscntrl should be 0 for ?"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0x3f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x140,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0x3f>:
push   %rax
mov    $0x3f,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x140,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for ?\00"
define void @t_iscntrl_0x3f() {
%1 = call i64 @iscntrl(i32 63)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 320, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for ?\00"
define void @t_iscntrl_0x3f() {
%1 = tail call i64 @iscntrl(i32 63)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 320, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mkdir(char *, int);
char *strchr(char *, char);
void mkpath(char *path) {
  for (char *p = strchr(path + 1, '/'); p; p = strchr(p + 1, '/')) {
    *p = '\0';
    mkdir(path, 0755);
    *p = '/';
  }
}


x86 assembly (clang, -O0):
<mkpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1184 <mkpath+0x64>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
jmp    1142 <mkpath+0x22>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkpath>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0x1,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     116c <mkpath+0x4c>
mov    %rax,%rbx
nopl   (%rax)
movb   $0x0,(%rbx)
mov    %r14,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
movb   $0x2f,(%rbx)
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1140 <mkpath+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @mkpath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = call i8* @strchr(i8* %5, i8 signext 47)
store i8* %6, i8** %3
br label %7
7: ; preds = %15, %1
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i8*, i8** %3
store i8 0, i8* %11
%12 = load i8*, i8** %2
%13 = call i32 @mkdir(i8* %12, i32 493)
%14 = load i8*, i8** %3
store i8 47, i8* %14
br label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i8* @strchr(i8* %17, i8 signext 47)
store i8* %18, i8** %3
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @mkpath(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i8* @strchr(i8* %2, i8 signext 47)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %6, %1
ret void
6: ; preds = %1, %6
%7 = phi i8* [ %10, %6 ], [ %3, %1 ]
store i8 0, i8* %7
%8 = tail call i32 @mkdir(i8* %0, i32 493)
store i8 47, i8* %7
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = tail call i8* @strchr(i8* %9, i8 signext 47)
%11 = icmp eq i8* %10, null
br i1 %11, label %5, label %6
}
/* Variables and functions */
int fetchDecodeExecute();
int updateEmulator() {
  const int MAXCYCLES = 65535;
  int currentCycles = 0;
  while (currentCycles < MAXCYCLES) {
    int cycles = fetchDecodeExecute();
    currentCycles += cycles;
  }
  return 0;
}


x86 assembly (clang, -O0):
<updateEmulator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffff,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xffff,-0x8(%rbp)
jge    114b <updateEmulator+0x3b>
mov    $0x0,%al
call   1030 <fetchDecodeExecute@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <updateEmulator+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateEmulator>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <fetchDecodeExecute@plt>
add    %eax,%ebx
cmp    $0xffff,%ebx
jl     1120 <updateEmulator+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @updateEmulator() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 (...) @fetchDecodeExecute()
%4 = add nsw i32 %3, %2
%5 = icmp slt i32 %4, 65535
br i1 %5, label %1, label %6
6: ; preds = %1
ret i32 0
}
void scat_log(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @scat_log(i8* nocapture %0, ...) {
ret void
}
void debug_cons_open(void) {}


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

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

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

LLVM IR (-O2):
define void @debug_cons_open() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndLeave(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS) {
    stream = stdout;
  }
  fprintf(stream, "Usage: %s <username> <groupname>\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndLeave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndLeave+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndLeave>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2ea3(%rip),%rax
cmp    %esi,(%rax)
jne    113a <helpAndLeave+0x1a>
mov    0x2ea0(%rip),%rax
jmp    1141 <helpAndLeave+0x21>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [34 x i8] c"Usage: %s <username> <groupname>\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32*, i32** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [34 x i8] c"Usage: %s <username> <groupname>\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %1
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fesetround(int);
void uninitvar_fesetround(void) {
  int i;
  (void)fesetround(i);
}


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

x86 assembly (clang, -O2):
<uninitvar_fesetround>:
jmp    1030 <fesetround@plt>

LLVM IR (-O0):
define void @uninitvar_fesetround() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @fesetround(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_fesetround() {
%1 = tail call i32 @fesetround(i32 undef)
ret void
}