xunge/DecIR huggingface dataset:
/* Type definitions */
struct roff_node {
  int dummy;
};
struct roff_meta {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ font_push(char);
int /*<<< orphan*/ pre_syn(struct roff_node *);
int pre_ft(const struct roff_meta *meta, struct roff_node *n) {
  pre_syn(n);
  font_push('I');
  return 1;
}


x86 assembly (clang, -O0):
<pre_ft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <pre_syn@plt>
mov    $0x49,%edi
call   1030 <font_push@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pre_ft>:
push   %rax
mov    %rsi,%rdi
call   1040 <pre_syn@plt>
mov    $0x49,%edi
call   1030 <font_push@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.roff_meta = type { i32 }
%struct.roff_node = type { i32 }
define i32 @pre_ft(%struct.roff_meta* %0, %struct.roff_node* %1) {
%3 = alloca %struct.roff_meta*
%4 = alloca %struct.roff_node*
store %struct.roff_meta* %0, %struct.roff_meta** %3
store %struct.roff_node* %1, %struct.roff_node** %4
%5 = load %struct.roff_node*, %struct.roff_node** %4
%6 = call i32 @pre_syn(%struct.roff_node* %5)
%7 = call i32 @font_push(i8 signext 73)
ret i32 1
}

LLVM IR (-O2):
%struct.roff_meta = type { i32 }
%struct.roff_node = type { i32 }
define i32 @pre_ft(%struct.roff_meta* nocapture readnone %0, %struct.roff_node* %1) {
%3 = tail call i32 @pre_syn(%struct.roff_node* %1)
%4 = tail call i32 @font_push(i8 signext 73)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_get_client_info() {
  printf("NOT IMPLEMENTED:"
         "pa_context_get_client_info"
         "\n");
}


x86 assembly (clang, -O0):
<pa_context_get_client_info>:
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_context_get_client_info>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [43 x i8] c"NOT IMPLEMENTED:pa_context_get_client_info\00"
define i32 @pa_context_get_client_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void __nesc_enable_interrupt() {}


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

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

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

LLVM IR (-O2):
define void @__nesc_enable_interrupt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bit_hl(int);
void opcb_6e() { bit_hl(5); }


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

x86 assembly (clang, -O2):
<opcb_6e>:
mov    $0x5,%edi
jmp    1030 <bit_hl@plt>

LLVM IR (-O0):
define void @opcb_6e() {
%1 = call i32 @bit_hl(i32 5)
ret void
}

LLVM IR (-O2):
define void @opcb_6e() {
%1 = tail call i32 @bit_hl(i32 5)
ret void
}
void read_barrier() {}


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

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

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

LLVM IR (-O2):
define void @read_barrier() {
ret void
}
float raw_relu_derivative_at(float y) { return y > 0.0 ? 1.0 : 0.0; }


x86 assembly (clang, -O0):
<raw_relu_derivative_at>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee6(%rip),%xmm3
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_relu_derivative_at>:
xorps  %xmm1,%xmm1
cmpltss %xmm0,%xmm1
movss  0xef0(%rip),%xmm0
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @raw_relu_derivative_at(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fcmp ogt double %4, 0.000000e+00
%6 = zext i1 %5 to i64
%7 = select i1 %5, double 1.000000e+00, double 0.000000e+00
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @raw_relu_derivative_at(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = select i1 %2, float 1.000000e+00, float 0.000000e+00
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Beta_Right(int value) {
  if (value) {
    cpc_key_press(0x63);
  } else {
    cpc_key_unpress(0x63);
  };
}


x86 assembly (clang, -O0):
<Joy_Beta_Right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Beta_Right+0x24>
mov    $0x63,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Beta_Right+0x2e>
mov    $0x63,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Beta_Right>:
test   %edi,%edi
je     112e <Joy_Beta_Right+0xe>
mov    $0x63,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x63,%edi
jmp    1040 <cpc_key_unpress@plt>

LLVM IR (-O0):
define void @Joy_Beta_Right(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 %7
5: ; preds = %1
%6 = call i32 @cpc_key_press(i32 99)
br label %9
7: ; preds = %1
%8 = call i32 @cpc_key_unpress(i32 99)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @Joy_Beta_Right(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 99)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 99)
br label %7
7: ; preds = %5, %3
ret void
}
void dquot_initialize(struct inode *inode) {}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
define void @dquot_initialize(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret void
}

LLVM IR (-O2):
%struct.inode = type opaque
define void @dquot_initialize(%struct.inode* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ names;

/* Variables and functions */
double evaluator_evaluate(void *, int, char **, double *);
double evaluator_evaluate_x(void *evaluator, double x) {
  char *names[] = {"x"};
  double values[1];
  values[0] = x;
  return evaluator_evaluate(evaluator, sizeof(names) / sizeof(names[0]), names,
                            values);
}


x86 assembly (clang, -O0):
<evaluator_evaluate_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    0x2cf0(%rip),%rax
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <evaluator_evaluate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluator_evaluate_x>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    $0x1,%esi
call   1030 <evaluator_evaluate@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"x\00"
@__const.evaluator_evaluate_x.names = [1 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0)]
define double @evaluator_evaluate_x(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca [1 x i8*]
%6 = alloca [1 x double]
store i8* %0, i8** %3
store double %1, double* %4
%7 = bitcast [1 x i8*]* %5 to i8*
%8 = load double, double* %4
%9 = getelementptr inbounds [1 x double], [1 x double]* %6, i64 0, i64 0
store double %8, double* %9
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [1 x i8*], [1 x i8*]* %5, i64 0, i64 0
%12 = getelementptr inbounds [1 x double], [1 x double]* %6, i64 0, i64 0
%13 = call double @evaluator_evaluate(i8* %10, i32 1, i8** %11, double* %12)
ret double %13
}

LLVM IR (-O2):
@.str = [2 x i8] c"x\00"
define double @evaluator_evaluate_x(i8* %0, double %1) {
%3 = alloca [1 x i8*]
%4 = alloca [1 x double]
%5 = bitcast [1 x i8*]* %3 to i8*
%6 = bitcast [1 x i8*]* %3 to i64*
store i64 ptrtoint ([2 x i8]* @.str to i64), i64* %6
%7 = bitcast [1 x double]* %4 to i8*
%8 = getelementptr inbounds [1 x double], [1 x double]* %4, i64 0, i64 0
store double %1, double* %8
%9 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
%10 = call double @evaluator_evaluate(i8* %0, i32 1, i8** %9, double* %8)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double toFahrenheit(int);
main() {
  printf("5.0 graus Celsius em Fahrenheit: %.2f", toFahrenheit(-54));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffca,%edi
call   1040 <toFahrenheit@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"5.0 graus Celsius em Fahrenheit: %.2f\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @toFahrenheit(i32 -54)
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"5.0 graus Celsius em Fahrenheit: %.2f\00"
define i32 @main() {
%1 = tail call double @toFahrenheit(i32 -54)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ err_exit(char *);
int mkstemp(char *);
int _mkstemp(char *p) {
  int fd = mkstemp(p);
  if (fd < 0)
    err_exit("_mkstemp");
  return fd;
}


x86 assembly (clang, -O0):
<_mkstemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mkstemp@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114e <_mkstemp+0x2e>
lea    0xeb7(%rip),%rdi
call   1030 <err_exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mkstemp>:
push   %rbx
call   1040 <mkstemp@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <_mkstemp+0x18>
lea    0xecd(%rip),%rdi
call   1030 <err_exit@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"_mkstemp\00"
define i32 @_mkstemp(i8* %0) {
%2 = tail call i32 @mkstemp(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @err_exit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
int exe$delete(struct _fab *fab, void *err, void *suc) {
  printk("not implemented\n");
}


x86 assembly (clang, -O0):
<exe$delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exe$delete>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printk@plt>

LLVM IR (-O0):
%struct._fab = type opaque
@.str = [17 x i8] c"not implemented\0A\00"
define i32 @"exe$delete"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct._fab*
%6 = alloca i8*
%7 = alloca i8*
store %struct._fab* %0, %struct._fab** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
%struct._fab = type opaque
@.str = [17 x i8] c"not implemented\0A\00"
define i32 @"exe$delete"(%struct._fab* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
long randm(long);
long expr_light_turn(long max) { return (randm(max)); }


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

x86 assembly (clang, -O2):
<expr_light_turn>:
jmp    1030 <randm@plt>

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

LLVM IR (-O2):
define i64 @expr_light_turn(i64 %0) {
%2 = tail call i64 @randm(i64 %0)
ret i64 %2
}
/* Variables and functions */
int daysdiff(int, int, int);
int dayofweek(int year, int month, int day) {
  return (4 + daysdiff(year, month, day)) % 7;
}


x86 assembly (clang, -O0):
<dayofweek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <daysdiff@plt>
add    $0x4,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dayofweek>:
push   %rax
call   1030 <daysdiff@plt>
mov    %eax,%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
add    $0x4,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %ecx,%eax
add    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dayofweek(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* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @daysdiff(i32 %7, i32 %8, i32 %9)
%11 = add nsw i32 4, %10
%12 = srem i32 %11, 7
ret i32 %12
}

LLVM IR (-O2):
define i32 @dayofweek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @daysdiff(i32 %0, i32 %1, i32 %2)
%5 = add nsw i32 %4, 4
%6 = srem i32 %5, 7
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ addsuba(char *);
void i_adda(void) { addsuba("add"); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
define void @i_adda() {
%1 = tail call i32 @addsuba(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_23int32_mem(int *val) {
  return ((*val) & (0x23 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_23int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 35
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int foo(int i, int j) {
  int res = 1;
  if (i < j) {
    if (i > j)
      res = 0;
  }
  if (res)
    return i;
  return j;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1135 <foo+0x35>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1130 <foo+0x30>
movl   $0x0,-0x10(%rbp)
jmp    1135 <foo+0x35>
cmpl   $0x0,-0x10(%rbp)
je     114a <foo+0x4a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <foo+0x50>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 returned %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ greet();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("app1\n");
  greet();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"app1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @greet()
ret i32 0
}
float areaOfRect(float l, float w) { return l * w; }


x86 assembly (clang, -O0):
<areaOfRect>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<areaOfRect>:
mulss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @areaOfRect(float %0, float %1) {
%3 = fmul float %0, %1
ret float %3
}
int sc_capwap_update_lock_is_locked(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @sc_capwap_update_lock_is_locked() {
ret i32 1
}

LLVM IR (-O2):
define i32 @sc_capwap_update_lock_is_locked() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ myputc(char);
int /*<<< orphan*/ myputuint(int, unsigned char);
void myputint(int num, unsigned char base) {
  if (num < 0) {
    num = -num;
    myputc('-');
  }
  myputuint(num, base);
}


x86 assembly (clang, -O0):
<myputint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114d <myputint+0x2d>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x2d,%edi
call   1030 <myputc@plt>
mov    -0x4(%rbp),%edi
movzbl -0x5(%rbp),%esi
call   1040 <myputuint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myputint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   %edi,%edi
jns    1137 <myputint+0x17>
neg    %ebp
mov    $0x2d,%edi
call   1030 <myputc@plt>
movzbl %bl,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <myputuint@plt>

LLVM IR (-O0):
define void @myputint(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = sub nsw i32 0, %8
store i32 %9, i32* %3
%10 = call i32 @myputc(i8 signext 45)
br label %11
11: ; preds = %7, %2
%12 = load i32, i32* %3
%13 = load i8, i8* %4
%14 = call i32 @myputuint(i32 %12, i8 zeroext %13)
ret void
}

LLVM IR (-O2):
define void @myputint(i32 %0, i8 zeroext %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = sub nsw i32 0, %0
%6 = tail call i32 @myputc(i8 signext 45)
br label %7
7: ; preds = %4, %2
%8 = phi i32 [ %5, %4 ], [ %0, %2 ]
%9 = tail call i32 @myputuint(i32 %8, i8 zeroext %1)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ serial;
};
typedef TYPE_1__ XButtonPressedEvent;

/* Variables and functions */
unsigned long get_XButtonPressedEvent_serial(void *_p) {
  return (unsigned long)((XButtonPressedEvent *)_p)->serial;
}


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

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

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

LLVM IR (-O2):
define i64 @get_XButtonPressedEvent_serial(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
char use_char(char c) { return c; }


x86 assembly (clang, -O0):
<use_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @use_char(i8 returned signext %0) {
ret i8 %0
}
long dt_time_to_h(long t) { return (t / (60 * 60)) % 24; }


x86 assembly (clang, -O0):
<dt_time_to_h>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    $0x18,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_time_to_h>:
mov    %rdi,%rax
movabs $0x48d159e26af37c05,%rcx
59 d1 48
imul   %rcx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0xa,%rdx
add    %rdx,%rcx
movabs $0x2aaaaaaaaaaaaaab,%rdx
aa aa 2a
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x2,%rdx
add    %rax,%rdx
shl    $0x3,%rdx
lea    (%rdx,%rdx,2),%rax
sub    %rax,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @dt_time_to_h(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sdiv i64 %3, 3600
%5 = srem i64 %4, 24
ret i64 %5
}

LLVM IR (-O2):
define i64 @dt_time_to_h(i64 %0) {
%2 = sdiv i64 %0, 3600
%3 = srem i64 %2, 24
ret i64 %3
}
/* Variables and functions */
int mapif_party_message(int, int, char const *, size_t);
int mapif_parse_PartyMessage(int fd, int party_id, int account_id,
                             const char *mes, size_t len) {
  return mapif_party_message(party_id, account_id, mes, len);
}


x86 assembly (clang, -O0):
<mapif_parse_PartyMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <mapif_party_message@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_parse_PartyMessage>:
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1030 <mapif_party_message@plt>

LLVM IR (-O0):
define i32 @mapif_parse_PartyMessage(i32 %0, i32 %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = load i8*, i8** %9
%14 = load i64, i64* %10
%15 = call i32 @mapif_party_message(i32 %11, i32 %12, i8* %13, i64 %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @mapif_parse_PartyMessage(i32 %0, i32 %1, i32 %2, i8* %3, i64 %4) {
%6 = tail call i32 @mapif_party_message(i32 %1, i32 %2, i8* %3, i64 %4)
ret i32 %6
}
void _Block_do_nothing(const void *aBlock) {}


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

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

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

LLVM IR (-O2):
define void @_Block_do_nothing(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ta_oom_b(int /*<<< orphan*/);
char *ta_strdup(void *, char const *);
char *ta_xstrdup(void *ta_parent, const char *str) {
  char *res = ta_strdup(ta_parent, str);
  ta_oom_b(res || !str);
  return res;
}


x86 assembly (clang, -O0):
<ta_xstrdup>:
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 <ta_strdup@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jne    115e <ta_xstrdup+0x3e>
cmpq   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ta_oom_b@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <ta_strdup@plt>
mov    %rax,%r14
test   %rax,%rax
setne  %al
test   %rbx,%rbx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1040 <ta_oom_b@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @ta_xstrdup(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @ta_strdup(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
%14 = xor i1 %13, true
br label %15
15: ; preds = %11, %2
%16 = phi i1 [ true, %2 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
%18 = call i32 @ta_oom_b(i32 %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @ta_xstrdup(i8* %0, i8* %1) {
%3 = tail call i8* @ta_strdup(i8* %0, i8* %1)
%4 = icmp ne i8* %3, null
%5 = icmp eq i8* %1, null
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
%8 = tail call i32 @ta_oom_b(i32 %7)
ret i8* %3
}
int utl_isdigit(char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<utl_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <utl_isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @utl_isdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @utl_isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int up_boot_secondary(int cpu, struct task_struct *idle) { return 0; }


x86 assembly (clang, -O0):
<up_boot_secondary>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.task_struct = type opaque
define i32 @up_boot_secondary(i32 %0, %struct.task_struct* %1) {
%3 = alloca i32
%4 = alloca %struct.task_struct*
store i32 %0, i32* %3
store %struct.task_struct* %1, %struct.task_struct** %4
ret i32 0
}

LLVM IR (-O2):
%struct.task_struct = type opaque
define i32 @up_boot_secondary(i32 %0, %struct.task_struct* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n = 10;
  int i = 1;
  for (i = 1; i < 10; i++) {
    n = n * i;
  }
  printf("10! = %d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1156 <main+0x46>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xea0(%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
mov    $0x375f00,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"10! = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3628800)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ndsctl_action(char *, char *, char *);
void ndsctl_loglevel(void) {
  ndsctl_action("loglevel", "Log level set to %s.\n",
                "Failed to set log level to %s.\n");
}


x86 assembly (clang, -O0):
<ndsctl_loglevel>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee7(%rip),%rsi
lea    0xef6(%rip),%rdx
call   1030 <ndsctl_action@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndsctl_loglevel>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0xefa(%rip),%rdx
jmp    1030 <ndsctl_action@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"loglevel\00"
@.str.1 = [22 x i8] c"Log level set to %s.\0A\00"
@.str.2 = [32 x i8] c"Failed to set log level to %s.\0A\00"
define void @ndsctl_loglevel() {
%1 = call i32 @ndsctl_action(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"loglevel\00"
@.str.1 = [22 x i8] c"Log level set to %s.\0A\00"
@.str.2 = [32 x i8] c"Failed to set log level to %s.\0A\00"
define void @ndsctl_loglevel() {
%1 = tail call i32 @ndsctl_action(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int memcmp(char *, char *, unsigned int);
int strrcmp(char *s, unsigned int slen, char *sub, unsigned int sublen) {
  if (sublen > slen)
    return 1;
  return memcmp(s + slen - sublen, sub, sublen);
}


x86 assembly (clang, -O0):
<strrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jbe    113e <strrcmp+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1164 <strrcmp+0x54>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
add    %rax,%rdi
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %rcx,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrcmp>:
cmp    %esi,%ecx
jbe    111a <strrcmp+0xa>
mov    $0x1,%eax
ret
mov    %esi,%eax
add    %rax,%rdi
mov    %ecx,%eax
sub    %rax,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @strrcmp(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp ugt i32 %3, %1
br i1 %5, label %13, label %6
6: ; preds = %4
%7 = zext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = zext i32 %3 to i64
%10 = sub nsw i64 0, %9
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = tail call i32 @memcmp(i8* %11, i8* %2, i32 %3)
br label %13
13: ; preds = %4, %6
%14 = phi i32 [ %12, %6 ], [ 1, %4 ]
ret i32 %14
}
/* Variables and functions */
float dt_fast_expf(float);
float calcBlendFactor(float val, float threshold) {
  return 1.0f / (1.0f + dt_fast_expf(16.0f - (16.0f / threshold) * val));
}


x86 assembly (clang, -O0):
<calcBlendFactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xeda(%rip),%xmm0
divss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xeb7(%rip),%xmm1
addss  %xmm1,%xmm0
call   1030 <dt_fast_expf@plt>
movss  0xea2(%rip),%xmm1
addss  %xmm0,%xmm1
movss  0xe96(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcBlendFactor>:
push   %rax
movss  0xee7(%rip),%xmm2
divss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  0xedb(%rip),%xmm0
call   1030 <dt_fast_expf@plt>
movss  0xed2(%rip),%xmm1
addss  %xmm1,%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @calcBlendFactor(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fdiv float 1.600000e+01, %5
%7 = load float, float* %3
%8 = fneg float %6
%9 = call float @llvm.fmuladd.f32(float %8, float %7, float 1.600000e+01)
%10 = call float @dt_fast_expf(float %9)
%11 = fadd float 1.000000e+00, %10
%12 = fdiv float 1.000000e+00, %11
ret float %12
}

LLVM IR (-O2):
define float @calcBlendFactor(float %0, float %1) {
%3 = fdiv float -1.600000e+01, %1
%4 = tail call float @llvm.fmuladd.f32(float %3, float %0, float 1.600000e+01)
%5 = tail call float @dt_fast_expf(float %4)
%6 = fadd float %5, 1.000000e+00
%7 = fdiv float 1.000000e+00, %6
ret float %7
}
int compare(int a[], int b[], int n) {
  int i;
  for (i = 0; i < n; i++)
    if (a[i] > b[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <compare+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    114a <compare+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1164 <compare+0x64>
jmp    114f <compare+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <compare+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    $0x1,%eax
test   %edx,%edx
jle    1121 <compare+0x21>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rdi,%rdx,4),%ecx
cmp    (%rsi,%rdx,4),%ecx
jg     1122 <compare+0x22>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <compare+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp sgt i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %17, label %7
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ socketIN;

/* Variables and functions */
int getsockname(int, struct sockaddr *, int *);
int ntohs(int /*<<< orphan*/);
int srcTcpSocket_port(int socketFD) {
  struct sockaddr_in socketIN;
  socklen_t len = sizeof(socketIN);
  if (getsockname(socketFD, (struct sockaddr *)&socketIN, &len) == -1) {
    return -1;
  } else {
    return ntohs(socketIN.sin_port);
  }
}


x86 assembly (clang, -O0):
<srcTcpSocket_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <getsockname@plt>
cmp    $0xffffffff,%eax
jne    1157 <srcTcpSocket_port+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <srcTcpSocket_port+0x42>
mov    -0x10(%rbp),%edi
call   1030 <ntohs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srcTcpSocket_port>:
push   %rax
movl   $0x4,0x4(%rsp)
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1040 <getsockname@plt>
cmp    $0xffffffff,%eax
je     1145 <srcTcpSocket_port+0x25>
mov    (%rsp),%edi
call   1030 <ntohs@plt>
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @srcTcpSocket_port(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
store i32 %0, i32* %3
store i32 4, i32* %5
%6 = load i32, i32* %3
%7 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%8 = call i32 @getsockname(i32 %6, %struct.sockaddr* %7, i32* %5)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %15
11: ; preds = %1
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @ntohs(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @srcTcpSocket_port(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%7 = call i32 @getsockname(i32 %0, %struct.sockaddr* %6, i32* %3)
%8 = icmp eq i32 %7, -1
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @ntohs(i32 %11)
br label %13
13: ; preds = %1, %9
%14 = phi i32 [ %12, %9 ], [ -1, %1 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int sigtimedwait(int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *);
int sigwaitinfo(const sigset_t *mask, siginfo_t *si) {
  return sigtimedwait(mask, si, NULL);
}


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

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

LLVM IR (-O0):
define i32 @sigwaitinfo(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 @sigtimedwait(i32* %5, i32* %6, i32* null)
ret i32 %7
}

LLVM IR (-O2):
define i32 @sigwaitinfo(i32* %0, i32* %1) {
%3 = tail call i32 @sigtimedwait(i32* %0, i32* %1, i32* null)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void FBfree(void *p) { (void)free(p); }


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

x86 assembly (clang, -O2):
<FBfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @FBfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int IsAnyOf(char c, char *string) {
  size_t i;
  i = 0;
  while (string[i] != 0) {
    if (c == string[i])
      return 1;
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<IsAnyOf>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <IsAnyOf+0x60>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    114f <IsAnyOf+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1167 <IsAnyOf+0x67>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1116 <IsAnyOf+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsAnyOf>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <IsAnyOf+0x20>
add    $0x1,%rsi
nopl   0x0(%rax)
cmp    %dil,%cl
je     1121 <IsAnyOf+0x21>
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <IsAnyOf+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @IsAnyOf(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %1, i64 %13
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2, %5
%10 = phi i8 [ %7, %5 ], [ %3, %2 ]
%11 = phi i64 [ %13, %5 ], [ 0, %2 ]
%12 = icmp eq i8 %10, %0
%13 = add i64 %11, 1
br i1 %12, label %14, label %5
14: ; preds = %9, %5, %2
%15 = phi i32 [ 0, %2 ], [ 0, %5 ], [ 1, %9 ]
ret i32 %15
}
/* Variables and functions */
long snowflake_id();
long int get_new_id() { return snowflake_id(); }


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

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

LLVM IR (-O0):
define i64 @get_new_id() {
%1 = call i64 (...) @snowflake_id()
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_new_id() {
%1 = tail call i64 (...) @snowflake_id()
ret i64 %1
}