xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
void error_exit(int err_num, char *message) {
  fprintf(stderr, "%s:%s\n", message, strerror(err_num));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_exit>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
call   1050 <strerror@plt>
lea    0xeb5(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s:%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @error_exit(i32 %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i8* @strerror(i32 %0)
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ colog(int, int, char *, ...);
int main(void) {
  colog(0, (90 + 1), "error: something something: %d\n", -1);
  colog(0, (90 + 3), "warning: something something: %d\n", -2);
  colog(0x8000, (30 + 3), "--- MARK ---\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x5b,%esi
lea    0xed3(%rip),%rdx
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1030 <colog@plt>
xor    %edi,%edi
mov    $0x5d,%esi
lea    0xed9(%rip),%rdx
mov    $0xfffffffe,%ecx
mov    $0x0,%al
call   1030 <colog@plt>
mov    $0x8000,%edi
mov    $0x21,%esi
lea    0xede(%rip),%rdx
mov    $0x0,%al
call   1030 <colog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdx
xor    %edi,%edi
mov    $0x5b,%esi
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1030 <colog@plt>
lea    0xeee(%rip),%rdx
xor    %edi,%edi
mov    $0x5d,%esi
mov    $0xfffffffe,%ecx
xor    %eax,%eax
call   1030 <colog@plt>
lea    0xef6(%rip),%rdx
mov    $0x8000,%edi
mov    $0x21,%esi
xor    %eax,%eax
call   1030 <colog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"error: something something: %d\0A\00"
@.str.1 = [34 x i8] c"warning: something something: %d\0A\00"
@.str.2 = [14 x i8] c"--- MARK ---\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i32, i32, i8*, ...) @colog(i32 0, i32 91, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 -1)
%3 = call i32 (i32, i32, i8*, ...) @colog(i32 0, i32 93, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 -2)
%4 = call i32 (i32, i32, i8*, ...) @colog(i32 32768, i32 33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"error: something something: %d\0A\00"
@.str.1 = [34 x i8] c"warning: something something: %d\0A\00"
@.str.2 = [14 x i8] c"--- MARK ---\0A\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, i8*, ...) @colog(i32 0, i32 91, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 (i32, i32, i8*, ...) @colog(i32 0, i32 93, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 -2)
%3 = tail call i32 (i32, i32, i8*, ...) @colog(i32 32768, i32 33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int execve(char *, char **, char **);
int main(int argc, char *argv[]) {
  if (argc == 0)
    return 0;
  char *exec_argv[1], *exec_envp[1];
  exec_argv[0] = exec_envp[0] = NULL;
  return execve("./exec-null", exec_argv, exec_envp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1163 <main+0x53>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xea5(%rip),%rdi
call   1030 <execve@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
je     1145 <main+0x35>
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xecf(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <execve@plt>
add    $0x18,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"./exec-null\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1 x i8*]
%7 = alloca [1 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %17
11: ; preds = %2
%12 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
store i8* null, i8** %12
%13 = getelementptr inbounds [1 x i8*], [1 x i8*]* %6, i64 0, i64 0
store i8* null, i8** %13
%14 = getelementptr inbounds [1 x i8*], [1 x i8*]* %6, i64 0, i64 0
%15 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
%16 = call i32 @execve(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %14, i8** %15)
store i32 %16, i32* %3
br label %17
17: ; preds = %11, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [12 x i8] c"./exec-null\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1 x i8*]
%4 = alloca [1 x i8*]
%5 = icmp eq i32 %0, 0
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = bitcast [1 x i8*]* %3 to i8*
%8 = bitcast [1 x i8*]* %4 to i8*
%9 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
store i8* null, i8** %9
%10 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
store i8* null, i8** %10
%11 = call i32 @execve(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %10, i8** %9)
br label %12
12: ; preds = %2, %6
%13 = phi i32 [ %11, %6 ], [ 0, %2 ]
ret i32 %13
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dnanmax(int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 0.0 / 0.0, 0.0 / 0.0};
  int64_t N = 5;
  int64_t stride = 2;
  double v = stdlib_strided_dnanmax(N, x, stride);
  printf("max: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
movl   $0x5,-0x54(%rbp)
movl   $0x2,-0x58(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%edx
call   1040 <stdlib_strided_dnanmax@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x5,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dnanmax@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 0x7FF8000000000000, double 0x7FF8000000000000]
@.str = [10 x i8] c"max: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [10 x double]* %1 to i8*
store i32 5, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dnanmax(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 0x7FF8000000000000, double 0x7FF8000000000000]
@.str = [10 x i8] c"max: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = bitcast [10 x double]* %1 to i8*
%3 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dnanmax(i32 5, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
_Bool QuietEqual(float f1, float f2) { return f1 == f2; }


x86 assembly (clang, -O0):
<QuietEqual>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuietEqual>:
cmpeqss %xmm1,%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define zeroext i1 @QuietEqual(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp oeq float %5, %6
ret i1 %7
}

LLVM IR (-O2):
define zeroext i1 @QuietEqual(float %0, float %1) {
%3 = fcmp oeq float %0, %1
ret i1 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x26() {
  Assert_real((isspace(38) == 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_isspace.c",
              195, ("isspace should be 0 for &"));
}


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

x86 assembly (clang, -O2):
<t_isspace_0x26>:
push   %rax
mov    $0x26,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xc3,%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_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for &\00"
define void @t_isspace_0x26() {
%1 = call i64 @isspace(i32 38)
%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 195, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for &\00"
define void @t_isspace_0x26() {
%1 = tail call i64 @isspace(i32 38)
%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 195, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int XDisplayPlanes() {}


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

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

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

LLVM IR (-O2):
define i32 @XDisplayPlanes() {
ret i32 undef
}
extern __attribute__((gnu_)) double
carmen_knots_to_meters_per_second(double knots) {
  return (0.5148 * knots);
}


x86 assembly (clang, -O0):
<carmen_knots_to_meters_per_second>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_knots_to_meters_per_second>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @carmen_knots_to_meters_per_second(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 5.148000e-01, %3
ret double %4
}

LLVM IR (-O2):
define double @carmen_knots_to_meters_per_second(double %0) {
%2 = fmul double %0, 5.148000e-01
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
void handle_exception() {
  void *p = malloc(1024);
  free(p);
  free(p);
}


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

x86 assembly (clang, -O2):
<handle_exception>:
push   %rbx
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @handle_exception() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1024)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @free(i8* %3)
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @handle_exception() {
%1 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%2 = tail call i32 @free(i8* %1)
%3 = tail call i32 @free(i8* %1)
ret void
}
void zip_log(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @zip_log(i8* nocapture %0, ...) {
ret void
}
times(b) struct tbuf *b;
{ ; }


x86 assembly (clang, -O0):
<times>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tbuf = type opaque
define i32 @times(%struct.tbuf* %0) {
%2 = alloca i32
%3 = alloca %struct.tbuf*
store %struct.tbuf* %0, %struct.tbuf** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.tbuf = type opaque
define i32 @times(%struct.tbuf* nocapture readnone %0) {
ret i32 undef
}
void bar() { 1; }


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

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

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

LLVM IR (-O2):
define void @bar() {
ret void
}
/* Type definitions */
struct tms {
  scalar_t__ tms_stime;
  scalar_t__ tms_utime;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ __times(struct tms *);
clock_t clock(void) {
  struct tms buf;
  if (__times(&buf) < 0)
    return (clock_t)-1;
  return buf.tms_utime + buf.tms_stime;
}


x86 assembly (clang, -O0):
<clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
call   1030 <__times@plt>
cmp    $0x0,%rax
jge    1138 <clock+0x28>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1144 <clock+0x34>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1030 <__times@plt>
mov    0x8(%rsp),%rcx
add    0x10(%rsp),%rcx
test   %rax,%rax
mov    $0xffffffffffffffff,%rax
cmovns %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tms = type { i64, i64 }
define i64 @clock() {
%1 = alloca i64
%2 = alloca %struct.tms
%3 = call i64 @__times(%struct.tms* %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i64 -1, i64* %1
br label %12
6: ; preds = %0
%7 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 1
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 0
%10 = load i64, i64* %9
%11 = add nsw i64 %8, %10
store i64 %11, i64* %1
br label %12
12: ; preds = %6, %5
%13 = load i64, i64* %1
ret i64 %13
}

LLVM IR (-O2):
%struct.tms = type { i64, i64 }
define i64 @clock() {
%1 = alloca %struct.tms
%2 = bitcast %struct.tms* %1 to i8*
%3 = call i64 @__times(%struct.tms* %1)
%4 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = add nsw i64 %7, %5
%9 = icmp sgt i64 %3, -1
%10 = select i1 %9, i64 %8, i64 -1
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int write(int, unsigned int *, int);
int write_serial_byte(int serial_fd, unsigned int ch) {
  if (write(serial_fd, &ch, 1) != 1) {
    perror("write");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<write_serial_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     1160 <write_serial_byte+0x40>
lea    0xeb1(%rip),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1167 <write_serial_byte+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_serial_byte>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    114a <write_serial_byte+0x2a>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeaf(%rip),%rdi
call   1040 <perror@plt>
xor    %ebx,%ebx
jmp    1142 <write_serial_byte+0x22>

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

LLVM IR (-O2):
@.str = [6 x i8] c"write\00"
define i32 @write_serial_byte(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @write(i32 %0, i32* %3, i32 1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ *mmap_or_null(int /*<<< orphan*/ *, size_t, int,
                                 int /*<<< orphan*/, int, int /*<<< orphan*/);
u_char *memzone_map_cow_file(int fd, size_t len) {
  return (mmap_or_null(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd,
                       (off_t)0));
}


x86 assembly (clang, -O0):
<memzone_map_cow_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edx
mov    0x2ea5(%rip),%rax
or     (%rax),%edx
mov    0x2e94(%rip),%rax
mov    (%rax),%ecx
mov    -0x4(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap_or_null@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memzone_map_cow_file>:
mov    %edi,%r8d
mov    0x2ede(%rip),%rax
mov    0x2eb7(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2ea4(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
xor    %r9d,%r9d
jmp    1030 <mmap_or_null@plt>

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
define i32* @memzone_map_cow_file(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i32, i32* @PROT_READ
%7 = load i32, i32* @PROT_WRITE
%8 = or i32 %6, %7
%9 = load i32, i32* @MAP_PRIVATE
%10 = load i32, i32* %3
%11 = call i32* @mmap_or_null(i32* null, i64 %5, i32 %8, i32 %9, i32 %10, i32 0)
ret i32* %11
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
define i32* @memzone_map_cow_file(i32 %0, i64 %1) {
%3 = load i32, i32* @PROT_READ
%4 = load i32, i32* @PROT_WRITE
%5 = or i32 %4, %3
%6 = load i32, i32* @MAP_PRIVATE
%7 = tail call i32* @mmap_or_null(i32* null, i64 %1, i32 %5, i32 %6, i32 %0, i32 0)
ret i32* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int demoB() {
  int i, *ip;
  i = 9;
  ip = &i;
  *ip = 10;
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<demoB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x9,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<demoB>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @demoB() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ check_expression_add_subtract(char *, char const **, int,
                                                 char *);
void test_expression_add() {
  const char *tokens[] = {"3", "+", "5"};
  check_expression_add_subtract("test_expression_add", tokens, 3, "output_add");
}


x86 assembly (clang, -O0):
<test_expression_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ce1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cde(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cdb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x3,%edx
lea    0xeca(%rip),%rcx
call   1030 <check_expression_add_subtract@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_expression_add>:
sub    $0x18,%rsp
mov    0x2cf5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cd9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed4(%rip),%rdi
lea    0xee1(%rip),%rcx
mov    %rsp,%rsi
mov    $0x3,%edx
call   1030 <check_expression_add_subtract@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"3\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"5\00"
@__const.test_expression_add.tokens = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [20 x i8] c"test_expression_add\00"
@.str.4 = [11 x i8] c"output_add\00"
define void @test_expression_add() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @check_expression_add_subtract(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8** %3, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"3\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"5\00"
@__const.test_expression_add.tokens = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [20 x i8] c"test_expression_add\00"
@.str.4 = [11 x i8] c"output_add\00"
define void @test_expression_add() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @check_expression_add_subtract(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8** %3, i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int sqr_sum_line(int);
int check_case(int count) {
  if (count == 0)
    return 0;
  int i_count;
  scanf("%d", &i_count);
  printf("%d\n", sqr_sum_line(i_count));
  check_case(count - 1);
  return 0;
}


x86 assembly (clang, -O0):
<check_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1161 <check_case+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1199 <check_case+0x59>
lea    0xe98(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <sqr_sum_line@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1040 <check_case@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_case>:
test   %edi,%edi
je     1182 <check_case+0x42>
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1060 <sqr_sum_line@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1040 <check_case@plt>
add    $0x10,%rsp
pop    %rbx
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @check_case(i32 %0) {
%2 = alloca i32
%3 = icmp eq i32 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = bitcast i32* %2 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @sqr_sum_line(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = add nsw i32 %0, -1
%11 = call i32 @check_case(i32 %10)
br label %12
12: ; preds = %1, %4
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ call_lua(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  printf("calling: %s\n", argv[1]);
  call_lua(argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <call_lua@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
call   1040 <call_lua@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"calling: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %3
%7 = tail call i32 @call_lua(i8* %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ func();
int /*<<< orphan*/ func2();
int /*<<< orphan*/ func3(int);
int main(int argc, const char *argv[]) {
  func();
  func2();
  func3(10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <func@plt>
mov    $0x0,%al
call   1040 <func2@plt>
mov    $0xa,%edi
call   1030 <func3@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <func@plt>
xor    %eax,%eax
call   1040 <func2@plt>
mov    $0xa,%edi
call   1030 <func3@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @func()
%6 = call i32 (...) @func2()
%7 = call i32 @func3(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func()
%4 = tail call i32 (...) @func2()
%5 = tail call i32 @func3(i32 10)
ret i32 0
}
int test_imm_42uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x42 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_42uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 66
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ pthread_exit(void *);
void thrd_exit(int res) {
  void *pres = malloc(sizeof(int));
  if (pres != NULL)
    *(int *)pres = res;
  pthread_exit(pres);
}


x86 assembly (clang, -O0):
<thrd_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <thrd_exit+0x2d>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <pthread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thrd_exit>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1134 <thrd_exit+0x14>
mov    %ebx,(%rax)
mov    %rax,%rdi
pop    %rbx
jmp    1030 <pthread_exit@plt>

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

LLVM IR (-O2):
define void @thrd_exit(i32 %0) {
%2 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = bitcast i8* %2 to i32*
store i32 %0, i32* %5
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @pthread_exit(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr,
          "Usage: %s\n"
          "	--file, -f	character device to use\n"
          "	--size, -s	size of internal buffer\n"
          "	--debug, -d	Enables debugging messages\n"
          "	--help, -h	this help\n",
          prog);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [145 x i8] c"Usage: %s\0A\09--file, -f\09character device to use\0A\09--size, -s\09size of internal buffer\0A\09--debug, -d\09Enables debugging messages\0A\09--help, -h\09this help\0A\00"
define void @usage(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 ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [145 x i8] c"Usage: %s\0A\09--file, -f\09character device to use\0A\09--size, -s\09size of internal buffer\0A\09--debug, -d\09Enables debugging messages\0A\09--help, -h\09this help\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
unsigned int cap1166_get_leds();
int /*<<< orphan*/ cap1166_leds(unsigned int);
void led_state(int i, int s) {
  unsigned int l, j;
  l = cap1166_get_leds();
  if (s == 0) {
    l &= ~(1 << (i));
  } else {
    l |= (1 << (i));
  };
  cap1166_leds(l);
}


x86 assembly (clang, -O0):
<led_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <cap1166_get_leds@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115a <led_state+0x3a>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    116a <led_state+0x4a>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <cap1166_leds@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_state>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <cap1166_get_leds@plt>
mov    %eax,%edi
btr    %ebp,%edi
bts    %ebp,%eax
test   %ebx,%ebx
cmovne %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <cap1166_leds@plt>

LLVM IR (-O0):
define void @led_state(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 (...) @cap1166_get_leds()
store i32 %7, i32* %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* %3
%12 = shl i32 1, %11
%13 = xor i32 %12, -1
%14 = load i32, i32* %5
%15 = and i32 %14, %13
store i32 %15, i32* %5
br label %21
16: ; preds = %2
%17 = load i32, i32* %3
%18 = shl i32 1, %17
%19 = load i32, i32* %5
%20 = or i32 %19, %18
store i32 %20, i32* %5
br label %21
21: ; preds = %16, %10
%22 = load i32, i32* %5
%23 = call i32 @cap1166_leds(i32 %22)
ret void
}

LLVM IR (-O2):
define void @led_state(i32 %0, i32 %1) {
%3 = tail call i32 (...) @cap1166_get_leds()
%4 = icmp eq i32 %1, 0
%5 = shl nuw i32 1, %0
%6 = xor i32 %5, -1
%7 = and i32 %3, %6
%8 = or i32 %3, %5
%9 = select i1 %4, i32 %7, i32 %8
%10 = tail call i32 @cap1166_leds(i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pcs();
int main() {
  pcs();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @pcs()
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, const char *argv[]) {
  printf("10:%d abc:%d\n", atoi("10"), atoi("abc"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed1(%rip),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <atoi@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"10:%d abc:%d\0A\00"
@.str.2 = [4 x i8] c"abc\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @atoi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 %3)
ret i32 0
}
void foo420(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo420(i32 %0) {
ret void
}
/* Variables and functions */
long core___core__Bool___to_i(short);
long core___core__Bool___Object__hash(short int self) {
  long var;
  long var1;
  { var1 = core___core__Bool___to_i(self); }
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<core___core__Bool___Object__hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <core___core__Bool___to_i@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<core___core__Bool___Object__hash>:
jmp    1030 <core___core__Bool___to_i@plt>

LLVM IR (-O0):
define i64 @core___core__Bool___Object__hash(i16 signext %0) {
%2 = alloca i16
%3 = alloca i64
%4 = alloca i64
store i16 %0, i16* %2
%5 = load i16, i16* %2
%6 = call i64 @core___core__Bool___to_i(i16 signext %5)
store i64 %6, i64* %4
%7 = load i64, i64* %4
store i64 %7, i64* %3
br label %8
8: ; preds = %1
%9 = load i64, i64* %3
ret i64 %9
}

LLVM IR (-O2):
define i64 @core___core__Bool___Object__hash(i16 signext %0) {
%2 = tail call i64 @core___core__Bool___to_i(i16 signext %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void read_into_array(int arr[], int size) {
  int i;
  for (i = 0; i < size; i++) {
    scanf("%d ", &arr[i]);
  }
}


x86 assembly (clang, -O0):
<read_into_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <read_into_array+0x4b>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <read_into_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_into_array>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1145 <read_into_array+0x35>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0xeda(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <read_into_array+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @read_into_array(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
int n_leapdays(int y1, int y2) {
  --y1;
  --y2;
  return (y2 / 4 - y1 / 4) - (y2 / 100 - y1 / 100) + (y2 / 400 - y1 / 400);
}


x86 assembly (clang, -O0):
<n_leapdays>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
mov    $0x64,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x10(%rbp),%eax
sub    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
mov    $0x190,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0xc(%rbp),%eax
sub    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_leapdays>:
lea    -0x1(%rdi),%eax
lea    -0x1(%rsi),%edx
lea    0x2(%rsi),%r10d
test   %edx,%edx
cmovns %edx,%r10d
sar    $0x2,%r10d
add    $0x2,%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x2,%edi
movslq %edx,%r8
imul   $0xffffffffae147ae1,%r8,%r11
mov    %r11,%rdx
shr    $0x3f,%rdx
sar    $0x25,%r11
add    %edx,%r11d
movslq %eax,%r9
imul   $0x51eb851f,%r9,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x25,%rdx
add    %eax,%edx
imul   $0x51eb851f,%r8,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x27,%rcx
add    %eax,%ecx
imul   $0xffffffffae147ae1,%r9,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x27,%rax
add    %esi,%eax
add    %edx,%eax
sub    %edi,%eax
add    %ecx,%eax
add    %r11d,%eax
add    %r10d,%eax
ret

LLVM IR (-O0):
define i32 @n_leapdays(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 = add nsw i32 %5, -1
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 4
%11 = load i32, i32* %3
%12 = sdiv i32 %11, 4
%13 = sub nsw i32 %10, %12
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 100
%16 = load i32, i32* %3
%17 = sdiv i32 %16, 100
%18 = sub nsw i32 %15, %17
%19 = sub nsw i32 %13, %18
%20 = load i32, i32* %4
%21 = sdiv i32 %20, 400
%22 = load i32, i32* %3
%23 = sdiv i32 %22, 400
%24 = sub nsw i32 %21, %23
%25 = add nsw i32 %19, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @n_leapdays(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -1
%4 = add nsw i32 %1, -1
%5 = sdiv i32 %4, 4
%6 = sdiv i32 %3, -4
%7 = sdiv i32 %4, -100
%8 = sdiv i32 %3, 100
%9 = sdiv i32 %4, 400
%10 = sdiv i32 %3, -400
%11 = add nsw i32 %8, %10
%12 = add nsw i32 %11, %6
%13 = add nsw i32 %12, %9
%14 = add nsw i32 %13, %7
%15 = add nsw i32 %14, %5
ret i32 %15
}
void gtk_menu_get_title() {}


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

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

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

LLVM IR (-O2):
define void @gtk_menu_get_title() {
ret void
}