xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int getpid();
int /*<<< orphan*/ printf(char *, int, ...);
int main(void) {
  pid_t pid = fork();
  if (pid == 0) {
    printf("child (pid=%d)\n", getpid());
  } else {
    printf("parent (pid=%d, child's pid=%d)\n", getpid(), pid);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <main+0x41>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118c <main+0x5c>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <fork@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
test   %rbx,%rbx
je     115c <main+0x2c>
lea    0xec2(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116c <main+0x3c>
lea    0xe9d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"child (pid=%d)\0A\00"
@.str.1 = [33 x i8] c"parent (pid=%d, child's pid=%d)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @fork()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 (...) @getpid()
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %13
9: ; preds = %0
%10 = call i32 (...) @getpid()
%11 = load i64, i64* %2
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %10, i64 %11)
br label %13
13: ; preds = %9, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"child (pid=%d)\0A\00"
@.str.1 = [33 x i8] c"parent (pid=%d, child's pid=%d)\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
%3 = tail call i32 (...) @getpid()
br i1 %2, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %8
6: ; preds = %0
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %3, i64 %1)
br label %8
8: ; preds = %6, %4
ret i32 0
}
/* Variables and functions */
int pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  printf("Digite x:");
  scanf("%d", &x);
  int c = pow(x, 2);
  printf("x^2 = %d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    $0x2,%esi
call   1050 <pow@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"Digite x:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"x^2 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @pow(i32 %5, i32 2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test_mem_dynamic();
int main(void) {
  int i = 0;
  for (i = 0; i < 1024 * 1024; i++) {
    printf("\nLoop: %d\n", i);
    test_mem_dynamic();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100000,-0x8(%rbp)
jge    116e <main+0x4e>
mov    -0x8(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test_mem_dynamic@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <test_mem_dynamic@plt>
add    $0x1,%ebp
cmp    $0x100000,%ebp
jne    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\0ALoop: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1048576
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @test_mem_dynamic()
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0ALoop: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (...) @test_mem_dynamic()
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 1048576
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 0
}
long long simple_rand() {
  static unsigned long long seed = 47114711;
  unsigned long long this = seed * 1103515245 + 12345;
  seed = this;
  return this >> 8;
}


x86 assembly (clang, -O0):
<simple_rand>:
push   %rbp
mov    %rsp,%rbp
imul   $0x41c64e6d,0x2f11(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,0x2efc(%rip)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_rand>:
imul   $0x41c64e6d,0x2f15(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,0x2f08(%rip)
shr    $0x8,%rax
ret

LLVM IR (-O0):
@simple_rand.seed = internal global i64 47114711
define i64 @simple_rand() {
%1 = alloca i64
%2 = load i64, i64* @simple_rand.seed
%3 = mul i64 %2, 1103515245
%4 = add i64 %3, 12345
store i64 %4, i64* %1
%5 = load i64, i64* %1
store i64 %5, i64* @simple_rand.seed
%6 = load i64, i64* %1
%7 = lshr i64 %6, 8
ret i64 %7
}

LLVM IR (-O2):
@simple_rand.seed = internal unnamed_addr global i64 47114711
define i64 @simple_rand() {
%1 = load i64, i64* @simple_rand.seed
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
store i64 %3, i64* @simple_rand.seed
%4 = lshr i64 %3, 8
ret i64 %4
}
double mpeg3_add_double_gcc(double x, double y) { return x + y; }


x86 assembly (clang, -O0):
<mpeg3_add_double_gcc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpeg3_add_double_gcc>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mpeg3_add_double_gcc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @mpeg3_add_double_gcc(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
main(ac, av) char **av;
{ execv("/home/django-de/svn/django/hooks/post-commit.py", av); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <execv@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"/home/django-de/svn/django/hooks/post-commit.py\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 = load i8**, i8*** %4
%6 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @execv to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8** %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"/home/django-de/svn/django/hooks/post-commit.py\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (i8*, i8**, ...) bitcast (i32 (...)* @execv to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x0e() {
  Assert_real((isdigit(14) == 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_isdigit.c",
              75, ("isdigit should be 0 for 0x0e"));
}


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

x86 assembly (clang, -O2):
<t_isdigit_0x0e>:
push   %rax
mov    $0xe,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4b,%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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x0e\00"
define void @t_isdigit_0x0e() {
%1 = call i64 @isdigit(i32 14)
%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 75, 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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x0e\00"
define void @t_isdigit_0x0e() {
%1 = tail call i64 @isdigit(i32 14)
%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 75, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void NOP_ReportDebugMessage(const char *file, const char *func, int line,
                            const char *fmt, ...) {}


x86 assembly (clang, -O0):
<NOP_ReportDebugMessage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @NOP_ReportDebugMessage(i8* %0, i8* %1, i32 %2, i8* %3, ...) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
ret void
}

LLVM IR (-O2):
define void @NOP_ReportDebugMessage(i8* nocapture %0, i8* nocapture %1, i32 %2, i8* nocapture %3, ...) {
ret void
}
/* Variables and functions */
int rom_present(char *);
int s3_virge_375_4_available(void) {
  return rom_present(L"roms/video/s3virge/86c375_4.bin");
}


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

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

LLVM IR (-O0):
@.str = [32 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 115, i32 51, i32 118, i32 105, i32 114, i32 103, i32 101, i32 47, i32 56, i32 54, i32 99, i32 51, i32 55, i32 53, i32 95, i32 52, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @s3_virge_375_4_available() {
%1 = call i32 @rom_present(i8* bitcast ([32 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [32 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 115, i32 51, i32 118, i32 105, i32 114, i32 103, i32 101, i32 47, i32 56, i32 54, i32 99, i32 51, i32 55, i32 53, i32 95, i32 52, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @s3_virge_375_4_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([32 x i32]* @.str to i8*))
ret i32 %1
}
/* Type definitions */
struct rlimit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_CORE;
int /*<<< orphan*/ assert(struct rlimit const *const);
int errno;
scalar_t__ setrlimit(int /*<<< orphan*/, struct rlimit const *const);
int core_rlimit_set(const struct rlimit *const lim) {
  assert(lim);
  return setrlimit(RLIMIT_CORE, lim) ? errno : 0;
}


x86 assembly (clang, -O0):
<core_rlimit_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1040 <setrlimit@plt>
cmp    $0x0,%rax
je     1162 <core_rlimit_set+0x42>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    116c <core_rlimit_set+0x4c>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    116c <core_rlimit_set+0x4c>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<core_rlimit_set>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <setrlimit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     114d <core_rlimit_set+0x2d>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@RLIMIT_CORE = global i32 0
@errno = global i32 0
define i32 @core_rlimit_set(%struct.rlimit* %0) {
%2 = alloca %struct.rlimit*
store %struct.rlimit* %0, %struct.rlimit** %2
%3 = load %struct.rlimit*, %struct.rlimit** %2
%4 = call i32 @assert(%struct.rlimit* %3)
%5 = load i32, i32* @RLIMIT_CORE
%6 = load %struct.rlimit*, %struct.rlimit** %2
%7 = call i64 @setrlimit(i32 %5, %struct.rlimit* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* @errno
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %9
%13 = phi i32 [ %10, %9 ], [ 0, %11 ]
ret i32 %13
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@RLIMIT_CORE = global i32 0
@errno = global i32 0
define i32 @core_rlimit_set(%struct.rlimit* %0) {
%2 = tail call i32 @assert(%struct.rlimit* %0)
%3 = load i32, i32* @RLIMIT_CORE
%4 = tail call i64 @setrlimit(i32 %3, %struct.rlimit* %0)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* @errno
%7 = select i1 %5, i32 0, i32 %6
ret i32 %7
}
int main(void) {
  int x = {0, 1};
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_04(int a) {
  if (127 < a)
    a = 127;
  else if (a < -128)
    a = -128;
  return a;
}


x86 assembly (clang, -O0):
<test_04>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x7f,%eax
cmp    -0x4(%rbp),%eax
jge    1121 <test_04+0x21>
movl   $0x7f,-0x4(%rbp)
jmp    1137 <test_04+0x37>
cmpl   $0xffffff80,-0x4(%rbp)
jge    1132 <test_04+0x32>
movl   $0xffffff80,-0x4(%rbp)
jmp    1137 <test_04+0x37>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_04>:
cmp    $0xffffff81,%edi
mov    $0xffffff80,%ecx
cmovge %edi,%ecx
cmp    $0x7f,%ecx
mov    $0x7f,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_04(i32 %0) {
%2 = icmp sgt i32 %0, -128
%3 = select i1 %2, i32 %0, i32 -128
%4 = icmp slt i32 %3, 127
%5 = select i1 %4, i32 %3, i32 127
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(const char *name) {
  printf("\nusage: %s [-p]\n\n", name);
  printf("First this reads all PIDs in /proc, then it will read their status\n"
         "and some other system information and output that in CSV format to\n"
         "the standard output.\n\n"
         "With the '-p' option you can run this as normal user, as then all\n"
         "permission denied errors are ignored.\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\0Ausage: %s [-p]\0A\0A\00"
@.str.1 = [261 x i8] c"First this reads all PIDs in /proc, then it will read their status\0Aand some other system information and output that in CSV format to\0Athe standard output.\0A\0AWith the '-p' option you can run this as normal user, as then all\0Apermission denied errors are ignored.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([261 x i8], [261 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0Ausage: %s [-p]\0A\0A\00"
@str = [260 x i8] c"First this reads all PIDs in /proc, then it will read their status\0Aand some other system information and output that in CSV format to\0Athe standard output.\0A\0AWith the '-p' option you can run this as normal user, as then all\0Apermission denied errors are ignored.\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([260 x i8], [260 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 -1)
unreachable
}
f() {
  unsigned long x, y = 1;
  x = ((y * 8192) - 216) / 16;
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0xd,%rax
sub    $0xd8,%rax
shr    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i64
%2 = alloca i64
store i64 1, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 8192
%5 = sub i64 %4, 216
%6 = udiv i64 %5, 16
store i64 %6, i64* %1
%7 = load i64, i64* %1
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @f() {
ret i32 498
}
/* Variables and functions */
int /*<<< orphan*/ m68ki_exception_1111();
void m68k_op_cpbcc_32(void) {
  if (0) {

    ;
    return;
  }
  m68ki_exception_1111();
}


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

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

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

LLVM IR (-O2):
define void @m68k_op_cpbcc_32() {
%1 = tail call i32 (...) @m68ki_exception_1111()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
char *pgheader_strerror(int);
int /*<<< orphan*/ stderr;
void pgheader_error(const char *prompt, int ret) {
  if (ret) {
    fprintf(stderr, "%s: %s\n", prompt, pgheader_strerror(ret));
  }
}


x86 assembly (clang, -O0):
<pgheader_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116b <pgheader_error+0x4b>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <pgheader_strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgheader_error>:
test   %esi,%esi
je     1154 <pgheader_error+0x34>
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eaf(%rip),%rax
mov    (%rax),%ebp
mov    %esi,%edi
call   1030 <pgheader_strerror@plt>
lea    0xebf(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
define void @pgheader_error(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i8* @pgheader_strerror(i32 %10)
%12 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %11)
br label %13
13: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
define void @pgheader_error(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i8* @pgheader_strerror(i32 %1)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %6)
br label %8
8: ; preds = %4, %2
ret void
}
void wait_vblank(void) {
  while (((*(volatile unsigned short *)0x4000004) & 1)) {
  }
}


x86 assembly (clang, -O0):
<wait_vblank>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <wait_vblank+0x9>
mov    $0x4000004,%eax
mov    (%rax),%ax
movzwl %ax,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1125 <wait_vblank+0x25>
jmp    1109 <wait_vblank+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_vblank>:
movzwl 0x4000004,%eax
04
test   $0x1,%al
jne    1100 <wait_vblank>
ret

LLVM IR (-O0):
define void @wait_vblank() {
br label %1
1: ; preds = %6, %0
%2 = load volatile i16, i16* inttoptr (i64 67108868 to i16*)
%3 = zext i16 %2 to i32
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %1
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @wait_vblank() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i16, i16* inttoptr (i64 67108868 to i16*)
%3 = and i16 %2, 1
%4 = icmp eq i16 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
ret void
}
float f(float x0, float y0, float x1, float y1, float px, float py) {
  return (y0 - y1) * px + (x1 - x0) * py + x0 * y1 - x1 * y0;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movaps %xmm2,%xmm6
mulss  %xmm1,%xmm2
subss  %xmm3,%xmm1
subss  %xmm0,%xmm6
mulss  %xmm5,%xmm6
mulss  %xmm4,%xmm1
addss  %xmm6,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
subss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @f(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load float, float* %8
%14 = load float, float* %10
%15 = fsub float %13, %14
%16 = load float, float* %11
%17 = load float, float* %9
%18 = load float, float* %7
%19 = fsub float %17, %18
%20 = load float, float* %12
%21 = fmul float %19, %20
%22 = call float @llvm.fmuladd.f32(float %15, float %16, float %21)
%23 = load float, float* %7
%24 = load float, float* %10
%25 = call float @llvm.fmuladd.f32(float %23, float %24, float %22)
%26 = load float, float* %9
%27 = load float, float* %8
%28 = fneg float %26
%29 = call float @llvm.fmuladd.f32(float %28, float %27, float %25)
ret float %29
}

LLVM IR (-O2):
define float @f(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fsub float %1, %3
%8 = fsub float %2, %0
%9 = fmul float %8, %5
%10 = tail call float @llvm.fmuladd.f32(float %7, float %4, float %9)
%11 = tail call float @llvm.fmuladd.f32(float %0, float %3, float %10)
%12 = fneg float %2
%13 = tail call float @llvm.fmuladd.f32(float %12, float %1, float %11)
ret float %13
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int string_gt(char *s1, char *s2, int k) {
  k = 0;
  return strcmp(s1, s2) > 0;
}


x86 assembly (clang, -O0):
<string_gt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @string_gt(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %7, i8* %8)
%10 = icmp sgt i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @string_gt(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = icmp sgt i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned int build_rflocal(txi, txq, rxi, rxq) {
  return (txi + txq << 6 + rxi << 12 + rxq << 18);
}


x86 assembly (clang, -O0):
<build_rflocal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x6,%ecx
shl    %cl,%eax
mov    -0x10(%rbp),%ecx
add    $0xc,%ecx
shl    %cl,%eax
shl    $0x12,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_rflocal>:
mov    %ecx,%r8d
lea    (%rdi,%rsi,1),%eax
lea    0x6(%rdx),%ecx
shl    %cl,%eax
add    $0xc,%r8b
mov    %r8d,%ecx
shl    %cl,%eax
shl    $0x12,%eax
ret

LLVM IR (-O0):
define i32 @build_rflocal(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %7
%13 = add nsw i32 6, %12
%14 = shl i32 %11, %13
%15 = load i32, i32* %8
%16 = add nsw i32 12, %15
%17 = shl i32 %14, %16
%18 = shl i32 %17, 18
ret i32 %18
}

LLVM IR (-O2):
define i32 @build_rflocal(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, %0
%6 = add nsw i32 %2, 6
%7 = shl i32 %5, %6
%8 = add nsw i32 %3, 12
%9 = shl i32 %7, %8
%10 = shl i32 %9, 18
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(char *prog_name) {
  printf("Usage: %s [options] <prog>\n", prog_name);
  printf("\t -h --help\t\tdisplay usage summary\n");
  printf("\t -v --version\t\tdisplay version\n");
  printf("\t -c --config=<file>\tset config file\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0e(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Usage: %s [options] <prog>\0A\00"
@.str.1 = [36 x i8] c"\09 -h --help\09\09display usage summary\0A\00"
@.str.2 = [33 x i8] c"\09 -v --version\09\09display version\0A\00"
@.str.3 = [38 x i8] c"\09 -c --config=<file>\09set config file\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Usage: %s [options] <prog>\0A\00"
@str = [35 x i8] c"\09 -h --help\09\09display usage summary\00"
@str.4 = [32 x i8] c"\09 -v --version\09\09display version\00"
@str.5 = [37 x i8] c"\09 -c --config=<file>\09set config file\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.5, i64 0, i64 0))
ret void
}
int test_imm_66uint8_reg(unsigned char val) {
  return ((val) & (0x66 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_66uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x66,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_66uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 102
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ japi_settext(int, char *);
void j_settext(int arg0, char *arg1) { japi_settext(arg0, arg1); }


x86 assembly (clang, -O0):
<j_settext>:
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 <japi_settext@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_settext>:
jmp    1030 <japi_settext@plt>

LLVM IR (-O0):
define void @j_settext(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 @japi_settext(i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
define void @j_settext(i32 %0, i8* %1) {
%3 = tail call i32 @japi_settext(i32 %0, i8* %1)
ret void
}
void stringtozero(char *a) {
  int x;
  for (x = 0; a[x] != '\0'; x++) {
    a[x] = '\0';
  }
  return;
}


x86 assembly (clang, -O0):
<stringtozero>:
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     113e <stringtozero+0x3e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <stringtozero+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringtozero>:
cmpb   $0x0,(%rdi)
je     111d <stringtozero+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <stringtozero+0x10>
ret

LLVM IR (-O0):
define void @stringtozero(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %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 %20
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @stringtozero(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
store i8 0, i8* %6
%7 = add nuw nsw i64 %5, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
double *m_new(int rows, int cols) {
  return (double *)malloc(sizeof(double) * rows * cols);
}


x86 assembly (clang, -O0):
<m_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
movslq -0x8(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_new>:
imul   %esi,%edi
shl    $0x3,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define double* @m_new(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = mul i64 8, %6
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = mul i64 %7, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to double*
ret double* %13
}

LLVM IR (-O2):
define double* @m_new(i32 %0, i32 %1) {
%3 = shl i32 %0, 3
%4 = mul i32 %3, %1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to double*
ret double* %6
}
/* Variables and functions */
int /*<<< orphan*/ mrbc_tick();
void sig_alarm(int dummy) { mrbc_tick(); }


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

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

LLVM IR (-O0):
define void @sig_alarm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @mrbc_tick()
ret void
}

LLVM IR (-O2):
define void @sig_alarm(i32 %0) {
%2 = tail call i32 (...) @mrbc_tick()
ret void
}
/* Variables and functions */
int *glob_ptr(int *);
void foo(int *x) {
  int *p = glob_ptr(x);
  *p = 3;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
call   1030 <glob_ptr@plt>
movl   $0x3,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @foo(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32* @glob_ptr(i32* %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
store i32 3, i32* %6
ret void
}

LLVM IR (-O2):
define void @foo(i32* %0) {
%2 = tail call i32* @glob_ptr(i32* %0)
store i32 3, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_write(char);
void uart_puts(const char *s) {
  while (*s) {
    if (*s == '\n')
      uart_write('\r');
    uart_write(*s++);
  }
}


x86 assembly (clang, -O0):
<uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <uart_puts+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1143 <uart_puts+0x33>
mov    $0xd,%edi
call   1030 <uart_write@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <uart_write@plt>
jmp    111c <uart_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_puts>:
push   %rbx
mov    %rdi,%rbx
jmp    1139 <uart_puts+0x29>
cs nopw 0x0(%rax,%rax,1)
mov    $0xd,%edi
call   1030 <uart_write@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
movsbl %al,%edi
call   1030 <uart_write@plt>
movzbl (%rbx),%eax
cmp    $0xa,%al
je     1120 <uart_puts+0x10>
test   %al,%al
jne    112d <uart_puts+0x1d>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uart_puts(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = load i8, i8* %3
switch i8 %4, label %8 [
i8 0, label %12
i8 10, label %5
]
5: ; preds = %2
%6 = tail call i32 @uart_write(i8 signext 13)
%7 = load i8, i8* %3
br label %8
8: ; preds = %2, %5
%9 = phi i8 [ %4, %2 ], [ %7, %5 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
%11 = tail call i32 @uart_write(i8 signext %9)
br label %2
12: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello,world\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%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 = [13 x i8] c"hello,world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"hello,world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ KDGETLED;
scalar_t__ ioctl(int, int /*<<< orphan*/, long *);
long int get_leds(int console) {
  long int led = 0;
  if (ioctl(console, KDGETLED, &led) < 0)
    return -1;
  led = led & 7;
  return led;
}


x86 assembly (clang, -O0):
<get_leds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    114f <get_leds+0x3f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1163 <get_leds+0x53>
mov    -0x18(%rbp),%rax
and    $0x7,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_leds>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
mov    (%rsp),%rcx
and    $0x7,%ecx
test   %rax,%rax
mov    $0xffffffffffffffff,%rax
cmovns %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@KDGETLED = global i32 0
define i64 @get_leds(i32 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 0, i64* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @KDGETLED
%7 = call i64 @ioctl(i32 %5, i32 %6, i64* %4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i64 -1, i64* %2
br label %14
10: ; preds = %1
%11 = load i64, i64* %4
%12 = and i64 %11, 7
store i64 %12, i64* %4
%13 = load i64, i64* %4
store i64 %13, i64* %2
br label %14
14: ; preds = %10, %9
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
@KDGETLED = global i32 0
define i64 @get_leds(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = load i32, i32* @KDGETLED
%5 = call i64 @ioctl(i32 %0, i32 %4, i64* %2)
%6 = load i64, i64* %2
%7 = and i64 %6, 7
%8 = icmp sgt i64 %5, -1
%9 = select i1 %8, i64 %7, i64 -1
ret i64 %9
}
/* Variables and functions */
char const *getfirstn(char const *, int);
char *strchr(char const *, char const);
const char *getfirstbysep(const char *x, const char sep) {
  const char *p = strchr(x, sep);
  if (!p)
    return x;
  return getfirstn(x, p - x);
}


x86 assembly (clang, -O0):
<getfirstbysep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115b <getfirstbysep+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <getfirstbysep+0x55>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1040 <getfirstn@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfirstbysep>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strchr@plt>
test   %rax,%rax
je     113b <getfirstbysep+0x1b>
sub    %ebx,%eax
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <getfirstn@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @getfirstbysep(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
%8 = load i8, i8* %5
%9 = call i8* @strchr(i8* %7, i8 signext %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = load i8*, i8** %4
store i8* %13, i8** %3
br label %23
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i8*, i8** %6
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = trunc i64 %20 to i32
%22 = call i8* @getfirstn(i8* %15, i32 %21)
store i8* %22, i8** %3
br label %23
23: ; preds = %14, %12
%24 = load i8*, i8** %3
ret i8* %24
}

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