xunge/DecIR huggingface dataset:
double transreson(width, nchannel, stack)
double width;
int nchannel;
int stack;
{
  double restrans;
  restrans = (nchannel) ? 9723 : 22400;
  return (stack * restrans / width);
}


x86 assembly (clang, -O0):
<transreson>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x5780,%eax
mov    $0x25fb,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<transreson>:
test   %edi,%edi
mov    $0x5780,%eax
mov    $0x25fb,%ecx
cmove  %eax,%ecx
cvtsi2sd %ecx,%xmm2
cvtsi2sd %esi,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @transreson(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 9723, i32 22400
%12 = sitofp i32 %11 to double
store double %12, double* %7
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to double
%15 = load double, double* %7
%16 = fmul double %14, %15
%17 = load double, double* %4
%18 = fdiv double %16, %17
ret double %18
}

LLVM IR (-O2):
define double @transreson(double %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 22400, i32 9723
%6 = sitofp i32 %5 to double
%7 = sitofp i32 %2 to double
%8 = fmul double %7, %6
%9 = fdiv double %8, %0
ret double %9
}
void tftpsetbinary(argc, argv) char *argv[];
{ tftpsetmode("octet"); }


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

x86 assembly (clang, -O2):
<tftpsetbinary>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <tftpsetmode@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"octet\00"
define void @tftpsetbinary(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @tftpsetmode to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"octet\00"
define void @tftpsetbinary(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @tftpsetmode to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ wprintw(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void wwrite(WINDOW *win, char *str) {
  wprintw(win, "%s", str);
  wprintw(win, "\n ");
  box(win, 0, 0);
  wrefresh(win);
}


x86 assembly (clang, -O0):
<wwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1050 <wprintw@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1050 <wprintw@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <box@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wwrite>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xec2(%rip),%rsi
xor    %eax,%eax
call   1050 <wprintw@plt>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <wprintw@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <box@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <wrefresh@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"\0A \00"
define void @wwrite(i32* %0, i8* %1) {
%3 = tail call i32 (i32*, i8*, ...) @wprintw(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 (i32*, i8*, ...) @wprintw(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @box(i32* %0, i32 0, i32 0)
%6 = tail call i32 @wrefresh(i32* %0)
ret void
}
/* Variables and functions */
scalar_t__ getpid();
int cmx_common_current_pid(void) { return (int)getpid(); }


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

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

LLVM IR (-O0):
define i32 @cmx_common_current_pid() {
%1 = call i64 (...) @getpid()
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @cmx_common_current_pid() {
%1 = tail call i64 (...) @getpid()
%2 = trunc i64 %1 to i32
ret i32 %2
}
const char *SkipWhiteSpaceReverse(const char *pSrc, const char *pStart) {
  while (pSrc && ((*pSrc == ' ') || (*pSrc == '\t')) && (pSrc > pStart)) {
    pSrc--;
  }
  return pSrc;
}


x86 assembly (clang, -O0):
<SkipWhiteSpaceReverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114f <SkipWhiteSpaceReverse+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1141 <SkipWhiteSpaceReverse+0x41>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x11(%rbp)
jne    114f <SkipWhiteSpaceReverse+0x4f>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115f <SkipWhiteSpaceReverse+0x5f>
jmp    1170 <SkipWhiteSpaceReverse+0x70>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <SkipWhiteSpaceReverse+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SkipWhiteSpaceReverse>:
test   %rdi,%rdi
je     1128 <SkipWhiteSpaceReverse+0x28>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     111d <SkipWhiteSpaceReverse+0x1d>
cmp    $0x9,%cl
jne    112a <SkipWhiteSpaceReverse+0x2a>
cmp    %rsi,%rax
jbe    112a <SkipWhiteSpaceReverse+0x2a>
add    $0xffffffffffffffff,%rax
jmp    1110 <SkipWhiteSpaceReverse+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @SkipWhiteSpaceReverse(i8* %0, i8* readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2, %9
%5 = phi i8* [ %10, %9 ], [ %0, %2 ]
%6 = load i8, i8* %5
switch i8 %6, label %11 [
i8 32, label %7
i8 9, label %7
]
7: ; preds = %4, %4
%8 = icmp ugt i8* %5, %1
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = getelementptr inbounds i8, i8* %5, i64 -1
br label %4
11: ; preds = %7, %4, %2
%12 = phi i8* [ null, %2 ], [ %5, %4 ], [ %5, %7 ]
ret i8* %12
}
int is_upcase(char c) {
  if (c >= 'A' && c <= 'Z')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<is_upcase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1130 <is_upcase+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1130 <is_upcase+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <is_upcase+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_upcase>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_upcase(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_upcase(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_ACuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xAC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ACuint64_highword_reg>:
movabs $0xac00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_ACuint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 172
%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_ACuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 738734374912
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
void isr(int n) { kill(getpid(), 9); }


x86 assembly (clang, -O0):
<isr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    $0x9,%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isr>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    $0x9,%esi
pop    %rax
jmp    1040 <kill@plt>

LLVM IR (-O0):
define void @isr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = call i32 @kill(i32 %3, i32 9)
ret void
}

LLVM IR (-O2):
define void @isr(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 9)
ret void
}
/* Variables and functions */
int GLUT_UP;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stderr;
void buttons(int button, int state) {
  fprintf(stderr, "Button %d is %s\n", button,
          state == GLUT_UP ? "up" : "down");
}


x86 assembly (clang, -O0):
<buttons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    0x2ea4(%rip),%rax
mov    (%rax),%r8d
lea    0xed6(%rip),%rcx
lea    0xecc(%rip),%rax
cmp    %r8d,%esi
cmove  %rax,%rcx
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buttons>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
mov    0x2eb6(%rip),%rax
cmp    %esi,(%rax)
lea    0xee6(%rip),%rax
lea    0xee2(%rip),%rcx
cmove  %rax,%rcx
lea    0xec3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Button %d is %s\0A\00"
@GLUT_UP = global i32 0
@.str.1 = [3 x i8] c"up\00"
@.str.2 = [5 x i8] c"down\00"
define void @buttons(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = load i32, i32* @GLUT_UP
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%12 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %11)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Button %d is %s\0A\00"
@GLUT_UP = global i32 0
@.str.1 = [3 x i8] c"up\00"
@.str.2 = [5 x i8] c"down\00"
define void @buttons(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = load i32, i32* @GLUT_UP
%5 = icmp eq i32 %4, %1
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %6)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  long quot;
  long rem;
};
typedef TYPE_1__ ldiv_t;

/* Variables and functions */
ldiv_t ldiv(long int numer, long int denom) {
  ldiv_t rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}


x86 assembly (clang, -O0):
<ldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldiv>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1115 <ldiv+0x15>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64 }
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = sdiv i64 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = srem i64 %10, %11
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 %12, i64* %13
%14 = bitcast %struct.TYPE_3__* %3 to { i64, i64 }*
%15 = load { i64, i64 }, { i64, i64 }* %14
ret { i64, i64 } %15
}

LLVM IR (-O2):
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = srem i64 %0, %1
%5 = insertvalue { i64, i64 } poison, i64 %3, 0
%6 = insertvalue { i64, i64 } %5, i64 %4, 1
ret { i64, i64 } %6
}
void html_change_color(double perct) {}


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

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

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

LLVM IR (-O2):
define void @html_change_color(double %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void fclose_cond(FILE *fptr) {
  if (fptr) {
    fclose(fptr);
  }
}


x86 assembly (clang, -O0):
<fclose_cond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <fclose_cond+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclose_cond>:
test   %rdi,%rdi
je     111a <fclose_cond+0xa>
jmp    1030 <fclose@plt>
ret

LLVM IR (-O0):
define void @fclose_cond(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = call i32 @fclose(i32* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @fclose_cond(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xb2() {
  Assert_real((isdigit(178) == 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",
              895, ("isdigit should be 0 for 0xb2"));
}


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

x86 assembly (clang, -O2):
<t_isdigit_0xb2>:
push   %rax
mov    $0xb2,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x37f,%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 0xb2\00"
define void @t_isdigit_0xb2() {
%1 = call i64 @isdigit(i32 178)
%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 895, 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 0xb2\00"
define void @t_isdigit_0xb2() {
%1 = tail call i64 @isdigit(i32 178)
%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 895, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned char fromhex(char c) {
  if (c >= '0' && c <= '9')
    return c - '0';
  if (c >= 'A' && c <= 'Z')
    return (c - 'A' + 10) & 0xf;
  return c - 'a' + 10;
}


x86 assembly (clang, -O0):
<fromhex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <fromhex+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <fromhex+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    116f <fromhex+0x6f>
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1162 <fromhex+0x62>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1162 <fromhex+0x62>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
and    $0xf,%eax
mov    %al,-0x1(%rbp)
jmp    116f <fromhex+0x6f>
movsbl -0x2(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fromhex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
jb     111e <fromhex+0x1e>
lea    -0x41(%rdi),%eax
cmp    $0x19,%al
ja     1118 <fromhex+0x18>
add    $0x9,%dil
and    $0xf,%dil
jmp    111c <fromhex+0x1c>
add    $0xa9,%dil
mov    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @fromhex(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %37
16: ; preds = %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 90
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 65
%28 = add nsw i32 %27, 10
%29 = and i32 %28, 15
%30 = trunc i32 %29 to i8
store i8 %30, i8* %2
br label %37
31: ; preds = %20, %16
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 97
%35 = add nsw i32 %34, 10
%36 = trunc i32 %35 to i8
store i8 %36, i8* %2
br label %37
37: ; preds = %31, %24, %11
%38 = load i8, i8* %2
ret i8 %38
}

LLVM IR (-O2):
define zeroext i8 @fromhex(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = add i8 %0, -65
%6 = icmp ult i8 %5, 26
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = add nuw nsw i8 %0, 9
%9 = and i8 %8, 15
br label %12
10: ; preds = %4
%11 = add i8 %0, -87
br label %12
12: ; preds = %1, %10, %7
%13 = phi i8 [ %9, %7 ], [ %11, %10 ], [ %2, %1 ]
ret i8 %13
}
/* Variables and functions */
scalar_t__ getpid();
scalar_t__ getppid();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("The process ID is: %d\n", (int)getpid());
  printf("The parent process ID is %d\n", (int)getppid());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getppid@plt>
lea    0xec3(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"The process ID is: %d\0A\00"
@.str.1 = [29 x i8] c"The parent process ID is %d\0A\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 i64 (...) @getpid()
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i64 (...) @getppid()
%10 = trunc i64 %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"The process ID is: %d\0A\00"
@.str.1 = [29 x i8] c"The parent process ID is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @getpid()
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i64 (...) @getppid()
%7 = trunc i64 %6 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ notYet(char *);
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
void basRun() {
  notYet("Run");
  pushNumber(0);
}


x86 assembly (clang, -O0):
<basRun>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <notYet@plt>
xor    %edi,%edi
call   1040 <pushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<basRun>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <notYet@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"Run\00"
define void @basRun() {
%1 = call i32 @notYet(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @pushNumber(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Run\00"
define void @basRun() {
%1 = tail call i32 @notYet(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @pushNumber(i32 0)
ret void
}
unsigned char inb(int port) {
  unsigned char value;
  __asm__ __volatile__("inb %w1, %0" : "=a"(value) : "Nd"(port));
  return value;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8 asm sideeffect "inb ${1:w}, $0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i32 %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w}, $0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i8 %2
}
int test_imm_B7int64_midword_reg(long long val) {
  return ((val >> 16) & (0xB7 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B7int64_midword_reg>:
test   $0xb70000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B7int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 183
%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_B7int64_midword_reg(i64 %0) {
%2 = and i64 %0, 11993088
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int w5100_writeSn(unsigned int, int, int /*<<< orphan*/ *, int);
unsigned w5100_writeSnDHAR(unsigned sock, uint8_t *buf) {
  return w5100_writeSn(sock, 0x0006, buf, 6);
}


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

x86 assembly (clang, -O2):
mov    %rsi,%rdx
mov    $0x6,%esi
mov    $0x6,%ecx
jmp    1030 <w5100_writeSn@plt>

LLVM IR (-O0):
define i32 @w5100_writeSnDHAR(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 = load i32*, i32** %4
%7 = call i32 @w5100_writeSn(i32 %5, i32 6, i32* %6, i32 6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @w5100_writeSnDHAR(i32 %0, i32* %1) {
%3 = tail call i32 @w5100_writeSn(i32 %0, i32 6, i32* %1, i32 6)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *svz_malloc(int);
char *svz_strdup(char *src) {
  char *dst;
  int len;
  if (src == NULL || (len = strlen(src)) == 0)
    return NULL;
  dst = svz_malloc(len + 1);
  memcpy(dst, src, len + 1);
  return dst;
}


x86 assembly (clang, -O0):
<svz_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115c <svz_strdup+0x2c>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jne    1169 <svz_strdup+0x39>
movq   $0x0,-0x8(%rbp)
jmp    1193 <svz_strdup+0x63>
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
call   1050 <svz_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svz_strdup>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     1163 <svz_strdup+0x33>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
je     1163 <svz_strdup+0x33>
mov    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <svz_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
jmp    1166 <svz_strdup+0x36>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @svz_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8, %1
store i8* null, i8** %2
br label %23
13: ; preds = %8
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
%16 = call i8* @svz_malloc(i32 %15)
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = call i32 @memcpy(i8* %17, i8* %18, i32 %20)
%22 = load i8*, i8** %4
store i8* %22, i8** %2
br label %23
23: ; preds = %13, %12
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
define i8* @svz_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = add nsw i32 %4, 1
%8 = tail call i8* @svz_malloc(i32 %7)
%9 = tail call i32 @memcpy(i8* %8, i8* %0, i32 %7)
br label %10
10: ; preds = %1, %3, %6
%11 = phi i8* [ %8, %6 ], [ null, %3 ], [ null, %1 ]
ret i8* %11
}
/* Variables and functions */
int Log_MsgLine2(char *, char *, char *, int);
int Log_MsgLine(char *LogFileName, char *sLine) {
  int ret = 0;
  ret = Log_MsgLine2("", LogFileName, sLine, (2000 * 1024));
  return ret;
}


x86 assembly (clang, -O0):
<Log_MsgLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeca(%rip),%rdi
mov    $0x1f4000,%ecx
call   1030 <Log_MsgLine2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Log_MsgLine>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
mov    $0x1f4000,%ecx
jmp    1030 <Log_MsgLine2@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @Log_MsgLine(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @Log_MsgLine2(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i32 2048000)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @Log_MsgLine(i8* %0, i8* %1) {
%3 = tail call i32 @Log_MsgLine2(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 2048000)
ret i32 %3
}
/* Variables and functions */
int arc4random();
int rand_limit(int limit) {
  if (limit < 0)
    return 0;
  int divisor = 0x7fffffff / (limit + 1);
  int retval;
  do {
    retval = arc4random() / divisor;
  } while (retval > limit);
  return retval;
}


x86 assembly (clang, -O0):
<rand_limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1131 <rand_limit+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1162 <rand_limit+0x52>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    $0x7fffffff,%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <arc4random@plt>
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1142 <rand_limit+0x32>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_limit>:
test   %edi,%edi
js     1145 <rand_limit+0x35>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x1(%rbx),%ecx
mov    $0x7fffffff,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <arc4random@plt>
cltd
idiv   %ebp
cmp    %ebx,%eax
jg     1130 <rand_limit+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @rand_limit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %23
9: ; preds = %1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = sdiv i32 2147483647, %11
store i32 %12, i32* %4
br label %13
13: ; preds = %17, %9
%14 = call i32 (...) @arc4random()
%15 = load i32, i32* %4
%16 = sdiv i32 %14, %15
store i32 %16, i32* %5
br label %17
17: ; preds = %13
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = icmp sgt i32 %18, %19
br i1 %20, label %13, label %21
21: ; preds = %17
%22 = load i32, i32* %5
store i32 %22, i32* %2
br label %23
23: ; preds = %21, %8
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @rand_limit(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = add nuw nsw i32 %0, 1
%5 = udiv i32 2147483647, %4
br label %6
6: ; preds = %6, %3
%7 = tail call i32 (...) @arc4random()
%8 = sdiv i32 %7, %5
%9 = icmp sgt i32 %8, %0
br i1 %9, label %6, label %10
10: ; preds = %6, %1
%11 = phi i32 [ 0, %1 ], [ %8, %6 ]
ret i32 %11
}
IEH3err(message, a, b, c, d, e) char message[];
{
  extern int cgoof;
  printf("ERROR ");
  printf(message, a, b, c, d, e);
  cputc('\n');
  cexit(cgoof);
}


x86 assembly (clang, -O0):
<IEH3err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1050 <cputc@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1040 <cexit@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IEH3err>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %rdi,%rbp
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1050 <cputc@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cexit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"ERROR \00"
@cgoof = external global i32
define i32 @IEH3err(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = load i32, i32* %10
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %13
%21 = call i32 (i8*, ...) @printf(i8* %15, i32 %16, i32 %17, i32 %18, i32 %19, i32 %20)
%22 = call i32 (i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, ...)*)(i32 10)
%23 = load i32, i32* @cgoof
%24 = call i32 (i32, ...) bitcast (i32 (...)* @cexit to i32 (i32, ...)*)(i32 %23)
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
@.str = [7 x i8] c"ERROR \00"
@cgoof = external global i32
define i32 @IEH3err(i8* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, ...)*)(i32 10)
%10 = load i32, i32* @cgoof
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @cexit to i32 (i32, ...)*)(i32 %10)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ test_radix(int);
int main(int argc, const char **argv) { test_radix(5000000); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4c4b40,%edi
call   1030 <test_radix@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 @test_radix(i32 5000000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test_radix(i32 5000000)
ret i32 0
}
void externfunc(void) {}


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

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

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

LLVM IR (-O2):
define void @externfunc() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void memSet8OpenBus(uint16_t addr, uint8_t val) {
  (void)addr;
  (void)val;
}


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

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

LLVM IR (-O0):
define void @memSet8OpenBus(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 = load i32, i32* %4
ret void
}

LLVM IR (-O2):
define void @memSet8OpenBus(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
char rot13_char(char);
char rhs(char x) { return rot13_char(rot13_char(x)); }


x86 assembly (clang, -O0):
<rhs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <rot13_char@plt>
movsbl %al,%edi
call   1030 <rot13_char@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhs>:
push   %rax
call   1030 <rot13_char@plt>
movsbl %al,%edi
pop    %rax
jmp    1030 <rot13_char@plt>

LLVM IR (-O0):
define signext i8 @rhs(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call signext i8 @rot13_char(i8 signext %3)
%5 = call signext i8 @rot13_char(i8 signext %4)
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @rhs(i8 signext %0) {
%2 = tail call signext i8 @rot13_char(i8 signext %0)
%3 = tail call signext i8 @rot13_char(i8 signext %2)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ msgRenew();
void msg_renew_(void) { msgRenew(); }


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

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

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

LLVM IR (-O2):
define void @msg_renew_() {
%1 = tail call i32 (...) @msgRenew()
ret void
}
char *vl_string_find_char_rev(char const *beginning, char const *end, char c) {
  while (end-- != beginning) {
    if (*end == c) {
      return (char *)end;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<vl_string_find_char_rev>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    -0x10(%rbp),%rax
je     114f <vl_string_find_char_rev+0x4f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jne    114a <vl_string_find_char_rev+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <vl_string_find_char_rev+0x57>
jmp    1111 <vl_string_find_char_rev+0x11>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vl_string_find_char_rev>:
cmp    %rdi,%rsi
je     1112 <vl_string_find_char_rev+0x12>
lea    -0x1(%rsi),%rax
cmp    %dl,-0x1(%rsi)
mov    %rax,%rsi
jne    1100 <vl_string_find_char_rev>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @vl_string_find_char_rev(i8* readnone %0, i8* %1, i8 signext %2) {
br label %4
4: ; preds = %8, %3
%5 = phi i8* [ %1, %3 ], [ %6, %8 ]
%6 = getelementptr inbounds i8, i8* %5, i64 -1
%7 = icmp eq i8* %5, %0
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, %2
br i1 %10, label %11, label %4
11: ; preds = %4, %8
%12 = phi i8* [ %6, %8 ], [ null, %4 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                         size_t const);
void *realloc(void *, size_t const);
__attribute__((alloc_size(2))) void *xrealloc(void *ptr, const size_t size) {
  void *ret = realloc(ptr, size);
  if (!ret && size)
    error(EXIT_FAILURE, 0, "cannot allocate %zu bytes", size);
  return ret;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1172 <xrealloc+0x52>
cmpq   $0x0,-0x10(%rbp)
je     1172 <xrealloc+0x52>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
xor    %esi,%esi
lea    0xe93(%rip),%rdx
call   1040 <error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1153 <xrealloc+0x33>
test   %r14,%r14
jne    1153 <xrealloc+0x33>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rdx
xor    %esi,%esi
mov    %rbx,%rcx
call   1040 <error@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @EXIT_FAILURE
%16 = load i64, i64* %4
%17 = call i32 @error(i32 %15, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %16)
br label %18
18: ; preds = %14, %11, %2
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"cannot allocate %zu bytes\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @error(i32 %8, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %10
10: ; preds = %7, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_iochannel_write_with_creds() {
  printf("NOT IMPLEMENTED:"
         "pa_iochannel_write_with_creds"
         "\n");
}


x86 assembly (clang, -O0):
<pa_iochannel_write_with_creds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [47 x i8] c"NOT IMPLEMENTED:pa_iochannel_write_with_creds\0A\00"
define i32 @pa_iochannel_write_with_creds() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [46 x i8] c"NOT IMPLEMENTED:pa_iochannel_write_with_creds\00"
define i32 @pa_iochannel_write_with_creds() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
long long GetMaxLongLong(void) { return ((unsigned long long)-1) >> 1; }


x86 assembly (clang, -O0):
<GetMaxLongLong>:
push   %rbp
mov    %rsp,%rbp
movabs $0x7fffffffffffffff,%rax
ff ff 7f
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMaxLongLong>:
movabs $0x7fffffffffffffff,%rax
ff ff 7f
ret

LLVM IR (-O0):
define i64 @GetMaxLongLong() {
ret i64 9223372036854775807
}

LLVM IR (-O2):
define i64 @GetMaxLongLong() {
ret i64 9223372036854775807
}
/* Variables and functions */
int foo(int);
int main(void) {
  int res = foo(5);
  if (res != 15)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <foo@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
je     1142 <main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <main+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1030 <foo@plt>
xor    %ecx,%ecx
cmp    $0xf,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @foo(i32 5)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 15
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 5)
%2 = icmp ne i32 %1, 15
%3 = zext i1 %2 to i32
ret i32 %3
}