xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(size_t);
void *test20_malloc(size_t n) {
  static int invoke_count = 0;
  if (++invoke_count >= 5) {
    return 0;
  } else {
    return malloc(n);
  }
}


x86 assembly (clang, -O0):
<test20_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2f0a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f01(%rip)
cmp    $0x5,%eax
jl     1141 <test20_malloc+0x31>
movq   $0x0,-0x8(%rbp)
jmp    114e <test20_malloc+0x3e>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test20_malloc>:
mov    0x2f16(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f0d(%rip)
cmp    $0x3,%eax
jle    1127 <test20_malloc+0x17>
xor    %eax,%eax
ret
jmp    1030 <malloc@plt>

LLVM IR (-O0):
@test20_malloc.invoke_count = internal global i32 0
define i8* @test20_malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i32, i32* @test20_malloc.invoke_count
%5 = add nsw i32 %4, 1
store i32 %5, i32* @test20_malloc.invoke_count
%6 = icmp sge i32 %5, 5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %11
8: ; preds = %1
%9 = load i64, i64* %3
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %7
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@test20_malloc.invoke_count = internal unnamed_addr global i32 0
define noalias i8* @test20_malloc(i64 %0) {
%2 = load i32, i32* @test20_malloc.invoke_count
%3 = add nsw i32 %2, 1
store i32 %3, i32* @test20_malloc.invoke_count
%4 = icmp sgt i32 %2, 3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i8* @malloc(i64 %0)
br label %7
7: ; preds = %1, %5
%8 = phi i8* [ %6, %5 ], [ null, %1 ]
ret i8* %8
}
unsigned AAS_HashEdge(int v1, int v2) {
  int vnum1, vnum2;
  if (v1 < v2) {
    vnum1 = v1;
    vnum2 = v2;
  } else {
    vnum1 = v2;
    vnum2 = v1;
  }
  return (vnum1 + vnum2) & (1024 - 1);
}


x86 assembly (clang, -O0):
<AAS_HashEdge>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1127 <AAS_HashEdge+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <AAS_HashEdge+0x33>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AAS_HashEdge>:
cmp    %esi,%edi
mov    %esi,%eax
cmovl  %edi,%eax
cmovl  %esi,%edi
add    %edi,%eax
and    $0x3ff,%eax
ret

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

LLVM IR (-O2):
define i32 @AAS_HashEdge(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
%6 = add nsw i32 %4, %5
%7 = and i32 %6, 1023
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _cpuidex(int /*<<< orphan*/ *);
extern void cpuidex(uint32_t registers[4], uint32_t function_id,
                    uint32_t sub_function_id) {
  registers[0] = function_id;
  registers[2] = sub_function_id;
  _cpuidex(registers);
}


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

x86 assembly (clang, -O2):
<cpuidex>:
mov    %esi,(%rdi)
mov    %edx,0x8(%rdi)
jmp    1030 <_cpuidex@plt>

LLVM IR (-O0):
define void @cpuidex(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %6
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 2
store i32 %10, i32* %12
%13 = load i32*, i32** %4
%14 = call i32 @_cpuidex(i32* %13)
ret void
}

LLVM IR (-O2):
define void @cpuidex(i32* %0, i32 %1, i32 %2) {
store i32 %1, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %2, i32* %4
%5 = tail call i32 @_cpuidex(i32* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t ror(uint8_t x) { return ((x >> 1) & 0xFF) ^ ((x << 7) & 0xFF); }


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x7,%ecx
and    $0xff,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror>:
mov    %edi,%eax
shr    %eax
shl    $0x7,%edi
xor    %eax,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @ror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = and i32 %4, 255
%6 = load i32, i32* %2
%7 = shl i32 %6, 7
%8 = and i32 %7, 255
%9 = xor i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @ror(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 255
%4 = shl i32 %0, 7
%5 = and i32 %4, 128
%6 = xor i32 %3, %5
ret i32 %6
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XDestroyWindowEvent;

/* Variables and functions */
int get_XDestroyWindowEvent_type(void *_p) {
  return (int)((XDestroyWindowEvent *)_p)->type;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XDestroyWindowEvent_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XDestroyWindowEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
int my_square_root(int nb) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @my_square_root(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_iterator_data(void *v) { free(v); }


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

x86 assembly (clang, -O2):
<free_iterator_data>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_iterator_data(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void trash_registers(void) {
  asm("mov $0xf0, %rax;"
      "mov $0xf1, %rcx;"
      "mov $0xf2, %rdx;"
      "mov $0xf3, %rsi;"
      "mov $0xf4, %rdi;"
      "mov $0xf5, %r8;"
      "mov $0xf6, %r9;"
      "mov $0xf7, %r10;"
      "mov $0xf8, %r11;");
}


x86 assembly (clang, -O0):
<trash_registers>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf0,%rax
mov    $0xf1,%rcx
mov    $0xf2,%rdx
mov    $0xf3,%rsi
mov    $0xf4,%rdi
mov    $0xf5,%r8
mov    $0xf6,%r9
mov    $0xf7,%r10
mov    $0xf8,%r11
pop    %rbp
ret

x86 assembly (clang, -O2):
<trash_registers>:
mov    $0xf0,%rax
mov    $0xf1,%rcx
mov    $0xf2,%rdx
mov    $0xf3,%rsi
mov    $0xf4,%rdi
mov    $0xf5,%r8
mov    $0xf6,%r9
mov    $0xf7,%r10
mov    $0xf8,%r11
ret

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

LLVM IR (-O2):
define void @trash_registers() {
tail call void asm sideeffect "mov $$0xf0, %rax;mov $$0xf1, %rcx;mov $$0xf2, %rdx;mov $$0xf3, %rsi;mov $$0xf4, %rdi;mov $$0xf5, %r8;mov $$0xf6, %r9;mov $$0xf7, %r10;mov $$0xf8, %r11;", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
char *dirname(char *);
int /*<<< orphan*/ free(char *);
char *strdup(char *);
char *dirnamep(char *dir) {
  char *copy = strdup(dir);
  char *result = strdup(dirname(copy));
  free(copy);
  return result;
}


x86 assembly (clang, -O0):
<dirnamep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirnamep>:
push   %r14
push   %rbx
push   %rax
call   1050 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @dirnamep(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strdup(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @dirname(i8* %7)
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
%12 = load i8*, i8** %4
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @dirnamep(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @dirname(i8* %2)
%4 = tail call i8* @strdup(i8* %3)
%5 = tail call i32 @free(i8* %2)
ret i8* %4
}
char *mystrchr(s, charwanted)
char const *s;
register char charwanted;
{
  register char const *scan;
  for (scan = s; *scan != charwanted;)
    if (*scan++ == '\0')
      return (void *)0;
  return (char *)scan;
}


x86 assembly (clang, -O0):
<mystrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     1156 <mystrchr+0x56>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1151 <mystrchr+0x51>
movq   $0x0,-0x8(%rbp)
jmp    115e <mystrchr+0x5e>
jmp    1116 <mystrchr+0x16>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
nopw   0x0(%rax,%rax,1)
movsbl (%rax),%edx
cmp    %edx,%ecx
je     1121 <mystrchr+0x21>
add    $0x1,%rax
test   %dl,%dl
jne    1110 <mystrchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @mystrchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %10, %2
%6 = phi i8* [ %0, %2 ], [ %11, %10 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %4, %8
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %10
%14 = phi i8* [ null, %10 ], [ %6, %5 ]
ret i8* %14
}
const char *print_status_mode(unsigned int flags) {
  switch (flags) {
  case (1 << 1):
    return "WRITE";
  case (1 << 0):
    return "READ";
  case (1 << 0) | (1 << 1):
    return "READ/WRITE";
  default:
    return "UNDEF";
  }
}


x86 assembly (clang, -O0):
<print_status_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     114d <print_status_mode+0x4d>
jmp    111b <print_status_mode+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     113d <print_status_mode+0x3d>
jmp    112c <print_status_mode+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     115d <print_status_mode+0x5d>
jmp    116d <print_status_mode+0x6d>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <print_status_mode+0x78>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <print_status_mode+0x78>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <print_status_mode+0x78>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_status_mode>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     111a <print_status_mode+0x1a>
movslq %edi,%rax
lea    0xf06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xeef(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"WRITE\00"
@.str.1 = [5 x i8] c"READ\00"
@.str.2 = [11 x i8] c"READ/WRITE\00"
@.str.3 = [6 x i8] c"UNDEF\00"
define i8* @print_status_mode(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 2, label %5
i32 1, label %6
i32 3, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [6 x i8] c"WRITE\00"
@.str.1 = [5 x i8] c"READ\00"
@.str.2 = [11 x i8] c"READ/WRITE\00"
@.str.3 = [6 x i8] c"UNDEF\00"
@reltable.print_status_mode = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_status_mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.print_status_mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_status_mode to i64)) to i32)]
define i8* @print_status_mode(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.print_status_mode to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
void INT_Excep_DMAC_DMAC2I(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_DMAC_DMAC2I() {
ret void
}
int is_in_bounds(int *arr, int size, int *ptr) {
  if (ptr >= arr && ptr < arr + size) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_in_bounds>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1145 <is_in_bounds+0x45>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1145 <is_in_bounds+0x45>
movl   $0x1,-0x4(%rbp)
jmp    114c <is_in_bounds+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bounds>:
cmp    %rdi,%rdx
setae  %al
movslq %esi,%rcx
lea    (%rdi,%rcx,4),%rcx
cmp    %rdx,%rcx
seta   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_in_bounds(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = icmp uge i32* %2, %0
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = icmp ugt i32* %6, %2
%8 = select i1 %4, i1 %7, i1 false
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *const);
void write32(FILE *const stream, int x) {
  char buf[4];
  buf[0] = (x >> 24) & 0xff;
  buf[1] = (x >> 16) & 0xff;
  buf[2] = (x >> 8) & 0xff;
  buf[3] = (x >> 0) & 0xff;
  fwrite(buf, 4, 1, stream);
}


x86 assembly (clang, -O0):
<write32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0xf(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write32>:
push   %rax
mov    %rdi,%rcx
bswap  %esi
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @write32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [4 x i8]
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = ashr i32 %6, 24
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i32, i32* %4
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %14, i8* %15
%16 = load i32, i32* %4
%17 = ashr i32 %16, 8
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %19, i8* %20
%21 = load i32, i32* %4
%22 = ashr i32 %21, 0
%23 = and i32 %22, 255
%24 = trunc i32 %23 to i8
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 %24, i8* %25
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%27 = load i32*, i32** %3
%28 = call i32 @fwrite(i8* %26, i32 4, i32 1, i32* %27)
ret void
}

LLVM IR (-O2):
define void @write32(i32* nocapture %0, i32 %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = lshr i32 %1, 24
%6 = trunc i32 %5 to i8
store i8 %6, i8* %4
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %8, i8* %9
%10 = lshr i32 %1, 8
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %11, i8* %12
%13 = trunc i32 %1 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = call i32 @fwrite(i8* %4, i32 4, i32 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("Hooray main!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [13 x i8] c"Hooray main!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int arg8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) {
  printf("%d\n", a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8);
  return a8;
}


x86 assembly (clang, -O0):
<arg8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%esi
add    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
add    -0x14(%rbp),%esi
add    -0x18(%rbp),%esi
add    0x10(%rbp),%esi
add    0x18(%rbp),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg8>:
push   %rbx
mov    0x18(%rsp),%ebx
add    %edi,%esi
add    %edx,%esi
add    %ecx,%esi
add    %r8d,%esi
add    %r9d,%esi
add    0x10(%rsp),%esi
add    %ebx,%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @arg8(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %11
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %12
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %13
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %14
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %15
%29 = add nsw i32 %27, %28
%30 = load i32, i32* %16
%31 = add nsw i32 %29, %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %16
ret i32 %33
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @arg8(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 returned %7) {
%9 = add nsw i32 %1, %0
%10 = add nsw i32 %9, %2
%11 = add nsw i32 %10, %3
%12 = add nsw i32 %11, %4
%13 = add nsw i32 %12, %5
%14 = add nsw i32 %13, %6
%15 = add nsw i32 %14, %7
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 %7
}
/* Variables and functions */
uintptr_t lrt_trans_idbase(void) { return (uintptr_t)(0xFFFFFFFE00000000ULL); }


x86 assembly (clang, -O0):
<lrt_trans_idbase>:
push   %rbp
mov    %rsp,%rbp
movabs $0xfffffffe00000000,%rax
ff ff ff
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrt_trans_idbase>:
movabs $0xfffffffe00000000,%rax
ff ff ff
ret

LLVM IR (-O0):
define i64 @lrt_trans_idbase() {
ret i64 -8589934592
}

LLVM IR (-O2):
define i64 @lrt_trans_idbase() {
ret i64 -8589934592
}
/* Variables and functions */
int mult(int);
void test_me(int x, int y) {
  int z = mult(x);
  if (z == y) {
    if (y == x + 10) {
      *(unsigned int *)NULL = 0;
    }
  }
}


x86 assembly (clang, -O0):
<test_me>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <mult@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1153 <test_me+0x43>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0xa,%ecx
cmp    %ecx,%eax
jne    114e <test_me+0x3e>
xor    %eax,%eax
movl   $0x0,(%rax)
jmp    1153 <test_me+0x43>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_me>:
jmp    1030 <mult@plt>

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

LLVM IR (-O2):
define void @test_me(i32 %0, i32 %1) {
%3 = tail call i32 @mult(i32 %0)
%4 = icmp eq i32 %3, %1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = add nsw i32 %0, 10
%7 = icmp ne i32 %6, %1
tail call void @llvm.assume(i1 %7)
br label %8
8: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fact(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int data;
  scanf("%d", &data);
  if (!(fact(data)))
    puts("Yes");
  else
    puts("No");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
cmp    $0x0,%eax
jne    1171 <main+0x41>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
jmp    117d <main+0x4d>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <fact@plt>
test   %eax,%eax
lea    0xeaf(%rip),%rax
lea    0xeac(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @fact(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @fact(i32 %4)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ draw_main_crsr();
int /*<<< orphan*/ draw_stat_bar();
int /*<<< orphan*/ draw_sub_crsr();
int /*<<< orphan*/ reset_crsr();
void update_crsr(void) {
  draw_main_crsr();
  draw_sub_crsr();
  draw_stat_bar();
  reset_crsr();
}


x86 assembly (clang, -O0):
<update_crsr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <draw_main_crsr@plt>
mov    $0x0,%al
call   1050 <draw_sub_crsr@plt>
mov    $0x0,%al
call   1040 <draw_stat_bar@plt>
mov    $0x0,%al
call   1060 <reset_crsr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_crsr>:
push   %rax
xor    %eax,%eax
call   1030 <draw_main_crsr@plt>
xor    %eax,%eax
call   1050 <draw_sub_crsr@plt>
xor    %eax,%eax
call   1040 <draw_stat_bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <reset_crsr@plt>

LLVM IR (-O0):
define void @update_crsr() {
%1 = call i32 (...) @draw_main_crsr()
%2 = call i32 (...) @draw_sub_crsr()
%3 = call i32 (...) @draw_stat_bar()
%4 = call i32 (...) @reset_crsr()
ret void
}

LLVM IR (-O2):
define void @update_crsr() {
%1 = tail call i32 (...) @draw_main_crsr()
%2 = tail call i32 (...) @draw_sub_crsr()
%3 = tail call i32 (...) @draw_stat_bar()
%4 = tail call i32 (...) @reset_crsr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ one();
int /*<<< orphan*/ two();
int other() {
  one();
  two();
  one();
  two();
}


x86 assembly (clang, -O0):
<other>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <one@plt>
mov    $0x0,%al
call   1030 <two@plt>
mov    $0x0,%al
call   1040 <one@plt>
mov    $0x0,%al
call   1030 <two@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @other() {
%1 = alloca i32
%2 = call i32 (...) @one()
%3 = call i32 (...) @two()
%4 = call i32 (...) @one()
%5 = call i32 (...) @two()
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @other() {
%1 = tail call i32 (...) @one()
%2 = tail call i32 (...) @two()
%3 = tail call i32 (...) @one()
%4 = tail call i32 (...) @two()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *, char const *);
int usage(const char *path) {
  printf("Usage: %s\n"
         "       %s add <destination> <device>\n"
         "       %s del <destination> <device>\n"
         "Lists, adds or removes a Phonet route.\n",
         path, path, path);
  return 2;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rcx
lea    0xee5(%rip),%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <printf@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [124 x i8] c"Usage: %s\0A %s add <destination> <device>\0A %s del <destination> <device>\0ALists, adds or removes a Phonet route.\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %5)
ret i32 2
}

LLVM IR (-O2):
@.str = [124 x i8] c"Usage: %s\0A %s add <destination> <device>\0A %s del <destination> <device>\0ALists, adds or removes a Phonet route.\0A\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %0)
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_104() {
  Assert_real((isqrt(104) == 10),
              "/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/stdlib/isqrt.c",
              525, ("Integer square root of 104 should be 10"));
}


x86 assembly (clang, -O0):
<t_sqrt_104>:
push   %rbp
mov    %rsp,%rbp
mov    $0x68,%edi
call   1030 <isqrt@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x20d,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_104>:
push   %rax
mov    $0x68,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x20d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 104 should be 10\00"
define void @t_sqrt_104() {
%1 = call i32 @isqrt(i32 104)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 525, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 104 should be 10\00"
define void @t_sqrt_104() {
%1 = tail call i32 @isqrt(i32 104)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 525, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int htonl(int);
uint32_t unbit_ip(uint32_t uid) {
  if (uid < 30000)
    return 0;
  uint32_t addr = (uid - 30000) + 2;
  uint32_t addr0 = 0x0a000000;
  return htonl(addr0 | (addr & 0x00ffffff));
}


x86 assembly (clang, -O0):
<unbit_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x7530,-0x8(%rbp)
jge    1134 <unbit_ip+0x24>
movl   $0x0,-0x4(%rbp)
jmp    115e <unbit_ip+0x4e>
mov    -0x8(%rbp),%eax
sub    $0x7530,%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
movl   $0xa000000,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%eax
and    $0xffffff,%eax
or     %eax,%edi
call   1030 <htonl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unbit_ip>:
cmp    $0x7530,%edi
jge    111b <unbit_ip+0xb>
xor    %eax,%eax
ret
add    $0xff8ad2,%edi
and    $0xffffff,%edi
or     $0xa000000,%edi
jmp    1030 <htonl@plt>

LLVM IR (-O0):
define i32 @unbit_ip(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 30000
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %18
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 30000
%12 = add nsw i32 %11, 2
store i32 %12, i32* %4
store i32 167772160, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = and i32 %14, 16777215
%16 = or i32 %13, %15
%17 = call i32 @htonl(i32 %16)
store i32 %17, i32* %2
br label %18
18: ; preds = %9, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @unbit_ip(i32 %0) {
%2 = icmp slt i32 %0, 30000
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = add nuw i32 %0, 16747218
%5 = and i32 %4, 16777215
%6 = or i32 %5, 167772160
%7 = tail call i32 @htonl(i32 %6)
br label %8
8: ; preds = %1, %3
%9 = phi i32 [ %7, %3 ], [ 0, %1 ]
ret i32 %9
}
unsigned int parity(unsigned int x) {
  x ^= x >> 16U;
  x ^= x >> 8U;
  x ^= x >> 4U;
  x &= 0xFU;
  return (0x6996U >> x) & 1U;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x6996,%eax
shr    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %edi,%eax
mov    %eax,%edx
shr    $0x8,%edx
xor    %eax,%edx
mov    %edx,%ecx
shr    $0x4,%ecx
xor    %edx,%ecx
and    $0xf,%cl
mov    $0x6996,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @parity(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 8
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 4
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = lshr i32 27030, %17
%19 = and i32 %18, 1
ret i32 %19
}

LLVM IR (-O2):
define i32 @parity(i32 %0) {
%2 = lshr i32 %0, 16
%3 = xor i32 %2, %0
%4 = lshr i32 %3, 8
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 4
%7 = xor i32 %6, %5
%8 = and i32 %7, 15
%9 = lshr i32 27030, %8
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
int /*<<< orphan*/ task(long);
void *threaded_task(void *t) {
  long id = (long)t;
  printf("Thread %ld started\n", id);
  task(id);
  printf("Thread %ld done\n", id);
  pthread_exit(0);
}


x86 assembly (clang, -O0):
<threaded_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <task@plt>
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threaded_task>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <task@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Thread %ld started\0A\00"
@.str.1 = [17 x i8] c"Thread %ld done\0A\00"
define i8* @threaded_task(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = load i64, i64* %4
%10 = call i32 @task(i64 %9)
%11 = load i64, i64* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = call i32 @pthread_exit(i32 0)
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [20 x i8] c"Thread %ld started\0A\00"
@.str.1 = [17 x i8] c"Thread %ld done\0A\00"
define noalias i8* @threaded_task(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @task(i64 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%6 = tail call i32 @pthread_exit(i32 0)
ret i8* undef
}
void testClosureIBIrV(void (*closure)(int, char, int), int a1, char a2,
                      int a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureIBIrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
mov    -0xd(%rbp),%cl
mov    -0x14(%rbp),%edx
movsbl %cl,%esi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureIBIrV>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    *%rax

LLVM IR (-O0):
define void @testClosureIBIrV(void (i32, i8, i32)* %0, i32 %1, i8 signext %2, i32 %3) {
%5 = alloca void (i32, i8, i32)*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
store void (i32, i8, i32)* %0, void (i32, i8, i32)** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i32 %3, i32* %8
%9 = load void (i32, i8, i32)*, void (i32, i8, i32)** %5
%10 = load i32, i32* %6
%11 = load i8, i8* %7
%12 = load i32, i32* %8
ret void
}

LLVM IR (-O2):
define void @testClosureIBIrV(void (i32, i8, i32)* nocapture %0, i32 %1, i8 signext %2, i32 %3) {
tail call void %0(i32 %1, i8 signext %2, i32 %3)
ret void
}
/* Variables and functions */
int main(int argc, char **argv) {
  char *c = NULL;
  *c = 0;
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%7 = load i8*, i8** %6
store i8 0, i8* %7
ret i32 -1
}

LLVM IR (-O2):
/* Variables and functions */
char *my_alloc1(int, int);
int test1(int len) {
  int i;
  char *p = my_alloc1(len, 32);
  return ((long int)p) & 31;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%esi
call   1030 <my_alloc1@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1f,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rax
mov    $0x20,%esi
call   1030 <my_alloc1@plt>
and    $0x1f,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @my_alloc1(i32 %5, i32 32)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = and i64 %8, 31
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @test1(i32 %0) {
%2 = tail call i8* @my_alloc1(i32 %0, i32 32)
%3 = ptrtoint i8* %2 to i64
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 31
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int x7_teardown() {
  char cmd[256];
  sprintf(cmd,
          "iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags "
          "SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d",
          1);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<x7_teardown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x1,%edx
call   1040 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x7_teardown>:
push   %rbx
sub    $0x100,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [106 x i8] c"iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x7_teardown() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x7_teardown() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 @system(i8* %2)
ret i32 0
}
__attribute__((__always___)) int tlsf_ffs(unsigned int word) {
  const unsigned int reverse = word & (~word + 1);
  const int bit = 32 - __builtin_clz(reverse);
  return bit - 1;
}


x86 assembly (clang, -O0):
<tlsf_ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
add    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
bsr    %eax,%ecx
xor    $0x1f,%ecx
mov    $0x20,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlsf_ffs>:
mov    %edi,%eax
neg    %eax
and    %edi,%eax
bsr    %eax,%eax
ret

LLVM IR (-O0):
define i32 @tlsf_ffs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = xor i32 %6, -1
%8 = add i32 %7, 1
%9 = and i32 %5, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @llvm.ctlz.i32(i32 %10, i1 true)
%12 = sub nsw i32 32, %11
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
ret i32 %14
}

LLVM IR (-O2):
define i32 @tlsf_ffs(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, %0
%4 = tail call i32 @llvm.ctlz.i32(i32 %3, i1 true)
%5 = xor i32 %4, 31
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ set_bit(int, void volatile *);
void sync_set_bit(int nr, volatile void *addr) { set_bit(nr, addr); }


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

x86 assembly (clang, -O2):
<sync_set_bit>:
jmp    1030 <set_bit@plt>

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

LLVM IR (-O2):
define void @sync_set_bit(i32 %0, i8* %1) {
%3 = tail call i32 @set_bit(i32 %0, i8* %1)
ret void
}