xunge/DecIR huggingface dataset:
void too_many_args(int(a) __attribute((unused)), int(b) __attribute((unused)),
                   int(c) __attribute((unused)), int(d) __attribute((unused)),
                   int(e) __attribute((unused)), int(f) __attribute((unused)),
                   int(g) __attribute((unused)), int(h) __attribute((unused)),
                   int(i) __attribute((unused)), int(j) __attribute((unused))) {
}


x86 assembly (clang, -O0):
<too_many_args>:
push   %rbp
mov    %rsp,%rbp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
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)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @too_many_args(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
ret void
}

LLVM IR (-O2):
define void @too_many_args(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
ret void
}
void pthread_condattr_getpshared() {}


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

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

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

LLVM IR (-O2):
define void @pthread_condattr_getpshared() {
ret void
}
int test_imm_28int16_mem(short *val) {
  return ((*val) & (-0x28 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_28int16_mem>:
movzwl (%rdi),%eax
test   $0xffd8,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_28int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -40
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int ds_get_boolean(int /*<<< orphan*/, int);
int snmp_get_random_access(void) { return ds_get_boolean(0, 14); }


x86 assembly (clang, -O0):
<snmp_get_random_access>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0xe,%esi
call   1030 <ds_get_boolean@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<snmp_get_random_access>:
xor    %edi,%edi
mov    $0xe,%esi
jmp    1030 <ds_get_boolean@plt>

LLVM IR (-O0):
define i32 @snmp_get_random_access() {
%1 = call i32 @ds_get_boolean(i32 0, i32 14)
ret i32 %1
}

LLVM IR (-O2):
define i32 @snmp_get_random_access() {
%1 = tail call i32 @ds_get_boolean(i32 0, i32 14)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ puts(char *);
int read_line(char **, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(void) {
  char *buff = NULL;
  while (read_line(&buff, stdin) != -1) {
    puts(buff);
    free(buff);
  }
  puts("test driver done");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdi
call   1050 <read_line@plt>
cmp    $0xffffffff,%eax
je     1179 <main+0x49>
mov    -0x10(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    1147 <main+0x17>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    0x2ea5(%rip),%r14
mov    (%r14),%esi
mov    %rsp,%rdi
call   1050 <read_line@plt>
cmp    $0xffffffff,%eax
je     1182 <main+0x52>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%rdi
call   1040 <puts@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1050 <read_line@plt>
cmp    $0xffffffff,%eax
jne    1160 <main+0x30>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [17 x i8] c"test driver done\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* @stdin
%5 = call i32 @read_line(i8** %2, i32 %4)
%6 = icmp ne i32 %5, -1
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = call i32 @puts(i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
br label %3
12: ; preds = %3
%13 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [17 x i8] c"test driver done\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = load i32, i32* @stdin
%4 = call i32 @read_line(i8** %1, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %14, label %6
6: ; preds = %0, %6
%7 = load i8*, i8** %1
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = load i8*, i8** %1
%10 = call i32 @free(i8* %9)
%11 = load i32, i32* @stdin
%12 = call i32 @read_line(i8** %1, i32 %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %6
14: ; preds = %6, %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int find_contact_by_user(char *);
int strlen(char *);
int check_name(char *name) {
  int i = strlen(name);
  if (strlen(name) > 20) {
    return 101;
  } else if (find_contact_by_user(name) != -1) {
    return 102;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x14,%eax
jle    1156 <check_name+0x36>
movl   $0x65,-0x4(%rbp)
jmp    1180 <check_name+0x60>
mov    -0x10(%rbp),%rdi
call   1030 <find_contact_by_user@plt>
cmp    $0xffffffff,%eax
je     1174 <check_name+0x54>
movl   $0x66,-0x4(%rbp)
jmp    1180 <check_name+0x60>
jmp    1179 <check_name+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_name>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0x65,%eax
cmp    $0x14,%ecx
jg     1152 <check_name+0x32>
mov    %rbx,%rdi
call   1030 <find_contact_by_user@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
mov    $0x66,%eax
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @check_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = icmp sgt i32 %8, 20
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 101, i32* %2
br label %18
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i32 @find_contact_by_user(i8* %12)
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 102, i32* %2
br label %18
16: ; preds = %11
br label %17
17: ; preds = %16
store i32 0, i32* %2
br label %18
18: ; preds = %17, %15, %10
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @check_name(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 20
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @find_contact_by_user(i8* %0)
%7 = icmp eq i32 %6, -1
%8 = select i1 %7, i32 0, i32 102
br label %9
9: ; preds = %5, %1
%10 = phi i32 [ 101, %1 ], [ %8, %5 ]
ret i32 %10
}
void ut32_unpack(char s[4], unsigned int *u) {
  unsigned int result = 0;
  result = (unsigned char)s[3];
  result <<= 8;
  result += (unsigned char)s[2];
  result <<= 8;
  result += (unsigned char)s[1];
  result <<= 8;
  result += (unsigned char)s[0];
  *u = result;
}


x86 assembly (clang, -O0):
<ut32_unpack>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ut32_unpack(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = shl i32 %10, 8
store i32 %11, i32* %5
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i32, i32* %5
%17 = add i32 %16, %15
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = shl i32 %18, 8
store i32 %19, i32* %5
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = load i32, i32* %5
%25 = add i32 %24, %23
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = shl i32 %26, 8
store i32 %27, i32* %5
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = load i32, i32* %5
%33 = add i32 %32, %31
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = load i32*, i32** %4
store i32 %34, i32* %35
ret void
}

LLVM IR (-O2):
define void @ut32_unpack(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw nsw i32 %5, 16
%10 = shl nuw nsw i32 %8, 8
%11 = or i32 %10, %9
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = or i32 %11, %14
%16 = shl nuw i32 %15, 8
%17 = load i8, i8* %0
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
store i32 %19, i32* %1
ret void
}
void ed25519_Verify_Finish(void *ctx) {}


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

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

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

LLVM IR (-O2):
define void @ed25519_Verify_Finish(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int one_if(int val) {
  int x = val;
  if (x > val) {
    printf("Yes\n");
    if (x > 6) {
      printf("t");
    }
  } else {
    printf("No\n");
    return 4;
  }
  printf("h");
  exit(2);
  return x;
}


x86 assembly (clang, -O0):
<one_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1164 <one_if+0x44>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x6,-0x8(%rbp)
jle    115f <one_if+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <one_if+0x5b>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%eax
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<one_if>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Yes\0A\00"
@.str.1 = [2 x i8] c"t\00"
@.str.2 = [4 x i8] c"No\0A\00"
@.str.3 = [2 x i8] c"h\00"
define i32 @one_if(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 6
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
br label %17
15: ; preds = %1
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 4
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@str = [3 x i8] c"No\00"
define i32 @one_if(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void exit_error(const char *err_msg) {
  fprintf(stderr, "ERROR: %s\n", err_msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<exit_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exit_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @exit_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @exit_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x88() {
  Assert_real((islower(136) == 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_islower.c",
              685, ("islower should be 0 for 0x88"));
}


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

x86 assembly (clang, -O2):
<t_islower_0x88>:
push   %rax
mov    $0x88,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2ad,%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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0x88\00"
define void @t_islower_0x88() {
%1 = call i64 @islower(i32 136)
%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 685, i8* getelementptr inbounds ([29 x i8], [29 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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0x88\00"
define void @t_islower_0x88() {
%1 = tail call i64 @islower(i32 136)
%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 685, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void intToByteLong(char *bytefield, int number) {
  *(bytefield + 3) = (number >> 24) & 0xFF;
  *(bytefield + 2) = (number >> 16) & 0xFF;
  *(bytefield + 1) = (number >> 8) & 0xFF;
  *(bytefield + 0) = number & 0xFF;
}


x86 assembly (clang, -O0):
<intToByteLong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<intToByteLong>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @intToByteLong(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
%5 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %4, i8* %5
%6 = lshr i32 %1, 16
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %7, i8* %8
%9 = lshr i32 %1, 8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %10, i8* %11
%12 = trunc i32 %1 to i8
store i8 %12, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ str2;
typedef int /*<<< orphan*/ str1;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *addColor(char *str1, char *str2) {
  char *sequenced = malloc(4 * (sizeof(str1) + sizeof(str2)));
  assert(sequenced != NULL);
  sprintf(sequenced, "%s;%s", str1, str2);
  return sequenced;
}


x86 assembly (clang, -O0):
<addColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8d(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addColor>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x40,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s;%s\00"
define i8* @addColor(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i8* @malloc(i32 64)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %5
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s;%s\00"
define noalias i8* @addColor(i8* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(64) i8* @malloc(i32 64)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ SPI1_DriverIRQHandler();
__attribute__((weak, section(".after_vectors"))) void SPI1_IRQHandler(void) {
  SPI1_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @SPI1_IRQHandler() section ".after_vectors" {
%1 = call i32 (...) @SPI1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @SPI1_IRQHandler() section ".after_vectors" {
%1 = tail call i32 (...) @SPI1_DriverIRQHandler()
ret void
}
/* Variables and functions */
size_t strlen(const char *string) {
  size_t length = 0;
  while (string[length] != '\0') {
    ++length;
  }
  return length;
}


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

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

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_103() {
  Assert_real((isqrt(103) == 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",
              520, ("Integer square root of 103 should be 10"));
}


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

x86 assembly (clang, -O2):
<t_sqrt_103>:
push   %rax
mov    $0x67,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x208,%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 103 should be 10\00"
define void @t_sqrt_103() {
%1 = call i32 @isqrt(i32 103)
%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 520, 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 103 should be 10\00"
define void @t_sqrt_103() {
%1 = tail call i32 @isqrt(i32 103)
%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 520, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void drawcirc(int n) { (void)n; }


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

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

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

LLVM IR (-O2):
define void @drawcirc(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int lseek(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1)
    printf("cannot seek\n");
  else
    printf("seek OK\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
cmp    $0xffffffff,%eax
jne    1172 <main+0x42>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <main+0x4e>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
cmp    $0xffffffff,%eax
lea    0xeb4(%rip),%rax
lea    0xea5(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@SEEK_CUR = global i32 0
@.str = [13 x i8] c"cannot seek\0A\00"
@.str.1 = [9 x i8] c"seek OK\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @STDIN_FILENO
%3 = load i32, i32* @SEEK_CUR
%4 = call i32 @lseek(i32 %2, i32 0, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@SEEK_CUR = global i32 0
@str = [8 x i8] c"seek OK\00"
@str.2 = [12 x i8] c"cannot seek\00"
define i32 @main() {
%1 = load i32, i32* @STDIN_FILENO
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @lseek(i32 %1, i32 0, i32 %2)
%4 = icmp eq i32 %3, -1
%5 = select i1 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = tail call i32 @exit(i32 0)
unreachable
}
void lib_memclear(char *list, int n) {
  while (n > 0) {
    *list = 0;
    list++;
    n--;
  }
}


x86 assembly (clang, -O0):
<lib_memclear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1136 <lib_memclear+0x36>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <lib_memclear+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_memclear>:
test   %esi,%esi
jle    1122 <lib_memclear+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @lib_memclear(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ toupper(char);
void str2upper(char *str) {
  int i = 0;
  while (str[i])
    toupper(str[i++]);
  return;
}


x86 assembly (clang, -O0):
<str2upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1155 <str2upper+0x45>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
jmp    1123 <str2upper+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @str2upper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = tail call i32 @toupper(i8 signext %6)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int length(char s[]) {
  int result;
  result = 0;
  while (s[result] != '\0')
    result++;
  return result;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <length+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int ENOSYS;
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) { return -ENOSYS; }


x86 assembly (clang, -O0):
<pthread_rwlock_unlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ed7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_rwlock_unlock>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @pthread_rwlock_unlock(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_rwlock_unlock(i32* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ another_func();
int /*<<< orphan*/ example_func();
int /*<<< orphan*/ sample_state();
int main() {
  example_func();
  sample_state();
  another_func();
  sample_state();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <example_func@plt>
mov    $0x0,%al
call   1040 <sample_state@plt>
mov    $0x0,%al
call   1050 <another_func@plt>
mov    $0x0,%al
call   1040 <sample_state@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @example_func()
%2 = call i32 (...) @sample_state()
%3 = call i32 (...) @another_func()
%4 = call i32 (...) @sample_state()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @example_func()
%2 = tail call i32 (...) @sample_state()
%3 = tail call i32 (...) @another_func()
%4 = tail call i32 (...) @sample_state()
ret i32 0
}
int Cyc__IO_padn(int (*ioputc)(int, void *), void *ioputc_env, char c,
                 int howmany) {
  int i = 0;
  while (i < howmany) {
    if (({ ioputc((int)c, ioputc_env); }) == -1)
      return i;
    ++i;
  }
  return i;
}


x86 assembly (clang, -O0):
<Cyc__IO_padn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    115f <Cyc__IO_padn+0x5f>
mov    -0x10(%rbp),%rax
movsbl -0x19(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   *%rax
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    1151 <Cyc__IO_padn+0x51>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <Cyc__IO_padn+0x65>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111f <Cyc__IO_padn+0x1f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc__IO_padn>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %ecx,%ecx
jle    1139 <Cyc__IO_padn+0x39>
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %r15,%rsi
call   *%r12
cmp    $0xffffffff,%eax
je     113b <Cyc__IO_padn+0x3b>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <Cyc__IO_padn+0x20>
mov    %ebx,%ebp
jmp    113b <Cyc__IO_padn+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Cyc__IO_padn(i32 (i32, i8*)* %0, i8* %1, i8 signext %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32 (i32, i8*)*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 (i32, i8*)* %0, i32 (i32, i8*)** %6
store i8* %1, i8** %7
store i8 %2, i8* %8
store i32 %3, i32* %9
store i32 0, i32* %10
br label %12
12: ; preds = %26, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i32 (i32, i8*)*, i32 (i32, i8*)** %6
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = load i8*, i8** %7
%21 = call i32 %17(i32 %19, i8* %20)
store i32 %21, i32* %11
%22 = load i32, i32* %11
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = load i32, i32* %10
store i32 %25, i32* %5
br label %31
26: ; preds = %16
%27 = load i32, i32* %10
%28 = add nsw i32 %27, 1
store i32 %28, i32* %10
br label %12
29: ; preds = %12
%30 = load i32, i32* %10
store i32 %30, i32* %5
br label %31
31: ; preds = %29, %24
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @Cyc__IO_padn(i32 (i32, i8*)* nocapture %0, i8* %1, i8 signext %2, i32 %3) {
%5 = sext i8 %2 to i32
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %14
7: ; preds = %4, %11
%8 = phi i32 [ %12, %11 ], [ 0, %4 ]
%9 = tail call i32 %0(i32 %5, i8* %1)
%10 = icmp eq i32 %9, -1
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, %3
br i1 %13, label %14, label %7
14: ; preds = %7, %11, %4
%15 = phi i32 [ 0, %4 ], [ %3, %11 ], [ %8, %7 ]
ret i32 %15
}
/* Variables and functions */
char *strchr(char *, int);
void changecolon(char *nt) {
  do
    if ((nt = strchr(nt, 254)))
      *nt = ':';
  while (nt != NULL);
}


x86 assembly (clang, -O0):
<changecolon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xfe,%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     113f <changecolon+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x3a,(%rax)
jmp    1144 <changecolon+0x34>
cmpq   $0x0,-0x8(%rbp)
jne    111c <changecolon+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changecolon>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xfe,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1137 <changecolon+0x27>
movb   $0x3a,(%rax)
mov    %rax,%rdi
jmp    1120 <changecolon+0x10>
pop    %rax
ret

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

LLVM IR (-O2):
define void @changecolon(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 254)
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %2, %1 ]
store i8 58, i8* %5
%6 = tail call i8* @strchr(i8* dereferenceable(1) %5, i32 254)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %4
8: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Decode_xxxxnnnxssmmmrrr();
int /*<<< orphan*/ DoBinOpSub(int /*<<< orphan*/);
void DoCodeSubQ(void) { DoBinOpSub(Decode_xxxxnnnxssmmmrrr()); }


x86 assembly (clang, -O0):
<DoCodeSubQ>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Decode_xxxxnnnxssmmmrrr@plt>
mov    %eax,%edi
call   1030 <DoBinOpSub@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoCodeSubQ>:
push   %rax
xor    %eax,%eax
call   1040 <Decode_xxxxnnnxssmmmrrr@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <DoBinOpSub@plt>

LLVM IR (-O0):
define void @DoCodeSubQ() {
%1 = call i32 (...) @Decode_xxxxnnnxssmmmrrr()
%2 = call i32 @DoBinOpSub(i32 %1)
ret void
}

LLVM IR (-O2):
define void @DoCodeSubQ() {
%1 = tail call i32 (...) @Decode_xxxxnnnxssmmmrrr()
%2 = tail call i32 @DoBinOpSub(i32 %1)
ret void
}
void testClosureSrV(void (*closure)(short), short a1) { (*closure)(a1); }


x86 assembly (clang, -O0):
<testClosureSrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movswl -0xa(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @testClosureSrV(void (i16)* %0, i16 signext %1) {
%3 = alloca void (i16)*
%4 = alloca i16
store void (i16)* %0, void (i16)** %3
store i16 %1, i16* %4
%5 = load void (i16)*, void (i16)** %3
%6 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @testClosureSrV(void (i16)* nocapture %0, i16 signext %1) {
tail call void %0(i16 signext %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ const *,
                               int /*<<< orphan*/ *);
void sig_unlock(const sigset_t *s) { sigprocmask(SIG_SETMASK, s, NULL); }


x86 assembly (clang, -O0):
<sig_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_unlock>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
jmp    1030 <sigprocmask@plt>

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
define void @sig_unlock(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @SIG_SETMASK
%4 = load i32*, i32** %2
%5 = call i32 @sigprocmask(i32 %3, i32* %4, i32* null)
ret void
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define void @sig_unlock(i32* %0) {
%2 = load i32, i32* @SIG_SETMASK
%3 = tail call i32 @sigprocmask(i32 %2, i32* %0, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int print_error(int *array, int fw_x) {
  printf(
      "attempted to use position %i in an array that only has %i positions\n",
      fw_x >> 1, *array);
  exit(0);
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
sar    $0x1,%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_error>:
push   %rax
sar    %esi
mov    (%rdi),%edx
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"attempted to use position %i in an array that only has %i positions\0A\00"
define i32 @print_error(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 1
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [69 x i8] c"attempted to use position %i in an array that only has %i positions\0A\00"
define i32 @print_error(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 1
%4 = load i32, i32* %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *do_png(int *, int *, int *, int);
int /*<<< orphan*/ start_file(int /*<<< orphan*/ *);
unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp,
                                       int req_comp) {
  start_file(f);
  return do_png(x, y, comp, req_comp);
}


x86 assembly (clang, -O0):
<stbi_png_load_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <start_file@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <do_png@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbi_png_load_from_file>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%rbx
call   1030 <start_file@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <do_png@plt>

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

LLVM IR (-O2):
define i8* @stbi_png_load_from_file(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = tail call i32 @start_file(i32* %0)
%7 = tail call i8* @do_png(i32* %1, i32* %2, i32* %3, i32 %4)
ret i8* %7
}