xunge/DecIR huggingface dataset:
/* Variables and functions */
int IPPROTO_TCP;
int IPPROTO_UDP;
scalar_t__ strcmp(char const *, char *);
int proto_atoi(const char *protocol) {
  int proto = IPPROTO_TCP;
  if (strcmp(protocol, "UDP") == 0)
    proto = IPPROTO_UDP;
  return proto;
}


x86 assembly (clang, -O0):
<proto_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    114e <proto_atoi+0x3e>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proto_atoi>:
push   %rbx
mov    0x2ed0(%rip),%rax
mov    (%rax),%ebx
lea    0xedf(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1134 <proto_atoi+0x24>
mov    0x2e9e(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@.str = [4 x i8] c"UDP\00"
@IPPROTO_UDP = global i32 0
define i32 @proto_atoi(i8* %0) {
%2 = load i32, i32* @IPPROTO_TCP
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* @IPPROTO_UDP
%6 = select i1 %4, i32 %5, i32 %2
ret i32 %6
}
int ProcessColor2Grey(unsigned char *a, int w, int h) { return 0; }


x86 assembly (clang, -O0):
<ProcessColor2Grey>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ProcessColor2Grey(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
ret i32 0
}

LLVM IR (-O2):
define i32 @ProcessColor2Grey(i8* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
scalar_t__ gdome_extra_exc_new();
unsigned int cgate_gdome_extra_exc_new() {
  return (unsigned int)gdome_extra_exc_new();
}


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

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

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

LLVM IR (-O2):
define i32 @cgate_gdome_extra_exc_new() {
%1 = tail call i64 (...) @gdome_extra_exc_new()
%2 = trunc i64 %1 to i32
ret i32 %2
}
int greatest_among_three(const int num1, const int num2, const int num3) {
  int result = 0;
  if (num1 > num2) {
    if (num1 > num3) {
      result = num1;
    } else {
      result = num3;
    }
  } else if (num2 > num3) {
    result = num2;
  } else {
    result = num3;
  }
  return result;
}


x86 assembly (clang, -O0):
<greatest_among_three>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1142 <greatest_among_three+0x42>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1137 <greatest_among_three+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    113d <greatest_among_three+0x3d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <greatest_among_three+0x64>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1159 <greatest_among_three+0x59>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    115f <greatest_among_three+0x5f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <greatest_among_three+0x64>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<greatest_among_three>:
mov    %edx,%eax
cmp    %edx,%edi
cmovg  %edi,%eax
cmp    %esi,%eax
cmovle %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @greatest_among_three(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %2
%5 = select i1 %4, i32 %0, i32 %2
%6 = icmp sgt i32 %5, %1
%7 = select i1 %6, i32 %5, i32 %1
ret i32 %7
}
/* Variables and functions */
double M_PI;
double cos(double);
double dv_dy(double L, double a_vy, double v_y, double y) {
  return M_PI * a_vy * v_y * cos(M_PI * a_vy * y / L) / L;
}


x86 assembly (clang, -O0):
<dv_dy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e9b(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dv_dy>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mulsd  (%rax),%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @dv_dy(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* @M_PI
%10 = load double, double* %6
%11 = fmul double %9, %10
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = load double, double* @M_PI
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = load double, double* %8
%18 = fmul double %16, %17
%19 = load double, double* %5
%20 = fdiv double %18, %19
%21 = call double @cos(double %20)
%22 = fmul double %13, %21
%23 = load double, double* %5
%24 = fdiv double %22, %23
ret double %24
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dv_dy(double %0, double %1, double %2, double %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, %1
%7 = fmul double %6, %2
%8 = fmul double %6, %3
%9 = fdiv double %8, %0
%10 = tail call double @cos(double %9)
%11 = fmul double %10, %7
%12 = fdiv double %11, %0
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M218_f(char *s) {
  debug("M218_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M218_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M218_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M218_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M218_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M218_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M218_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
char *procprt_NOTAVAIL_4(struct tstat *curstat, int avgval, int nsecs) {
  return "   ?";
}


x86 assembly (clang, -O0):
<procprt_NOTAVAIL_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<procprt_NOTAVAIL_4>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
%struct.tstat = type opaque
@.str = [5 x i8] c" ?\00"
define i8* @procprt_NOTAVAIL_4(%struct.tstat* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tstat*
%5 = alloca i32
%6 = alloca i32
store %struct.tstat* %0, %struct.tstat** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tstat = type opaque
@.str = [5 x i8] c" ?\00"
define i8* @procprt_NOTAVAIL_4(%struct.tstat* nocapture readnone %0, i32 %1, i32 %2) {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *get_extension(const char *path) {
  const char *dot = strrchr(path, '.');
  if (!dot || dot == path)
    return "";
  return dot + 1;
}


x86 assembly (clang, -O0):
<get_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1147 <get_extension+0x37>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1157 <get_extension+0x47>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1163 <get_extension+0x53>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_extension>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
cmp    %rbx,%rax
lea    0xed4(%rip),%rdx
cmove  %rdx,%rcx
test   %rax,%rax
cmove  %rdx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @get_extension(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9, %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
br label %17
17: ; preds = %14, %13
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @get_extension(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = icmp eq i8* %2, %0
%5 = or i1 %3, %4
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6
ret i8* %7
}
int test_imm_51int8_reg(signed char val) {
  return ((val) & (0x51 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_51int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 81
%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_51int8_reg(i8 signext %0) {
%2 = and i8 %0, 81
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void asn1_const_Finish(void) {}


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

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

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

LLVM IR (-O2):
define void @asn1_const_Finish() {
ret void
}
int execute_eventfd() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_eventfd() {
ret i32 0
}
/* Variables and functions */
scalar_t__ opendir(char const *);
unsigned int g_dir_open(const char *dir_name) {
  return (unsigned int)opendir(dir_name);
}


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

x86 assembly (clang, -O2):
<g_dir_open>:
jmp    1030 <opendir@plt>

LLVM IR (-O0):
define i32 @g_dir_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @opendir(i8* %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @g_dir_open(i8* %0) {
%2 = tail call i64 @opendir(i8* %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *pname) {
  fprintf(stderr, "usage: %s <landing probability> <takeoff probability>\n",
          pname);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [55 x i8] c"usage: %s <landing probability> <takeoff probability>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [55 x i8] c"usage: %s <landing probability> <takeoff probability>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned int leading_zero_num3(unsigned int x) {
  unsigned int y;
  unsigned int nr, c;
  nr = 32;
  c = 16;
  do {
    y = x >> c;
    if (y) {
      nr -= c;
      x = y;
    }
    c >>= 1;
  } while (c);
  return nr - x;
}


x86 assembly (clang, -O0):
<leading_zero_num3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x20,-0xc(%rbp)
movl   $0x10,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113b <leading_zero_num3+0x3b>
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1115 <leading_zero_num3+0x15>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leading_zero_num3>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %ecx,%ecx
cmp    $0x10000,%edi
cmovb  %edi,%eax
setb   %cl
shl    $0x4,%ecx
mov    %eax,%edx
shr    $0x8,%edx
xor    %esi,%esi
cmp    $0x100,%eax
setb   %sil
cmovb  %eax,%edx
lea    (%rcx,%rsi,8),%eax
mov    %edx,%ecx
shr    $0x4,%ecx
xor    %esi,%esi
cmp    $0x10,%edx
setb   %sil
lea    (%rax,%rsi,4),%eax
cmovb  %edx,%ecx
mov    %ecx,%edx
shr    $0x2,%edx
xor    %esi,%esi
cmp    $0x4,%ecx
setb   %sil
cmovb  %ecx,%edx
xor    %ecx,%ecx
cmp    $0x2,%edx
setae  %cl
shr    %cl,%edx
lea    (%rax,%rsi,2),%eax
sub    %ecx,%eax
sub    %edx,%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @leading_zero_num3(i32 %0) {
%2 = lshr i32 %0, 16
%3 = icmp ult i32 %0, 65536
%4 = select i1 %3, i32 %0, i32 %2
%5 = select i1 %3, i32 32, i32 16
%6 = lshr i32 %4, 8
%7 = icmp ult i32 %4, 256
%8 = select i1 %7, i32 %4, i32 %6
%9 = select i1 %7, i32 0, i32 -8
%10 = add nsw i32 %9, %5
%11 = lshr i32 %8, 4
%12 = icmp ult i32 %8, 16
%13 = select i1 %12, i32 %8, i32 %11
%14 = select i1 %12, i32 0, i32 -4
%15 = add nsw i32 %14, %10
%16 = lshr i32 %13, 2
%17 = icmp ult i32 %13, 4
%18 = select i1 %17, i32 %13, i32 %16
%19 = select i1 %17, i32 0, i32 -2
%20 = add nsw i32 %19, %15
%21 = icmp ult i32 %18, 2
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
%24 = lshr i32 %18, %23
%25 = xor i1 %21, true
%26 = sext i1 %25 to i32
%27 = add nsw i32 %20, %26
%28 = sub nsw i32 %27, %24
ret i32 %28
}
int extract_national_decimal_sign(unsigned long dword1, unsigned long dword0) {
  return (dword1 & 0x0ff);
}


x86 assembly (clang, -O0):
<extract_national_decimal_sign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_national_decimal_sign>:
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @extract_national_decimal_sign(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 = and i64 %5, 255
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @extract_national_decimal_sign(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = and i32 %3, 255
ret i32 %4
}
/* Type definitions */
struct bitstream_writer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct bitstream_writer *);
void free_bitstream_writer(struct bitstream_writer *bs) { free(bs); }


x86 assembly (clang, -O0):
<free_bitstream_writer>:
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):
<free_bitstream_writer>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.bitstream_writer = type { i32 }
define void @free_bitstream_writer(%struct.bitstream_writer* %0) {
%2 = alloca %struct.bitstream_writer*
store %struct.bitstream_writer* %0, %struct.bitstream_writer** %2
%3 = load %struct.bitstream_writer*, %struct.bitstream_writer** %2
%4 = call i32 @free(%struct.bitstream_writer* %3)
ret void
}

LLVM IR (-O2):
%struct.bitstream_writer = type { i32 }
define void @free_bitstream_writer(%struct.bitstream_writer* nocapture %0) {
%2 = tail call i32 @free(%struct.bitstream_writer* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
__attribute__((always_)) void BME_BFI_H(volatile uint16_t *addr,
                                        register uint16_t wdata, uint8_t bit,
                                        uint8_t width) {
  *(volatile uint16_t *)((uint32_t)addr | (1 << 28) | (bit << 23) |
                         ((width - 1) << 19)) = wdata;
}


x86 assembly (clang, -O0):
<BME_BFI_H>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
or     $0x10000000,%eax
mov    -0x10(%rbp),%edx
shl    $0x17,%edx
or     %edx,%eax
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
shl    $0x13,%edx
or     %edx,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BME_BFI_H>:
shl    $0x17,%edx
shl    $0x13,%ecx
add    $0xfff80000,%ecx
or     %edi,%edx
or     %ecx,%edx
movslq %edx,%rax
or     $0x10000000,%rax
mov    %esi,(%rax)
ret

LLVM IR (-O0):
define void @BME_BFI_H(i32* %0, i32 %1, i32 %2, i32 %3) {
%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 %3, i32* %8
%9 = load i32, i32* %6
%10 = load i32*, i32** %5
%11 = ptrtoint i32* %10 to i32
%12 = or i32 %11, 268435456
%13 = load i32, i32* %7
%14 = shl i32 %13, 23
%15 = or i32 %12, %14
%16 = load i32, i32* %8
%17 = sub nsw i32 %16, 1
%18 = shl i32 %17, 19
%19 = or i32 %15, %18
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 %9, i32* %21
ret void
}

LLVM IR (-O2):
define void @BME_BFI_H(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = ptrtoint i32* %0 to i64
%6 = trunc i64 %5 to i32
%7 = shl i32 %2, 23
%8 = shl i32 %3, 19
%9 = add i32 %8, -524288
%10 = or i32 %7, %6
%11 = or i32 %10, %9
%12 = or i32 %11, 268435456
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store volatile i32 %1, i32* %14
ret void
}
unsigned short int
unsignedshortint_ignoring_unsignedlonglong(unsigned short int x,
                                           unsigned long long y) {
  return x;
}


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

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

LLVM IR (-O0):
define zeroext i16 @unsignedshortint_ignoring_unsignedlonglong(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @unsignedshortint_ignoring_unsignedlonglong(i16 returned zeroext %0, i64 %1) {
ret i16 %0
}
/* Variables and functions */
char *tokenParser(char *, char *, int /*<<< orphan*/, char *);
char *swissIDParser(char *header) {
  return tokenParser(header, " \t", 0, "swissIDParser");
}


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

x86 assembly (clang, -O2):
<swissIDParser>:
lea    0xee9(%rip),%rsi
lea    0xee5(%rip),%rcx
xor    %edx,%edx
jmp    1030 <tokenParser@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.1 = [14 x i8] c"swissIDParser\00"
define i8* @swissIDParser(i8* %0) {
%2 = tail call i8* @tokenParser(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
char *__hashmap_alloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
void *__hashmap_key_dup(const void *key) {
  size_t len;
  char *str;
  len = strlen((const char *)key);
  str = __hashmap_alloc(len + 1);
  strcpy(str, (const char *)key);
  return (void *)str;
}


x86 assembly (clang, -O0):
<__hashmap_key_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <__hashmap_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hashmap_key_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <__hashmap_alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @__hashmap_key_dup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @__hashmap_alloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @__hashmap_key_dup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @__hashmap_alloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
scalar_t__ board_is_bone_lt();
int /*<<< orphan*/ board_ti_get_rev();
int /*<<< orphan*/ strncmp(int /*<<< orphan*/, char *, int);
int board_is_bben(void) {
  return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2);
}


x86 assembly (clang, -O0):
<board_is_bben>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <board_is_bone_lt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
je     1176 <board_is_bben+0x46>
mov    $0x0,%al
call   1040 <board_ti_get_rev@plt>
mov    %eax,%edi
lea    0xe9f(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_is_bben>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <board_is_bone_lt@plt>
test   %rax,%rax
je     1160 <board_is_bben+0x30>
xor    %eax,%eax
call   1040 <board_ti_get_rev@plt>
lea    0xeb3(%rip),%rsi
mov    %eax,%edi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"SE\00"
define i32 @board_is_bben() {
%1 = call i64 (...) @board_is_bone_lt()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = call i32 (...) @board_ti_get_rev()
%5 = call i32 @strncmp(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br label %8
8: ; preds = %3, %0
%9 = phi i1 [ false, %0 ], [ %7, %3 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"SE\00"
define i32 @board_is_bben() {
%1 = tail call i64 (...) @board_is_bone_lt()
%2 = icmp eq i64 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32 (...) @board_ti_get_rev()
%5 = tail call i32 @strncmp(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %3, %0
%9 = phi i32 [ 0, %0 ], [ %7, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ echo();
int main() {
  echo();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @echo()
ret i32 0
}
/* Variables and functions */
void *malloc(int);
void *wrap_malloc(int size, int count) { return malloc(size * count); }


x86 assembly (clang, -O0):
<wrap_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrap_malloc>:
imul   %esi,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @wrap_malloc(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 = mul nsw i32 %5, %6
%8 = call i8* @malloc(i32 %7)
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @wrap_malloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i8* @malloc(i32 %3)
ret i8* %4
}
int test_imm_6Duint32_reg(unsigned int val) {
  return ((val) & (0x6D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Duint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x6d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Duint32_reg(i32 %0) {
%2 = and i32 %0, 109
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned short csum_calc_incre(unsigned short old_field,
                               unsigned short new_field,
                               unsigned short old_csum) {
  unsigned long csum = old_csum - (~old_field & 0xFFFF) - new_field;
  csum = (csum >> 16) + (csum & 0xffff);
  csum += (csum >> 16);
  return csum;
}


x86 assembly (clang, -O0):
<csum_calc_incre>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x2(%rbp),%ecx
xor    $0xffffffff,%ecx
and    $0xffff,%ecx
sub    %ecx,%eax
movzwl -0x4(%rbp),%ecx
sub    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
mov    -0x10(%rbp),%rcx
and    $0xffff,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_calc_incre>:
mov    %edx,%eax
not    %edi
movzwl %di,%ecx
mov    %esi,%edx
add    %rcx,%rdx
sub    %rdx,%rax
movzwl %ax,%ecx
mov    %rax,%rdx
shr    $0x10,%rdx
add    %ecx,%edx
mov    %edx,%eax
shr    $0x10,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @csum_calc_incre(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = alloca i64
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%8 = load i16, i16* %6
%9 = zext i16 %8 to i32
%10 = load i16, i16* %4
%11 = zext i16 %10 to i32
%12 = xor i32 %11, -1
%13 = and i32 %12, 65535
%14 = sub nsw i32 %9, %13
%15 = load i16, i16* %5
%16 = zext i16 %15 to i32
%17 = sub nsw i32 %14, %16
%18 = sext i32 %17 to i64
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = lshr i64 %19, 16
%21 = load i64, i64* %7
%22 = and i64 %21, 65535
%23 = add i64 %20, %22
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = lshr i64 %24, 16
%26 = load i64, i64* %7
%27 = add i64 %26, %25
store i64 %27, i64* %7
%28 = load i64, i64* %7
%29 = trunc i64 %28 to i16
ret i16 %29
}

LLVM IR (-O2):
define zeroext i16 @csum_calc_incre(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
%4 = zext i16 %2 to i64
%5 = xor i16 %0, -1
%6 = zext i16 %5 to i64
%7 = zext i16 %1 to i64
%8 = add nuw nsw i64 %7, %6
%9 = sub nsw i64 %4, %8
%10 = lshr i64 %9, 16
%11 = and i64 %9, 65535
%12 = add nuw nsw i64 %10, %11
%13 = lshr i64 %12, 16
%14 = add nuw nsw i64 %13, %12
%15 = trunc i64 %14 to i16
ret i16 %15
}
int _pstdout_states_delete_pointer(void *x, void *key) {
  if (x == key)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_pstdout_states_delete_pointer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <_pstdout_states_delete_pointer+0x26>
movl   $0x1,-0x4(%rbp)
jmp    112d <_pstdout_states_delete_pointer+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_pstdout_states_delete_pointer(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_0Fuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x0F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Fuint64_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, 15
%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_0Fuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
void serial_clear_FIFO_(unsigned char volatile *);
void serial_clear_FIFO(int channel) {
  if (channel == 0)
    return serial_clear_FIFO_(((volatile unsigned char *)0xE000C000));
  if (channel == 1)
    return serial_clear_FIFO_(((volatile unsigned char *)0xE0010000));
}


x86 assembly (clang, -O0):
<serial_clear_FIFO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1134 <serial_clear_FIFO+0x24>
mov    $0xe000c000,%edi
call   1030 <serial_clear_FIFO_@plt>
jmp    1148 <serial_clear_FIFO+0x38>
cmpl   $0x1,-0x4(%rbp)
jne    1148 <serial_clear_FIFO+0x38>
mov    $0xe0010000,%edi
call   1030 <serial_clear_FIFO_@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_clear_FIFO>:
mov    %edi,%eax
mov    $0xe000c000,%edi
test   %eax,%eax
je     1127 <serial_clear_FIFO+0x17>
cmp    $0x1,%eax
jne    112c <serial_clear_FIFO+0x1c>
add    $0x4000,%rdi
jmp    1030 <serial_clear_FIFO_@plt>
ret

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

LLVM IR (-O2):
define void @serial_clear_FIFO(i32 %0) {
switch i32 %0, label %5 [
i32 0, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ inttoptr (i64 3758161920 to i8*), %2 ], [ inttoptr (i64 3758145536 to i8*), %1 ]
tail call void @serial_clear_FIFO_(i8* %4)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int fileSize(FILE *file) {
  fseek(file, 0, SEEK_END);
  int size = ftell(file);
  fseek(file, 0, SEEK_SET);
  return size;
}


x86 assembly (clang, -O0):
<fileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileSize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fileSize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fileSize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
ret i32 %4
}
void pointerExample1(int *ptr1, int *ptr2) { ptr1 = ptr2; }


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

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

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

LLVM IR (-O2):
define void @pointerExample1(i32* nocapture %0, i32* nocapture %1) {
ret void
}
void benchSVML256_DPTrig() {}


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

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

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

LLVM IR (-O2):
define void @benchSVML256_DPTrig() {
ret void
}
/* Variables and functions */
int strncmp(char const *, char const *, int const);
int str_comp_num(const char *a, const char *b, const int num) {
  return strncmp(a, b, num);
}


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

x86 assembly (clang, -O2):
<str_comp_num>:
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @str_comp_num(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
int get_meson_cpu_version(int level) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @get_meson_cpu_version(i32 %0) {
ret i32 -1
}
int compare_int(void *a, void *b) {
  if (*(int *)a == *(int *)b)
    return 0;
  else if (*(int *)a < *(int *)b)
    return -1;
  else
    return 1;
}


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    112a <compare_int+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    114f <compare_int+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1148 <compare_int+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    114f <compare_int+0x4f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int>:
mov    (%rdi),%eax
xor    %ecx,%ecx
xor    %edx,%edx
cmp    (%rsi),%eax
setge  %dl
lea    -0x1(%rdx,%rdx,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = select i1 %8, i32 -1, i32 1
%10 = select i1 %7, i32 0, i32 %9
ret i32 %10
}
int Xclosepl(char *s) {
  (void)s;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @Xclosepl(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int main() {
  int i = 2;
  switch (i) {
  case 1:
    return 1;
  case 2:
    return 2;
  default:
    exit(3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     114b <main+0x3b>
jmp    113a <main+0x2a>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1157 <main+0x47>
jmp    1163 <main+0x53>
movl   $0x1,-0x4(%rbp)
jmp    116d <main+0x5d>
movl   $0x2,-0x4(%rbp)
jmp    116d <main+0x5d>
mov    $0x3,%edi
call   1030 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %6 [
i32 1, label %4
i32 2, label %5
]
4: ; preds = %0
store i32 1, i32* %1
br label %8
5: ; preds = %0
store i32 2, i32* %1
br label %8
6: ; preds = %0
%7 = call i32 @exit(i32 3)
unreachable
8: ; preds = %5, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
void rop3_120_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D & S;
  stk1 = T ^ stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_120_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_120_0_1>:
mov    (%rdi),%r8b
mov    %r8d,%ecx
and    %sil,%cl
mov    %edx,%eax
not    %al
and    %cl,%al
xor    %dl,%cl
and    %sil,%cl
not    %sil
and    %dl,%sil
and    %r8b,%sil
or     %al,%sil
or     %cl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_120_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = xor i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = load i8, i8* %5
%25 = zext i8 %24 to i32
%26 = and i32 %23, %25
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %6
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = and i32 %28, %31
%33 = or i32 %26, %32
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = load i8, i8* %5
%37 = zext i8 %36 to i32
%38 = xor i32 %37, -1
%39 = and i32 %35, %38
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = and i32 %39, %42
%44 = or i32 %33, %43
%45 = trunc i32 %44 to i8
%46 = load i8*, i8** %4
store i8 %45, i8* %46
ret void
}

LLVM IR (-O2):
define void @rop3_120_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = xor i8 %5, %2
%7 = and i8 %6, %1
%8 = xor i8 %2, -1
%9 = and i8 %5, %8
%10 = xor i8 %1, -1
%11 = and i8 %10, %2
%12 = and i8 %11, %4
%13 = or i8 %9, %12
%14 = or i8 %13, %7
store i8 %14, i8* %0
ret void
}