xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double _rnd() { return (double)rand() / (double)RAND_MAX; }


x86 assembly (clang, -O0):
<_rnd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rnd>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @_rnd() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @_rnd() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
unsigned short sis16toh(unsigned short val) { return val; }


x86 assembly (clang, -O0):
<sis16toh>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sis16toh>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @sis16toh(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define zeroext i16 @sis16toh(i16 returned zeroext %0) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_STORE_CTX;

/* Variables and functions */
int /*<<< orphan*/ X509_STORE_CTX_set_error(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/);
int /*<<< orphan*/ X509_V_ERR_APPLICATION_VERIFICATION;
int verify_reject_cb(X509_STORE_CTX *ctx, void *arg) {
  X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION);
  return 0;
}


x86 assembly (clang, -O0):
<verify_reject_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
call   1030 <X509_STORE_CTX_set_error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_reject_cb>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
call   1030 <X509_STORE_CTX_set_error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@X509_V_ERR_APPLICATION_VERIFICATION = global i32 0
define i32 @verify_reject_cb(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 i32, i32* @X509_V_ERR_APPLICATION_VERIFICATION
%7 = call i32 @X509_STORE_CTX_set_error(i32* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@X509_V_ERR_APPLICATION_VERIFICATION = global i32 0
define i32 @verify_reject_cb(i32* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @X509_V_ERR_APPLICATION_VERIFICATION
%4 = tail call i32 @X509_STORE_CTX_set_error(i32* %0, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void display(char *msg) { printf("Display:%s\n", msg); }


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

x86 assembly (clang, -O2):
<display>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Display:%s\0A\00"
define void @display(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Display:%s\0A\00"
define void @display(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int FD_CLOEXEC;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFD;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
void prepare_fd(int fd) {
  fcntl(fd, F_SETFD, FD_CLOEXEC);
  fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<prepare_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
mov    0x2e7d(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepare_fd>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%ebp
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2e98(%rip),%rcx
or     (%rcx),%eax
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @prepare_fd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFD
%5 = load i32, i32* @FD_CLOEXEC
%6 = call i32 (i32, i32, ...) @fcntl(i32 %3, i32 %4, i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* @F_SETFL
%9 = load i32, i32* %2
%10 = load i32, i32* @F_GETFL
%11 = call i32 (i32, i32, ...) @fcntl(i32 %9, i32 %10)
%12 = load i32, i32* @O_NONBLOCK
%13 = or i32 %11, %12
%14 = call i32 (i32, i32, ...) @fcntl(i32 %7, i32 %8, i32 %13)
ret void
}

LLVM IR (-O2):
@F_SETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @prepare_fd(i32 %0) {
%2 = load i32, i32* @F_SETFD
%3 = load i32, i32* @FD_CLOEXEC
%4 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2, i32 %3)
%5 = load i32, i32* @F_SETFL
%6 = load i32, i32* @F_GETFL
%7 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %6)
%8 = load i32, i32* @O_NONBLOCK
%9 = or i32 %8, %7
%10 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %5, i32 %9)
ret void
}
int pat_bits(char *string, int cbit, int len) {
  int moji_idx = cbit / 8;
  char moji = *(string + moji_idx);
  int idx_in_moji = cbit % 8;
  if (cbit == -1)
    return 1;
  if (len - 1 < moji_idx)
    return 0;
  return (((moji << idx_in_moji) & 0x80) >> 7);
}


x86 assembly (clang, -O0):
<pat_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1d(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    114e <pat_bits+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    117d <pat_bits+0x7d>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    1169 <pat_bits+0x69>
movl   $0x0,-0x4(%rbp)
jmp    117d <pat_bits+0x7d>
movsbl -0x1d(%rbp),%eax
mov    -0x24(%rbp),%ecx
shl    %cl,%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pat_bits>:
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
cmp    $0xffffffff,%esi
je     112c <pat_bits+0x2c>
sar    $0x3,%ecx
xor    %eax,%eax
cmp    %edx,%ecx
jge    112b <pat_bits+0x2b>
movslq %ecx,%rax
movzbl (%rdi,%rax,1),%eax
and    $0x7,%sil
mov    %esi,%ecx
shl    %cl,%eax
shr    $0x7,%eax
and    $0x1,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @pat_bits(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load i32, i32* %6
%12 = sdiv i32 %11, 8
store i32 %12, i32* %8
%13 = load i8*, i8** %5
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %9
%18 = load i32, i32* %6
%19 = srem i32 %18, 8
store i32 %19, i32* %10
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %23
22: ; preds = %3
store i32 1, i32* %4
br label %36
23: ; preds = %3
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %8
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 0, i32* %4
br label %36
29: ; preds = %23
%30 = load i8, i8* %9
%31 = sext i8 %30 to i32
%32 = load i32, i32* %10
%33 = shl i32 %31, %32
%34 = and i32 %33, 128
%35 = ashr i32 %34, 7
store i32 %35, i32* %4
br label %36
36: ; preds = %29, %28, %22
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
define i32 @pat_bits(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sdiv i32 %1, 8
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i32 %1, -1
br i1 %8, label %17, label %9
9: ; preds = %3
%10 = icmp slt i32 %4, %2
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = zext i8 %7 to i32
%13 = and i32 %1, 7
%14 = shl nuw nsw i32 %12, %13
%15 = lshr i32 %14, 7
%16 = and i32 %15, 1
br label %17
17: ; preds = %9, %3, %11
%18 = phi i32 [ %16, %11 ], [ 1, %3 ], [ 0, %9 ]
ret i32 %18
}
double mat_Dmod1(const double a) {
  if (a < 0.0)
    return a + 1.0 - (int)a;
  else
    return a - (int)a;
}


x86 assembly (clang, -O0):
<mat_Dmod1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113b <mat_Dmod1+0x3b>
movsd  0xee1(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1152 <mat_Dmod1+0x52>
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_Dmod1>:
movsd  0xef8(%rip),%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
cvttpd2dq %xmm0,%xmm0
orpd   %xmm2,%xmm1
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mat_Dmod1(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 1.000000e+00
%9 = load double, double* %3
%10 = fptosi double %9 to i32
%11 = sitofp i32 %10 to double
%12 = fsub double %8, %11
store double %12, double* %2
br label %19
13: ; preds = %1
%14 = load double, double* %3
%15 = load double, double* %3
%16 = fptosi double %15 to i32
%17 = sitofp i32 %16 to double
%18 = fsub double %14, %17
store double %18, double* %2
br label %19
19: ; preds = %13, %6
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
define double @mat_Dmod1(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fadd double %0, 1.000000e+00
%4 = select i1 %2, double %3, double %0
%5 = fptosi double %0 to i32
%6 = sitofp i32 %5 to double
%7 = fsub double %4, %6
ret double %7
}
/* Type definitions */
typedef double int64_t;
typedef double int32_t;

/* Variables and functions */
double wl_double_fixed_to_double(int32_t i, int32_t f) {
  union {
    double d;
    int64_t i;
  } u;
  u.i = ((1023LL + (52LL - 31LL)) << 52) + (1LL << 51) + f;
  return i + (u.d - (3LL << (52 - 32)));
}


x86 assembly (clang, -O0):
<wl_double_fixed_to_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xef2(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xece(%rip),%xmm2
subsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_double_fixed_to_double>:
addsd  0xef8(%rip),%xmm1
addsd  0xef8(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { double }
define double @wl_double_fixed_to_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca %union.anon
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = fadd double 0x43D0520000000000, %6
%8 = bitcast %union.anon* %5 to double*
store double %7, double* %8
%9 = load double, double* %3
%10 = bitcast %union.anon* %5 to double*
%11 = load double, double* %10
%12 = fsub double %11, 0x4148000000000000
%13 = fadd double %9, %12
ret double %13
}

LLVM IR (-O2):
define double @wl_double_fixed_to_double(double %0, double %1) {
%3 = fadd double %1, 0x43D0520000000000
%4 = fadd double %3, 0xC148000000000000
%5 = fadd double %4, %0
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printBar(int n) {
  int k;
  for (k = 1; k <= n; k++) {
    printf("*");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printBar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1148 <printBar+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <printBar+0x12>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBar>:
push   %rbx
test   %edi,%edi
jle    112f <printBar+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <printBar+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printBar(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = tail call i32 @putchar(i32 42)
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %4, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
%9 = tail call i32 @putchar(i32 10)
ret void
}
int do_028() { return 28; }


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

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

LLVM IR (-O0):
define i32 @do_028() {
ret i32 28
}

LLVM IR (-O2):
define i32 @do_028() {
ret i32 28
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_usage(char *command) {
  printf("Usage: %s [-l | -h | -s id | -o file] <SYSDUMP>\n\n"
         "\t-l      - List all the sections\n"
         "\t-s id   - Capture log with specified section id\n"
         "\t-o file - Output file to capture the log with specified"
         " section id\n"
         "\t-h      - Print this message and exit\n",
         command);
}


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
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [239 x i8] c"Usage: %s [-l | -h | -s id | -o file] <SYSDUMP>\0A\0A\09-l - List all the sections\0A\09-s id - Capture log with specified section id\0A\09-o file - Output file to capture the log with specified section id\0A\09-h - Print this message and exit\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [239 x i8] c"Usage: %s [-l | -h | -s id | -o file] <SYSDUMP>\0A\0A\09-l - List all the sections\0A\09-s id - Capture log with specified section id\0A\09-o file - Output file to capture the log with specified section id\0A\09-h - Print this message and exit\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int foo();
int main() {
  assert(foo() == 253);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
cmp    $0xfd,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <foo@plt>
xor    %edi,%edi
cmp    $0xfd,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = icmp eq i32 %2, 253
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = icmp eq i32 %1, 253
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
/* Variables and functions */
int putenv(char const *);
int unsetenv(const char *name) { return putenv(name); }


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

x86 assembly (clang, -O2):
<unsetenv>:
jmp    1030 <putenv@plt>

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

LLVM IR (-O2):
define i32 @unsetenv(i8* %0) {
%2 = tail call i32 @putenv(i8* %0)
ret i32 %2
}
int fun(int n) {
  if (n == 1)
    return 1;
  return fun(n - 1) + n;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1131 <fun+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1142 <fun+0x32>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fun@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     1124 <fun+0x24>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %ecx,%eax
lea    -0x3(%rdi),%edx
imul   %rcx,%rdx
shr    %rdx
add    %edi,%eax
sub    %edx,%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @fun(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = add i32 %0, -2
%6 = mul i32 %4, %5
%7 = zext i32 %5 to i33
%8 = add i32 %0, -3
%9 = zext i32 %8 to i33
%10 = mul i33 %7, %9
%11 = lshr i33 %10, 1
%12 = trunc i33 %11 to i32
%13 = add i32 %6, %0
%14 = sub i32 %13, %12
%15 = add i32 %14, 1
br label %16
16: ; preds = %3, %1
%17 = phi i32 [ 1, %1 ], [ %15, %3 ]
ret i32 %17
}
void output(x) int *x;
{ *x += 10; }


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0xa,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
addl   $0xa,(%rdi)
ret

LLVM IR (-O0):
define void @output(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 10
store i32 %5, i32* %3
ret void
}

LLVM IR (-O2):
define void @output(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 10
store i32 %3, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int fu_Close(FILE *stream) { return fclose(stream); }


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

x86 assembly (clang, -O2):
<fu_Close>:
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define i32 @fu_Close(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *, int);
int main() {
  const char *msg = "\n";
  for (;;)
    write(1, msg, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    112a <main+0x1a>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %3
3: ; preds = %3, %0
%4 = load i8*, i8** %2
%5 = call i32 @write(i32 1, i8* %4, i32 1)
br label %3
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x9f() {
  Assert_real((isdigit(159) == 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",
              800, ("isdigit should be 0 for 0x9f"));
}


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

x86 assembly (clang, -O2):
<t_isdigit_0x9f>:
push   %rax
mov    $0x9f,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x320,%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 0x9f\00"
define void @t_isdigit_0x9f() {
%1 = call i64 @isdigit(i32 159)
%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 800, 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 0x9f\00"
define void @t_isdigit_0x9f() {
%1 = tail call i64 @isdigit(i32 159)
%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 800, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
int random_num() {
  int a = 1;
  int b = 100;
  return rand() % (b - a) + a;
}


x86 assembly (clang, -O0):
<random_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_num>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffffa57eb503,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x63,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_num() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
store i32 100, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = load i32, i32* %1
%6 = sub nsw i32 %4, %5
%7 = srem i32 %3, %6
%8 = load i32, i32* %1
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @random_num() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 99
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Type definitions */
struct rtattr {
  int dummy;
};
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void *, int);
__u64 rta_getattr_u64(const struct rtattr *rta) {
  __u64 tmp;
  memcpy(&tmp,
         ((void *)(((char *)(rta)) +
                   ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
         sizeof(__u64));
  return tmp;
}


x86 assembly (clang, -O0):
<rta_getattr_u64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rta_getattr_u64>:
push   %rax
lea    0x4(%rdi),%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define i32 @rta_getattr_u64(%struct.rtattr* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %0, i64 1
%5 = bitcast %struct.rtattr* %4 to i8*
%6 = call i32 @memcpy(i32* %2, i8* %5, i32 4)
%7 = load i32, i32* %2
ret i32 %7
}
void __hv_zero_f(float *bOut) { *bOut = 0.0f; }


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

x86 assembly (clang, -O2):
<__hv_zero_f>:
movl   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @__hv_zero_f(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
store float 0.000000e+00, float* %3
ret void
}

LLVM IR (-O2):
define void @__hv_zero_f(float* nocapture writeonly %0) {
store float 0.000000e+00, float* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_clear_empty_list();
int /*<<< orphan*/ test_clear_null_list();
int /*<<< orphan*/ test_clear_one_item_list();
int /*<<< orphan*/ test_clear_two_item_list();
void test_clear_list() {
  test_clear_empty_list();
  test_clear_null_list();
  test_clear_one_item_list();
  test_clear_two_item_list();
}


x86 assembly (clang, -O0):
<test_clear_list>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <test_clear_empty_list@plt>
mov    $0x0,%al
call   1030 <test_clear_null_list@plt>
mov    $0x0,%al
call   1060 <test_clear_one_item_list@plt>
mov    $0x0,%al
call   1050 <test_clear_two_item_list@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_clear_list>:
push   %rax
xor    %eax,%eax
call   1040 <test_clear_empty_list@plt>
xor    %eax,%eax
call   1030 <test_clear_null_list@plt>
xor    %eax,%eax
call   1060 <test_clear_one_item_list@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <test_clear_two_item_list@plt>

LLVM IR (-O0):
define void @test_clear_list() {
%1 = call i32 (...) @test_clear_empty_list()
%2 = call i32 (...) @test_clear_null_list()
%3 = call i32 (...) @test_clear_one_item_list()
%4 = call i32 (...) @test_clear_two_item_list()
ret void
}

LLVM IR (-O2):
define void @test_clear_list() {
%1 = tail call i32 (...) @test_clear_empty_list()
%2 = tail call i32 (...) @test_clear_null_list()
%3 = tail call i32 (...) @test_clear_one_item_list()
%4 = tail call i32 (...) @test_clear_two_item_list()
ret void
}
int test_imm_07int8_reg(signed char val) {
  return ((val) & (0x07 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_07int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 7
%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_07int8_reg(i8 signext %0) {
%2 = and i8 %0, 7
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int main(void) {
  printf("1 2 3 4\n");
  printf("%d %d %d %d\n", 1, 2, 3, 4);
  printf("1"), printf(" 2"), printf(" 3 "), printf("4 ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%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    0xedf(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [13 x i8] c"%d %d %d %d\0A\00"
@.str.3 = [3 x i8] c" 2\00"
@.str.4 = [4 x i8] c" 3 \00"
@.str.5 = [3 x i8] c"4 \00"
@str = [8 x i8] c"1 2 3 4\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 2, i32 3, i32 4)
%3 = tail call i32 @putchar(i32 49)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int sortByWeight(void const *, void const *, int /*<<< orphan*/);
int _sortByWeight0(const void *a, const void *b) {
  return sortByWeight(a, b, 0);
}


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

x86 assembly (clang, -O2):
<_sortByWeight0>:
xor    %edx,%edx
jmp    1030 <sortByWeight@plt>

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

LLVM IR (-O2):
define i32 @_sortByWeight0(i8* %0, i8* %1) {
%3 = tail call i32 @sortByWeight(i8* %0, i8* %1, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int kth_largest_aux(int *, size_t, int /*<<< orphan*/, size_t, size_t);
ssize_t kth_largest(int arr[], size_t arr_sz, size_t k) {
  if (k > arr_sz) {
    return -1;
  } else {
    return kth_largest_aux(arr, arr_sz, 0, arr_sz, k);
  }
}


x86 assembly (clang, -O0):
<kth_largest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    113e <kth_largest+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <kth_largest+0x48>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
xor    %edx,%edx
call   1030 <kth_largest_aux@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kth_largest>:
cmp    %rsi,%rdx
jbe    111b <kth_largest+0xb>
mov    $0xffffffff,%eax
ret
mov    %rdx,%r8
xor    %edx,%edx
mov    %rsi,%rcx
jmp    1030 <kth_largest_aux@plt>

LLVM IR (-O0):
define i32 @kth_largest(i32* %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i64, i64* %7
%9 = load i64, i64* %6
%10 = icmp ugt i64 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 -1, i32* %4
br label %18
12: ; preds = %3
%13 = load i32*, i32** %5
%14 = load i64, i64* %6
%15 = load i64, i64* %6
%16 = load i64, i64* %7
%17 = call i32 @kth_largest_aux(i32* %13, i64 %14, i32 0, i64 %15, i64 %16)
store i32 %17, i32* %4
br label %18
18: ; preds = %12, %11
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @kth_largest(i32* %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %2, %1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @kth_largest_aux(i32* %0, i64 %1, i32 0, i64 %1, i64 %2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ -1, %3 ]
ret i32 %8
}
/* Variables and functions */
char *strstr(char *, char *);
char *ph_parseCallProgressUri(char *data) {
  char *tag = strstr(data, "URI=");
  if (!tag)
    return 0;
  return tag + 4;
}


x86 assembly (clang, -O0):
<ph_parseCallProgressUri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <ph_parseCallProgressUri+0x38>
movq   $0x0,-0x8(%rbp)
jmp    1154 <ph_parseCallProgressUri+0x44>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ph_parseCallProgressUri>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
lea    0x4(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"URI=\00"
define i8* @ph_parseCallProgressUri(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 4
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
void hardfault_handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<hardfault_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <hardfault_handler+0x9>
jmp    1109 <hardfault_handler+0x9>

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

LLVM IR (-O0):
define void @hardfault_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @hardfault_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
int strlen_rec(const char *p) {
  if (*p == '\0')
    return 0;
  else
    return 1 + strlen_rec(p + 1);
}


x86 assembly (clang, -O0):
<strlen_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1138 <strlen_rec+0x28>
movl   $0x0,-0x4(%rbp)
jmp    114b <strlen_rec+0x3b>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <strlen_rec@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_rec>:
cmpb   $0x0,(%rdi)
je     111c <strlen_rec+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen_rec+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen_rec(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 i8* [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = add nuw nsw i32 %6, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x82() {
  Assert_real((isxdigit(130) == 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_isxdigit.c",
              655, ("isxdigit should be 0 for 0x82"));
}


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

x86 assembly (clang, -O2):
<t_isxdigit_0x82>:
push   %rax
mov    $0x82,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x28f,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x82\00"
define void @t_isxdigit_0x82() {
%1 = call i64 @isxdigit(i32 130)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 655, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x82\00"
define void @t_isxdigit_0x82() {
%1 = tail call i64 @isxdigit(i32 130)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 655, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct target {
  int dummy;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *);
char *dump_sys_getuid16(int depth, struct target *target) {
  char *param_str = malloc(5);
  snprintf(param_str, 5, "void");
  return param_str;
}


x86 assembly (clang, -O0):
<dump_sys_getuid16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x5,%esi
lea    0xeb3(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_sys_getuid16>:
push   %rbx
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdx
mov    %rax,%rdi
mov    $0x5,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_getuid16(i32 %0, %struct.target* %1) {
%3 = alloca i32
%4 = alloca %struct.target*
%5 = alloca i8*
store i32 %0, i32* %3
store %struct.target* %1, %struct.target** %4
%6 = call i8* @malloc(i32 5)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @snprintf(i8* %7, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_getuid16(i32 %0, %struct.target* nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%4 = tail call i32 @snprintf(i8* %3, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ test_hide_progress();
int /*<<< orphan*/ test_notext();
int /*<<< orphan*/ test_progress();
int /*<<< orphan*/ test_progress_text();
int /*<<< orphan*/ test_time_est();
int main() {
  test_progress();
  test_notext();
  test_hide_progress();
  test_time_est();
  test_progress_text();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test_progress@plt>
mov    $0x0,%al
call   1050 <test_notext@plt>
mov    $0x0,%al
call   1070 <test_hide_progress@plt>
mov    $0x0,%al
call   1060 <test_time_est@plt>
mov    $0x0,%al
call   1030 <test_progress_text@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_progress@plt>
xor    %eax,%eax
call   1050 <test_notext@plt>
xor    %eax,%eax
call   1070 <test_hide_progress@plt>
xor    %eax,%eax
call   1060 <test_time_est@plt>
xor    %eax,%eax
call   1030 <test_progress_text@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_progress()
%3 = call i32 (...) @test_notext()
%4 = call i32 (...) @test_hide_progress()
%5 = call i32 (...) @test_time_est()
%6 = call i32 (...) @test_progress_text()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_progress()
%2 = tail call i32 (...) @test_notext()
%3 = tail call i32 (...) @test_hide_progress()
%4 = tail call i32 (...) @test_time_est()
%5 = tail call i32 (...) @test_progress_text()
ret i32 0
}
int test_imm_0Euint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x0E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Euint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 14
%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_0Euint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 14
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_3Bint64_lowword_mem(long long *val) {
  return ((*val) & (0x3B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_3Bint64_lowword_mem>:
testb  $0x3b,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Bint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 59
%6 = icmp ne i64 %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_3Bint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 59
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int *foo(int *param) {
  int *local = param;
  return local;
}


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

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @foo(i32* readnone returned %0) {
ret i32* %0
}