xunge/DecIR huggingface dataset:
/* Variables and functions */
char *_strnset(char *, int, unsigned int);
char *strnset(char *str, int value, unsigned int len) {
  return _strnset(str, value, len);
}


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

x86 assembly (clang, -O2):
<strnset>:
jmp    1030 <_strnset@plt>

LLVM IR (-O0):
define i8* @strnset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i8* @_strnset(i8* %7, i32 %8, i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @strnset(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @_strnset(i8* %0, i32 %1, i32 %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ _retval;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *getFormattedTime(void) {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  static char _retval[20];
  strftime(_retval, sizeof(_retval), "%Y-%m-%d %H:%M:%S", timeinfo);
  return _retval;
}


x86 assembly (clang, -O0):
<getFormattedTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0x2ef7(%rip),%rdi
mov    $0x14,%esi
lea    0xe9b(%rip),%rdx
call   1050 <strftime@plt>
lea    0x2edf(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFormattedTime>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0x2eff(%rip),%rbx
lea    0xea8(%rip),%rdx
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@getFormattedTime._retval = internal global [20 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
define i8* @getFormattedTime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = call i32 @strftime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @getFormattedTime._retval, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @getFormattedTime._retval, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@getFormattedTime._retval = internal global [20 x i8] zeroinitializer
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
define i8* @getFormattedTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @strftime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @getFormattedTime._retval, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @getFormattedTime._retval, i64 0, i64 0)
}
/* Type definitions */
typedef scalar_t__ uint_fast16_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_LESS_THAN_uint_fast16_t(uint_fast16_t const k1,
                                               uint_fast16_t const k2) {
  return k1 < k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_LESS_THAN_uint_fast16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_LESS_THAN_uint_fast16_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_uint_fast16_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_uint_fast16_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
double dstrb_beta_mean(const double a, const double b) {
  assert(a > 0.);
  assert(b > 0.);
  return a / (a + b);
}


x86 assembly (clang, -O0):
<dstrb_beta_mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrb_beta_mean>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1030 <assert@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
ucomisd 0xebd(%rip),%xmm0
seta   %dil
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @dstrb_beta_mean(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fcmp ogt double %5, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load double, double* %4
%10 = fcmp ogt double %9, 0.000000e+00
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load double, double* %3
%14 = load double, double* %3
%15 = load double, double* %4
%16 = fadd double %14, %15
%17 = fdiv double %13, %16
ret double %17
}

LLVM IR (-O2):
define double @dstrb_beta_mean(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fcmp ogt double %1, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = fadd double %0, %1
%10 = fdiv double %0, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int nondet();
void main() {
  int n;
  n = nondet();
  bar(n);
  return;
}


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 (...) @nondet()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @bar(i32 %3)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @nondet()
%2 = tail call i32 @bar(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arc4random_buf(int /*<<< orphan*/ *, int);
void nullPointer(void) { arc4random_buf(NULL, 5); }


x86 assembly (clang, -O0):
<nullPointer>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
mov    $0x5,%esi
call   1030 <arc4random_buf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointer>:
xor    %edi,%edi
mov    $0x5,%esi
jmp    1030 <arc4random_buf@plt>

LLVM IR (-O0):
define void @nullPointer() {
%1 = call i32 @arc4random_buf(i32* null, i32 5)
ret void
}

LLVM IR (-O2):
define void @nullPointer() {
%1 = tail call i32 @arc4random_buf(i32* null, i32 5)
ret void
}
void mx28_power_wait_pswitch(void) {}


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

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

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

LLVM IR (-O2):
define void @mx28_power_wait_pswitch() {
ret void
}
int test_imm_34uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x34 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_34uint64_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, 52
%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_34uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 223338299392
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ CallFile(char *);
void main(int argc, char *argv[]) {
  if (argc == 2)
    CallFile(argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    1136 <main+0x26>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <CallFile@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jne    111e <main+0xe>
mov    0x8(%rsi),%rdi
jmp    1030 <CallFile@plt>
ret

LLVM IR (-O0):
define void @main(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 = icmp eq i32 %5, 2
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @CallFile(i8* %10)
br label %12
12: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @CallFile(i8* %6)
br label %8
8: ; preds = %4, %2
ret void
}
double colordifference_ch(const double x, const double y, const double alphas) {
  const double black = x - y, white = black + alphas;
  return ((black * black) > (white * white) ? (black * black)
                                            : (white * white));
}


x86 assembly (clang, -O0):
<colordifference_ch>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1163 <colordifference_ch+0x63>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1172 <colordifference_ch+0x72>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<colordifference_ch>:
subsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm0
mulsd  %xmm2,%xmm2
maxsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @colordifference_ch(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %4
%10 = load double, double* %5
%11 = fsub double %9, %10
store double %11, double* %7
%12 = load double, double* %7
%13 = load double, double* %6
%14 = fadd double %12, %13
store double %14, double* %8
%15 = load double, double* %7
%16 = load double, double* %7
%17 = fmul double %15, %16
%18 = load double, double* %8
%19 = load double, double* %8
%20 = fmul double %18, %19
%21 = fcmp ogt double %17, %20
br i1 %21, label %22, label %26
22: ; preds = %3
%23 = load double, double* %7
%24 = load double, double* %7
%25 = fmul double %23, %24
br label %30
26: ; preds = %3
%27 = load double, double* %8
%28 = load double, double* %8
%29 = fmul double %27, %28
br label %30
30: ; preds = %26, %22
%31 = phi double [ %25, %22 ], [ %29, %26 ]
ret double %31
}

LLVM IR (-O2):
define double @colordifference_ch(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fadd double %4, %2
%6 = fmul double %4, %4
%7 = fmul double %5, %5
%8 = fcmp ogt double %6, %7
%9 = select i1 %8, double %6, double %7
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
int fail_with_error(char *error) {
  printf("%s (Latest errno %s)\n", error, strerror(errno));
  return 1;
}


x86 assembly (clang, -O0):
<fail_with_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_with_error>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%s (Latest errno %s)\0A\00"
@errno = global i32 0
define i32 @fail_with_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @errno
%5 = call i8* @strerror(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %5)
ret i32 1
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s (Latest errno %s)\0A\00"
@errno = global i32 0
define i32 @fail_with_error(i8* %0) {
%2 = load i32, i32* @errno
%3 = tail call i8* @strerror(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %3)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *name) {
  printf("Usage: %s barebox-flash-image <outfile>\n", name);
}


x86 assembly (clang, -O0):
<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):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: %s barebox-flash-image <outfile>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Usage: %s barebox-flash-image <outfile>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Print(int, char *);
int StartTalk(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ Wait(int);
int WalkTo(int /*<<< orphan*/, int, int);
__attribute__((visibility("default"))) void Look_CannonFoddler() {
  Print(6, "Daniel");
  int wait0 = WalkTo(0, 216 + 65, 184 + 145);
  Wait(wait0);
  int wait1 = StartTalk(0, 0);
  Wait(wait1);
}


x86 assembly (clang, -O0):
<Look_CannonFoddler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
lea    0xeac(%rip),%rsi
call   1050 <Print@plt>
xor    %edi,%edi
mov    $0x119,%esi
mov    $0x149,%edx
call   1030 <WalkTo@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <Wait@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <StartTalk@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <Wait@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Look_CannonFoddler>:
push   %rax
lea    0xeb8(%rip),%rsi
mov    $0x6,%edi
call   1050 <Print@plt>
xor    %edi,%edi
mov    $0x119,%esi
mov    $0x149,%edx
call   1030 <WalkTo@plt>
mov    %eax,%edi
call   1060 <Wait@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <StartTalk@plt>
mov    %eax,%edi
pop    %rax
jmp    1060 <Wait@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Daniel\00"
define void @Look_CannonFoddler() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @Print(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @WalkTo(i32 0, i32 281, i32 329)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @Wait(i32 %5)
%7 = call i32 @StartTalk(i32 0, i32 0)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @Wait(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Daniel\00"
define void @Look_CannonFoddler() {
%1 = tail call i32 @Print(i32 6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @WalkTo(i32 0, i32 281, i32 329)
%3 = tail call i32 @Wait(i32 %2)
%4 = tail call i32 @StartTalk(i32 0, i32 0)
%5 = tail call i32 @Wait(i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ quit(int);
int io_error_handler(Display *dpy) {
  quit(1);
  return (0);
}


x86 assembly (clang, -O0):
<io_error_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <quit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_error_handler>:
push   %rax
mov    $0x1,%edi
call   1030 <quit@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @io_error_handler(i32* nocapture readnone %0) {
%2 = tail call i32 @quit(i32 1)
ret i32 0
}
float _dedx_get_atom_charge(int id, int *err) {
  if (id < 113) {
    return id;
  }
  *err = 204;
  return -1;
}


x86 assembly (clang, -O0):
<_dedx_get_atom_charge>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x71,-0x8(%rbp)
jge    1124 <_dedx_get_atom_charge+0x24>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113b <_dedx_get_atom_charge+0x3b>
mov    -0x10(%rbp),%rax
movl   $0xcc,(%rax)
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dedx_get_atom_charge>:
cmp    $0x70,%edi
jg     110a <_dedx_get_atom_charge+0xa>
cvtsi2ss %edi,%xmm0
ret
movl   $0xcc,(%rsi)
movss  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @_dedx_get_atom_charge(i32 %0, i32* %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 113
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to float
store float %10, float* %3
br label %13
11: ; preds = %2
%12 = load i32*, i32** %5
store i32 204, i32* %12
store float -1.000000e+00, float* %3
br label %13
13: ; preds = %11, %8
%14 = load float, float* %3
ret float %14
}

LLVM IR (-O2):
define float @_dedx_get_atom_charge(i32 %0, i32* nocapture writeonly %1) {
%3 = icmp slt i32 %0, 113
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = sitofp i32 %0 to float
br label %7
6: ; preds = %2
store i32 204, i32* %1
br label %7
7: ; preds = %6, %4
%8 = phi float [ %5, %4 ], [ -1.000000e+00, %6 ]
ret float %8
}
/* Type definitions */
struct notifier_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wdt_stop();
int wdt_notify_sys(struct notifier_block *this, unsigned long code,
                   void *unused) {
  {
    if (code == 1UL) {
      wdt_stop();
    } else if (code == 2UL) {
      wdt_stop();
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<wdt_notify_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    113b <wdt_notify_sys+0x2b>
mov    $0x0,%al
call   1030 <wdt_stop@plt>
jmp    1152 <wdt_notify_sys+0x42>
cmpq   $0x2,-0x10(%rbp)
jne    114d <wdt_notify_sys+0x3d>
mov    $0x0,%al
call   1030 <wdt_stop@plt>
jmp    1152 <wdt_notify_sys+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdt_notify_sys>:
add    $0xffffffffffffffff,%rsi
cmp    $0x1,%rsi
ja     1126 <wdt_notify_sys+0x16>
push   %rax
xor    %eax,%eax
call   1030 <wdt_stop@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.notifier_block = type { i32 }
define i32 @wdt_notify_sys(%struct.notifier_block* %0, i64 %1, i8* %2) {
%4 = alloca %struct.notifier_block*
%5 = alloca i64
%6 = alloca i8*
store %struct.notifier_block* %0, %struct.notifier_block** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i64, i64* %5
%8 = icmp eq i64 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @wdt_stop()
br label %17
11: ; preds = %3
%12 = load i64, i64* %5
%13 = icmp eq i64 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @wdt_stop()
br label %16
16: ; preds = %14, %11
br label %17
17: ; preds = %16, %9
ret i32 0
}

LLVM IR (-O2):
%struct.notifier_block = type { i32 }
define i32 @wdt_notify_sys(%struct.notifier_block* nocapture readnone %0, i64 %1, i8* nocapture readnone %2) {
%4 = add i64 %1, -1
%5 = icmp ult i64 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @wdt_stop()
br label %8
8: ; preds = %3, %6
ret i32 0
}
/* Variables and functions */
char *getenv(char *);
char *getsound() {
  char *p = getenv("DEVRPLAY_SOUND");
  return p ? p : "devrplay";
}


x86 assembly (clang, -O0):
<getsound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1140 <getsound+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <getsound+0x40>
lea    0xec8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <getsound+0x40>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsound>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xee8(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"DEVRPLAY_SOUND\00"
@.str.1 = [9 x i8] c"devrplay\00"
define i8* @getsound() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i8*, i8** %1
br label %8
7: ; preds = %0
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %7 ]
ret i8* %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"DEVRPLAY_SOUND\00"
@.str.1 = [9 x i8] c"devrplay\00"
define i8* @getsound() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello world!\n");
  printf("another line!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello world!\0A\00"
@.str.1 = [15 x i8] c"another line!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hello world!\00"
@str.2 = [14 x i8] c"another line!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void smp_init_pseries_mpic(void) {}


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

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

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

LLVM IR (-O2):
define void @smp_init_pseries_mpic() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pA(char *);
void push_stack_dummy(void) { pA("stack_head++;"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"stack_head++;\00"
define void @push_stack_dummy() {
%1 = call i32 @pA(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"stack_head++;\00"
define void @push_stack_dummy() {
%1 = tail call i32 @pA(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ const wchar_t;

/* Variables and functions */
wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n) {
  size_t i;
  for (i = 0; i < n; i++) {
    if (*s == c) {
      return (wchar_t *)s;
    }
    s++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<wmemchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1161 <wmemchr+0x61>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    1144 <wmemchr+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <wmemchr+0x69>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <wmemchr+0x18>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmemchr>:
test   %rdx,%rdx
je     111f <wmemchr+0x1f>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %rsi,(%rax)
je     1121 <wmemchr+0x21>
add    $0x8,%rax
add    $0xffffffffffffffff,%rdx
jne    1110 <wmemchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64* @wmemchr(i64* %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %10
%6 = phi i64 [ %12, %10 ], [ 0, %3 ]
%7 = phi i64* [ %11, %10 ], [ %0, %3 ]
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i64, i64* %7, i64 1
%12 = add nuw i64 %6, 1
%13 = icmp eq i64 %12, %2
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %3
%15 = phi i64* [ null, %3 ], [ null, %10 ], [ %7, %5 ]
ret i64* %15
}
int test_imm_3Aint64_lowword_mem(long long *val) {
  return ((*val) & (0x3A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Aint64_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, 58
%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_3Aint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 58
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned int BKDRHash(char *str) {
  const unsigned int seed = 131;
  unsigned int hash = 0;
  while (*str) {
    hash = hash * seed + (*str++);
  }
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x83,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <BKDRHash+0x46>
imul   $0x83,-0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <BKDRHash+0x16>
mov    -0x10(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <BKDRHash+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x83,%eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 131
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
long FlashErase(unsigned long ulAddress) {
  ;
  (*((volatile unsigned long *)(0x400FD014))) =
      (0x00000001 | 0x00000200 | 0x00000800);
  (*((volatile unsigned long *)(0x400FD000))) = ulAddress;
  (*((volatile unsigned long *)(0x400FD008))) = 0xA4420000 | 0x00000002;
  while ((*((volatile unsigned long *)(0x400FD008))) & 0x00000002) {
  }
  if ((*((volatile unsigned long *)(0x400FD00C))) &
      (0x00000001 | 0x00000200 | 0x00000800)) {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<FlashErase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0x400fd014,%eax
movq   $0xa01,(%rax)
mov    -0x10(%rbp),%rcx
mov    $0x400fd000,%eax
mov    %rcx,(%rax)
mov    $0x400fd008,%eax
mov    $0xa4420002,%ecx
mov    %rcx,(%rax)
mov    $0x400fd008,%eax
mov    (%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     1148 <FlashErase+0x48>
jmp    112d <FlashErase+0x2d>
mov    $0x400fd00c,%eax
mov    (%rax),%rax
and    $0xa01,%rax
cmp    $0x0,%rax
je     116d <FlashErase+0x6d>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1175 <FlashErase+0x75>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashErase>:
movq   $0xa01,0x400fd014
mov    %rdi,0x400fd000
40
mov    $0xa4420002,%eax
mov    %rax,0x400fd008
40
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
testq  $0x2,0x400fd008
jne    1130 <FlashErase+0x30>
mov    0x400fd00c,%rax
40
and    $0xa01,%eax
neg    %rax
sbb    %rax,%rax
ret

LLVM IR (-O0):
define i64 @FlashErase(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
store volatile i64 2561, i64* inttoptr (i64 1074778132 to i64*)
%4 = load i64, i64* %3
store volatile i64 %4, i64* inttoptr (i64 1074778112 to i64*)
store volatile i64 2755788802, i64* inttoptr (i64 1074778120 to i64*)
br label %5
5: ; preds = %9, %1
%6 = load volatile i64, i64* inttoptr (i64 1074778120 to i64*)
%7 = and i64 %6, 2
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load volatile i64, i64* inttoptr (i64 1074778124 to i64*)
%12 = and i64 %11, 2561
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i64 -1, i64* %2
br label %16
15: ; preds = %10
store i64 0, i64* %2
br label %16
16: ; preds = %15, %14
%17 = load i64, i64* %2
ret i64 %17
}

LLVM IR (-O2):
define i64 @FlashErase(i64 %0) {
store volatile i64 2561, i64* inttoptr (i64 1074778132 to i64*)
store volatile i64 %0, i64* inttoptr (i64 1074778112 to i64*)
store volatile i64 2755788802, i64* inttoptr (i64 1074778120 to i64*)
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 1074778120 to i64*)
%4 = and i64 %3, 2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = load volatile i64, i64* inttoptr (i64 1074778124 to i64*)
%8 = and i64 %7, 2561
%9 = icmp ne i64 %8, 0
%10 = sext i1 %9 to i64
ret i64 %10
}
/* Variables and functions */
int printf(char *, int);
main() {
  int a;
  a = 0;
  a = printf("%d\n", a);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ RAM_ROM_Initialise(int);
void RAM_ROM_Install(void) { RAM_ROM_Initialise(16); }


x86 assembly (clang, -O0):
<RAM_ROM_Install>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
call   1030 <RAM_ROM_Initialise@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RAM_ROM_Install>:
mov    $0x10,%edi
jmp    1030 <RAM_ROM_Initialise@plt>

LLVM IR (-O0):
define void @RAM_ROM_Install() {
%1 = call i32 @RAM_ROM_Initialise(i32 16)
ret void
}

LLVM IR (-O2):
define void @RAM_ROM_Install() {
%1 = tail call i32 @RAM_ROM_Initialise(i32 16)
ret void
}
int menu_state_pause(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @menu_state_pause() {
ret i32 0
}

LLVM IR (-O2):
define i32 @menu_state_pause() {
ret i32 0
}
unsigned lower_3bytes(unsigned d) { return d | 0x202020; }


x86 assembly (clang, -O0):
<lower_3bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x202020,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_3bytes>:
mov    %edi,%eax
or     $0x202020,%eax
ret

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

LLVM IR (-O2):
define i32 @lower_3bytes(i32 %0) {
%2 = or i32 %0, 2105376
ret i32 %2
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ stat(char *, struct stat *);
int main(void) {
  struct stat sst;
  if (stat("test.txt", &sst) == 0) {
    printf("sst.st_size = %d\n", sst.st_size);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jne    1158 <main+0x38>
mov    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
jne    1144 <main+0x24>
mov    (%rsp),%esi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [18 x i8] c"sst.st_size = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
store i32 0, i32* %1
%3 = call i64 @stat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %5, %0
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [18 x i8] c"sst.st_size = %d\0A\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @stat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %5, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
void fdset_add(int *fdpmax, fd_set *fdset, int fd) {
  if (fd < 0)
    return;
  FD_SET(fd, fdset);
  if (*fdpmax < fd)
    *fdpmax = fd;
}


x86 assembly (clang, -O0):
<fdset_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1132 <fdset_add+0x22>
jmp    1156 <fdset_add+0x46>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <FD_SET@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jge    1156 <fdset_add+0x46>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdset_add>:
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
js     112c <fdset_add+0x1c>
mov    %edx,%ebx
mov    %rdi,%r14
mov    %edx,%edi
call   1030 <FD_SET@plt>
cmp    %ebx,(%r14)
jge    112c <fdset_add+0x1c>
mov    %ebx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @fdset_add(i32* nocapture %0, i32* %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call i32 @FD_SET(i32 %2, i32* %1)
%7 = load i32, i32* %0
%8 = icmp slt i32 %7, %2
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 %2, i32* %0
br label %10
10: ; preds = %3, %9, %5
ret void
}
void foo(int c) {
  if (c)
    __builtin_trap();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1113 <foo+0x13>
ud2
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
jne    1105 <foo+0x5>
ret
ud2

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @llvm.trap()
unreachable
4: ; preds = %1
ret void
}
/* Variables and functions */
unsigned long getpagesize();
size_t pageAlignLen(void *startAddr, size_t size) {
  unsigned long pageSize = getpagesize();
  unsigned long pageRnd = pageSize - 1;
  unsigned long pageMask = ~pageRnd;
  unsigned long addr = (unsigned long)startAddr;
  unsigned long endAddr = (addr + size + pageRnd) & pageMask;
  addr &= pageMask;
  return (size_t)(endAddr - addr);
}


x86 assembly (clang, -O0):
<pageAlignLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpagesize@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
and    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
and    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
sub    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pageAlignLen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <getpagesize@plt>
add    %r14,%rbx
lea    (%rax,%rbx,1),%rcx
add    $0xffffffffffffffff,%rcx
neg    %rax
and    %rax,%rcx
and    %r14,%rax
sub    %rax,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @pageAlignLen(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%10 = call i64 (...) @getpagesize()
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = sub i64 %11, 1
store i64 %12, i64* %6
%13 = load i64, i64* %6
%14 = xor i64 %13, -1
store i64 %14, i64* %7
%15 = load i8*, i8** %3
%16 = ptrtoint i8* %15 to i64
store i64 %16, i64* %8
%17 = load i64, i64* %8
%18 = load i64, i64* %4
%19 = add i64 %17, %18
%20 = load i64, i64* %6
%21 = add i64 %19, %20
%22 = load i64, i64* %7
%23 = and i64 %21, %22
store i64 %23, i64* %9
%24 = load i64, i64* %7
%25 = load i64, i64* %8
%26 = and i64 %25, %24
store i64 %26, i64* %8
%27 = load i64, i64* %9
%28 = load i64, i64* %8
%29 = sub i64 %27, %28
ret i64 %29
}

LLVM IR (-O2):
define i64 @pageAlignLen(i8* %0, i64 %1) {
%3 = tail call i64 (...) @getpagesize()
%4 = sub i64 0, %3
%5 = ptrtoint i8* %0 to i64
%6 = add i64 %1, -1
%7 = add i64 %6, %5
%8 = add i64 %7, %3
%9 = and i64 %8, %4
%10 = and i64 %4, %5
%11 = sub i64 %9, %10
ret i64 %11
}
void fun1(void) {}


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

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

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

LLVM IR (-O2):
define void @fun1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c_flip_horizontal(char *, short, short, unsigned char);
int /*<<< orphan*/ c_flip_vertical(char *, short, short, unsigned char);
void c_flip_both(char *pixels, short width, short height,
                 unsigned char bytes_per_pixel) {
  c_flip_vertical(pixels, width, height, bytes_per_pixel);
  c_flip_horizontal(pixels, width, height, bytes_per_pixel);
}


x86 assembly (clang, -O0):
<c_flip_both>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dx,%cx
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %cx,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%cx
mov    -0xc(%rbp),%ax
movswl %cx,%esi
movswl %ax,%edx
movzbl -0xd(%rbp),%ecx
call   1040 <c_flip_vertical@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%cx
mov    -0xc(%rbp),%ax
movswl %cx,%esi
movswl %ax,%edx
movzbl -0xd(%rbp),%ecx
call   1030 <c_flip_horizontal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_flip_both>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
call   1040 <c_flip_vertical@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <c_flip_horizontal@plt>

LLVM IR (-O0):
define void @c_flip_both(i8* %0, i16 signext %1, i16 signext %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i8
store i8* %0, i8** %5
store i16 %1, i16* %6
store i16 %2, i16* %7
store i8 %3, i8* %8
%9 = load i8*, i8** %5
%10 = load i16, i16* %6
%11 = load i16, i16* %7
%12 = load i8, i8* %8
%13 = call i32 @c_flip_vertical(i8* %9, i16 signext %10, i16 signext %11, i8 zeroext %12)
%14 = load i8*, i8** %5
%15 = load i16, i16* %6
%16 = load i16, i16* %7
%17 = load i8, i8* %8
%18 = call i32 @c_flip_horizontal(i8* %14, i16 signext %15, i16 signext %16, i8 zeroext %17)
ret void
}

LLVM IR (-O2):
define void @c_flip_both(i8* %0, i16 signext %1, i16 signext %2, i8 zeroext %3) {
%5 = tail call i32 @c_flip_vertical(i8* %0, i16 signext %1, i16 signext %2, i8 zeroext %3)
%6 = tail call i32 @c_flip_horizontal(i8* %0, i16 signext %1, i16 signext %2, i8 zeroext %3)
ret void
}