xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void handler(int s) {
  printf("time out!\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"time out!\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [10 x i8] c"time out!\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int ether_snif();
int main(void) { return (ether_snif()); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ether_snif()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ APP_Debug_Initialize();
int /*<<< orphan*/ BTSTACK_Initialize();
void APP_Initialize(void) {
  APP_Debug_Initialize();
  BTSTACK_Initialize();
}


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

x86 assembly (clang, -O2):
<APP_Initialize>:
push   %rax
xor    %eax,%eax
call   1040 <APP_Debug_Initialize@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <BTSTACK_Initialize@plt>

LLVM IR (-O0):
define void @APP_Initialize() {
%1 = call i32 (...) @APP_Debug_Initialize()
%2 = call i32 (...) @BTSTACK_Initialize()
ret void
}

LLVM IR (-O2):
define void @APP_Initialize() {
%1 = tail call i32 (...) @APP_Debug_Initialize()
%2 = tail call i32 (...) @BTSTACK_Initialize()
ret void
}
int toascii(c)
int c;
{ return (c & 0x7F); }


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

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
void hge_not_print(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @hge_not_print(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void main() {
  char *string = "I love China!";
  printf("%s\n", string);
}


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

x86 assembly (clang, -O2):
<main>:
lea    0xef7(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"I love China!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
int g_DUMMY_scrollbar_get_zoom(int win_id, int vp_id, float *zoomx,
                               float *zoomy) {
  win_id = win_id;
  vp_id = vp_id;
  *zoomx = 1.0;
  *zoomy = 1.0;
  return 0;
}


x86 assembly (clang, -O0):
<g_DUMMY_scrollbar_get_zoom>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movss  0xed6(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  0xec6(%rip),%xmm0
movss  %xmm0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_DUMMY_scrollbar_get_zoom>:
movl   $0x3f800000,(%rdx)
movl   $0x3f800000,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @g_DUMMY_scrollbar_get_zoom(i32 %0, i32 %1, float* %2, float* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca float*
%8 = alloca float*
store i32 %0, i32* %5
store i32 %1, i32* %6
store float* %2, float** %7
store float* %3, float** %8
%9 = load i32, i32* %5
store i32 %9, i32* %5
%10 = load i32, i32* %6
store i32 %10, i32* %6
%11 = load float*, float** %7
store float 1.000000e+00, float* %11
%12 = load float*, float** %8
store float 1.000000e+00, float* %12
ret i32 0
}

LLVM IR (-O2):
define i32 @g_DUMMY_scrollbar_get_zoom(i32 %0, i32 %1, float* nocapture writeonly %2, float* nocapture writeonly %3) {
store float 1.000000e+00, float* %2
store float 1.000000e+00, float* %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
scalar_t__ smalloc(int);
int strlen(char const *);
char *string_dup(const char *s) {
  int sl = strlen(s);
  char *ns = (char *)smalloc(sl + 1);
  memcpy(ns, s, sl);
  ns[sl] = '\0';
  return ns;
}


x86 assembly (clang, -O0):
<string_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <smalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_dup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <smalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @string_dup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i64 @smalloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = call i32 @memcpy(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %4
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @string_dup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @smalloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %2)
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
double rad2deg(double x) { return x * 57.29577951308232; }


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

x86 assembly (clang, -O2):
<rad2deg>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @rad2deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x404CA5DC1A63C1F8
ret double %4
}

LLVM IR (-O2):
define double @rad2deg(double %0) {
%2 = fmul double %0, 0x404CA5DC1A63C1F8
ret double %2
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct datafile_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_sort(struct genlist *,
                                int (*)(void const *, void const *));
void datafile_list_sort(struct datafile_list *tthis,
                        int (*compar)(const struct datafile *const *,
                                      const struct datafile *const *)) {
  genlist_sort(((struct genlist *)(tthis)),
               (int (*)(const void *, const void *))compar);
}


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

x86 assembly (clang, -O2):
<datafile_list_sort>:
jmp    1030 <genlist_sort@plt>

LLVM IR (-O0):
%struct.datafile_list = type { i32 }
%struct.datafile = type opaque
%struct.genlist = type { i32 }
define void @datafile_list_sort(%struct.datafile_list* %0, i32 (%struct.datafile**, %struct.datafile**)* %1) {
%3 = alloca %struct.datafile_list*
%4 = alloca i32 (%struct.datafile**, %struct.datafile**)*
store %struct.datafile_list* %0, %struct.datafile_list** %3
store i32 (%struct.datafile**, %struct.datafile**)* %1, i32 (%struct.datafile**, %struct.datafile**)** %4
%5 = load %struct.datafile_list*, %struct.datafile_list** %3
%6 = bitcast %struct.datafile_list* %5 to %struct.genlist*
%7 = load i32 (%struct.datafile**, %struct.datafile**)*, i32 (%struct.datafile**, %struct.datafile**)** %4
%8 = bitcast i32 (%struct.datafile**, %struct.datafile**)* %7 to i32 (i8*, i8*)*
%9 = call i32 @genlist_sort(%struct.genlist* %6, i32 (i8*, i8*)* %8)
ret void
}

LLVM IR (-O2):
%struct.datafile_list = type { i32 }
%struct.datafile = type opaque
%struct.genlist = type { i32 }
define void @datafile_list_sort(%struct.datafile_list* %0, i32 (%struct.datafile**, %struct.datafile**)* %1) {
%3 = bitcast %struct.datafile_list* %0 to %struct.genlist*
%4 = bitcast i32 (%struct.datafile**, %struct.datafile**)* %1 to i32 (i8*, i8*)*
%5 = tail call i32 @genlist_sort(%struct.genlist* %3, i32 (i8*, i8*)* %4)
ret void
}
void INT_Excep_PERIB_INTB188(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB188() {
ret void
}
void f56(void) {
a:
  ({
    ({ 0; });
    ({
      goto a;
      0;
    });
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f56>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    1104 <f56+0x4>

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

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

LLVM IR (-O2):
define void @f56() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ init_systick(int);
int main() {
  init_systick(10);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <init_systick@plt>
jmp    1129 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <init_systick@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @init_systick(i32 10)
br label %3
3: ; preds = %0, %3
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @init_systick(i32 10)
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int stringStat(char *, int, int *);
int main(void) {
  int count = 0;
  int x = stringStat("test", 2, &count);
  printf("%d\n", x);
  printf("%d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x2,%esi
lea    -0x8(%rbp),%rdx
call   1040 <stringStat@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    $0x2,%esi
call   1040 <stringStat@plt>
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @stringStat(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2, i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int os2_nettchk(void) { return (-1); }


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

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

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

LLVM IR (-O2):
define i32 @os2_nettchk() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void sesc_commit_epoch(void) {
  fprintf(stderr, "TLS simulator needed for sesc_commit_epoch\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<sesc_commit_epoch>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sesc_commit_epoch>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"TLS simulator needed for sesc_commit_epoch\0A\00"
define void @sesc_commit_epoch() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"TLS simulator needed for sesc_commit_epoch\0A\00"
define void @sesc_commit_epoch() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ dbg_send_command(int, int *);
int strlen(char const *);
void dbg_print(const char *text) {
  uint32_t msg[3];
  msg[0] = 2;
  msg[1] = (uint32_t)text;
  msg[2] = strlen(text);
  dbg_send_command(0x05, msg);
}


x86 assembly (clang, -O0):
<dbg_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
lea    -0x14(%rbp),%rsi
mov    $0x5,%edi
call   1040 <dbg_send_command@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_print>:
sub    $0x18,%rsp
movl   $0x2,0xc(%rsp)
mov    %edi,0x10(%rsp)
call   1030 <strlen@plt>
mov    %eax,0x14(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x5,%edi
call   1040 <dbg_send_command@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @dbg_print(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i32]
store i8* %0, i8** %2
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32 2, i32* %4
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i32
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 %6, i32* %7
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
store i32 %9, i32* %10
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%12 = call i32 @dbg_send_command(i32 5, i32* %11)
ret void
}

LLVM IR (-O2):
define void @dbg_print(i8* %0) {
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 2, i32* %4
%5 = ptrtoint i8* %0 to i64
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 %6, i32* %7
%8 = tail call i32 @strlen(i8* %0)
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 %8, i32* %9
%10 = call i32 @dbg_send_command(i32 5, i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_mempool_free() {
  printf("NOT IMPLEMENTED:"
         "pa_mempool_free"
         "\n");
}


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

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

LLVM IR (-O2):
@str = [32 x i8] c"NOT IMPLEMENTED:pa_mempool_free\00"
define i32 @pa_mempool_free() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
char *strdup(char *);
char *sub_help_filter(int key, const char *text,
                      void *input __attribute__((unused))) {
  if (key == 0x2000004)
    return strdup("This is some extra text from the sub parser (note that it "
                  "is preceded by a blank line).");
  else
    return (char *)text;
}


x86 assembly (clang, -O0):
<sub_help_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x2000004,-0xc(%rbp)
jne    1145 <sub_help_filter+0x35>
lea    0xec9(%rip),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    114d <sub_help_filter+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_help_filter>:
cmp    $0x2000004,%edi
jne    1124 <sub_help_filter+0x14>
lea    0xee1(%rip),%rdi
jmp    1030 <strdup@plt>
mov    %rsi,%rax
ret

LLVM IR (-O0):
@.str = [88 x i8] c"This is some extra text from the sub parser (note that it is preceded by a blank line).\00"
define i8* @sub_help_filter(i32 %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 33554436
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i8* @strdup(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %4
br label %14
12: ; preds = %3
%13 = load i8*, i8** %6
store i8* %13, i8** %4
br label %14
14: ; preds = %12, %10
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
@.str = [88 x i8] c"This is some extra text from the sub parser (note that it is preceded by a blank line).\00"
define i8* @sub_help_filter(i32 %0, i8* readnone %1, i8* nocapture readnone %2) {
%4 = icmp eq i32 %0, 33554436
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call dereferenceable_or_null(88) i8* @strdup(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %3, %5
%8 = phi i8* [ %6, %5 ], [ %1, %3 ]
ret i8* %8
}
int sync_stq(unsigned char *buff, unsigned char data) {
  buff[0] = buff[1];
  buff[1] = data;
  return buff[0] == 0xA0 && buff[1] == 0xA1;
}


x86 assembly (clang, -O0):
<sync_stq>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa0,%ecx
mov    %al,-0xa(%rbp)
jne    1150 <sync_stq+0x50>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0xa1,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_stq>:
mov    0x1(%rdi),%cl
mov    %cl,(%rdi)
mov    %sil,0x1(%rdi)
xor    $0xa0,%cl
xor    $0xa1,%sil
xor    %eax,%eax
or     %cl,%sil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @sync_stq(i8* nocapture %0, i8 zeroext %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %1, i8* %3
%5 = icmp eq i8 %4, -96
%6 = icmp eq i8 %1, -95
%7 = and i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int atoi_fast(const char *str) {
  int32_t value = 0;
  for (size_t i = 0; str[i] != '\0'; i++) {
    value = (value * 10) + (str[i] - '0');
  }
  return value;
}


x86 assembly (clang, -O0):
<atoi_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1155 <atoi_fast+0x55>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <atoi_fast+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi_fast>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <atoi_fast+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <atoi_fast+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @atoi_fast(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %5
6: ; preds = %1, %6
%7 = phi i8 [ %16, %6 ], [ %2, %1 ]
%8 = phi i64 [ %14, %6 ], [ 0, %1 ]
%9 = phi i32 [ %13, %6 ], [ 0, %1 ]
%10 = sext i8 %7 to i32
%11 = mul nsw i32 %9, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %10
%14 = add i64 %8, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %4, label %6
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgadd(void) { gen("addq\t%rcx,%rax"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"addq\09%rcx,%rax\00"
define void @cgadd() {
%1 = call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"addq\09%rcx,%rax\00"
define void @cgadd() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_23uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x23 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_23uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 150323855360
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void *test_anti_range_86(signed char n) {
  extern void *alloc_anti_range_86(signed char) __attribute__((alloc_size(1)));
  if (0x7f - 2 <= n && n <= 0x7f - 1)
    n = 0x7f - 2 - 1;
  return alloc_anti_range_86(n);
}


x86 assembly (clang, -O0):
<test_anti_range_86>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x7d,%eax
cmp    %ecx,%eax
jg     1140 <test_anti_range_86+0x30>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
jg     1140 <test_anti_range_86+0x30>
movb   $0x7c,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <alloc_anti_range_86@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_86>:
lea    -0x7d(%rdi),%eax
cmp    $0x2,%al
mov    $0x7c,%eax
cmovb  %eax,%edi
jmp    1030 <alloc_anti_range_86@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_86(i8 signext %0) {
%2 = add i8 %0, -125
%3 = icmp ult i8 %2, 2
%4 = select i1 %3, i8 124, i8 %0
%5 = tail call i8* @alloc_anti_range_86(i8 signext %4)
ret i8* %5
}
/* Type definitions */
typedef scalar_t__ wint_t;

/* Variables and functions */
int isxdigit(scalar_t__);
int iswxdigit(wint_t wc) { return ((wc < (wint_t)0x100 ? isxdigit(wc) : 0)); }


x86 assembly (clang, -O0):
<iswxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x100,-0x8(%rbp)
jge    113b <iswxdigit+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <isxdigit@plt>
mov    %eax,-0xc(%rbp)
jmp    1145 <iswxdigit+0x35>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <iswxdigit+0x35>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswxdigit>:
cmp    $0xff,%rdi
jg     111e <iswxdigit+0xe>
jmp    1030 <isxdigit@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @iswxdigit(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 256
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i32 @isxdigit(i64 %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @iswxdigit(i64 %0) {
%2 = icmp slt i64 %0, 256
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @isxdigit(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
bool san_has_promotion(const char *SAN) {
  for (const char *ptr = SAN; *ptr != '\0' && *ptr != ' '; ptr++)
    if (*ptr == '=')
      return true;
  return false;
}


x86 assembly (clang, -O0):
<san_has_promotion>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1135 <san_has_promotion+0x35>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1145 <san_has_promotion+0x45>
jmp    1177 <san_has_promotion+0x77>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1161 <san_has_promotion+0x61>
movl   $0x1,-0x4(%rbp)
jmp    117e <san_has_promotion+0x7e>
jmp    1166 <san_has_promotion+0x66>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <san_has_promotion+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<san_has_promotion>:
movzbl (%rdi),%eax
test   %al,%al
je     1115 <san_has_promotion+0x15>
cmp    $0x20,%al
je     1115 <san_has_promotion+0x15>
cmp    $0x3d,%al
je     1118 <san_has_promotion+0x18>
add    $0x1,%rdi
jmp    1100 <san_has_promotion>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @san_has_promotion(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 32, label %7
i8 61, label %8
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 0, %7 ], [ 1, %2 ]
ret i32 %9
}
cbuf34(f, n) int f, n;
{ cbuf(f, n, 34); }


x86 assembly (clang, -O0):
<cbuf34>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x22,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf34>:
mov    $0x22,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf34(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 34)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf34(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 34)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int log2i(size_t x) {
  assert(x != 0);
  size_t i = sizeof(size_t) - 1;
  while (!(x & (1 << i))) {
    i--;
  }
  return i;
}


x86 assembly (clang, -O0):
<log2i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movq   $0x7,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1163 <log2i+0x53>
jmp    1174 <log2i+0x64>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1136 <log2i+0x26>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2i>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    $0x8,%ecx
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
test   %rbx,%rax
je     1130 <log2i+0x20>
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @log2i(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
store i64 7, i64* %3
br label %8
8: ; preds = %17, %1
%9 = load i64, i64* %2
%10 = load i64, i64* %3
%11 = trunc i64 %10 to i32
%12 = shl i32 1, %11
%13 = sext i32 %12 to i64
%14 = and i64 %9, %13
%15 = icmp ne i64 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = load i64, i64* %3
%19 = add i64 %18, -1
store i64 %19, i64* %3
br label %8
20: ; preds = %8
%21 = load i64, i64* %3
%22 = trunc i64 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @log2i(i64 %0) {
%2 = icmp ne i64 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i64 [ 7, %1 ], [ %12, %5 ]
%7 = trunc i64 %6 to i32
%8 = shl nuw i32 1, %7
%9 = sext i32 %8 to i64
%10 = and i64 %9, %0
%11 = icmp eq i64 %10, 0
%12 = add i64 %6, -1
br i1 %11, label %5, label %13
13: ; preds = %5
%14 = trunc i64 %6 to i32
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int str2int(char *, int);
int main() {
  printf("35:%d\n", str2int("z", 35));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedf(%rip),%rdi
mov    $0x23,%esi
call   1030 <str2int@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"35:%d\0A\00"
@.str.1 = [2 x i8] c"z\00"
define i32 @main() {
%1 = tail call i32 @str2int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 35)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct perf_event_attr {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_perf_event_open;
int syscall(int /*<<< orphan*/, struct perf_event_attr *, int /*<<< orphan*/,
            int, int, unsigned long);
int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu,
                    int group_fd, unsigned long flags) {
  return syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
}


x86 assembly (clang, -O0):
<perf_event_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perf_event_open>:
mov    %r8,%r9
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.perf_event_attr = type { i32 }
@__NR_perf_event_open = global i32 0
define i32 @perf_event_open(%struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = alloca %struct.perf_event_attr*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
store %struct.perf_event_attr* %0, %struct.perf_event_attr** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i64 %4, i64* %10
%11 = load i32, i32* @__NR_perf_event_open
%12 = load %struct.perf_event_attr*, %struct.perf_event_attr** %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i64, i64* %10
%17 = call i32 @syscall(i32 %11, %struct.perf_event_attr* %12, i32 %13, i32 %14, i32 %15, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.perf_event_attr = type { i32 }
@__NR_perf_event_open = global i32 0
define i32 @perf_event_open(%struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = load i32, i32* @__NR_perf_event_open
%7 = tail call i32 @syscall(i32 %6, %struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4)
ret i32 %7
}
/* Variables and functions */
int InputIsReady();
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdin;
int InputCheck() {
  int ready = InputIsReady();
  if (ready) {
    char c;
    read(fileno(stdin), &c, 1);
    return c;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<InputCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <InputIsReady@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1176 <InputCheck+0x46>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <fileno@plt>
mov    %eax,%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <InputCheck+0x4d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InputCheck>:
push   %rax
xor    %eax,%eax
call   1050 <InputIsReady@plt>
test   %eax,%eax
je     1162 <InputCheck+0x32>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <fileno@plt>
lea    0x7(%rsp),%rsi
mov    %eax,%edi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl 0x7(%rsp),%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @InputCheck() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = call i32 (...) @InputIsReady()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = load i32, i32* @stdin
%9 = call i32 @fileno(i32 %8)
%10 = call i32 @read(i32 %9, i8* %3, i32 1)
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
store i32 %12, i32* %1
br label %14
13: ; preds = %0
store i32 -1, i32* %1
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @InputCheck() {
%1 = alloca i8
%2 = tail call i32 (...) @InputIsReady()
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = load i32, i32* @stdin
%6 = tail call i32 @fileno(i32 %5)
%7 = call i32 @read(i32 %6, i8* %1, i32 1)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
br label %10
10: ; preds = %0, %4
%11 = phi i32 [ %9, %4 ], [ -1, %0 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ do_cpuid(int);
void qsim_out(char i) { do_cpuid((0xff & i) | 0xc501e000); }


x86 assembly (clang, -O0):
<qsim_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
and    $0xff,%edi
or     $0xc501e000,%edi
call   1030 <do_cpuid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsim_out>:
movzbl %dil,%edi
or     $0xc501e000,%edi
jmp    1030 <do_cpuid@plt>

LLVM IR (-O0):
define void @qsim_out(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 255, %4
%6 = or i32 %5, -989732864
%7 = call i32 @do_cpuid(i32 %6)
ret void
}

LLVM IR (-O2):
define void @qsim_out(i8 signext %0) {
%2 = zext i8 %0 to i32
%3 = or i32 %2, -989732864
%4 = tail call i32 @do_cpuid(i32 %3)
ret void
}
/* Variables and functions */
scalar_t__ floor(float);
__attribute__((const)) int itruncf(float x) {
  return (x) < 0 ? (int)-floor(-x) : (int)floor(x);
}


x86 assembly (clang, -O0):
<itruncf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1151 <itruncf+0x41>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <floor@plt>
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
jmp    115e <itruncf+0x4e>
movss  -0x4(%rbp),%xmm0
call   1030 <floor@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itruncf>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    112a <itruncf+0x1a>
xorps  0xee0(%rip),%xmm0
call   1030 <floor@plt>
neg    %rax
pop    %rcx
ret
call   1030 <floor@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @itruncf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float %3, 0.000000e+00
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load float, float* %2
%7 = fneg float %6
%8 = call i64 @floor(float %7)
%9 = sub nsw i64 0, %8
%10 = trunc i64 %9 to i32
br label %15
11: ; preds = %1
%12 = load float, float* %2
%13 = call i64 @floor(float %12)
%14 = trunc i64 %13 to i32
br label %15
15: ; preds = %11, %5
%16 = phi i32 [ %10, %5 ], [ %14, %11 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @itruncf(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = fneg float %0
%5 = tail call i64 @floor(float %4)
%6 = sub nsw i64 0, %5
br label %9
7: ; preds = %1
%8 = tail call i64 @floor(float %0)
br label %9
9: ; preds = %7, %3
%10 = phi i64 [ %6, %3 ], [ %8, %7 ]
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printInt(int *data) { printf("%d\n", *data); }


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

x86 assembly (clang, -O2):
<printInt>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @printInt(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
signed char foo(signed char i, int j) { return i < 0 ? i : i << j; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jge    1126 <foo+0x26>
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <foo+0x32>
movsbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movzbl %dil,%eax
xor    %ecx,%ecx
test   %al,%al
cmovns %esi,%ecx
shl    %cl,%eax
ret

LLVM IR (-O0):
define signext i8 @foo(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
br label %16
11: ; preds = %2
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = load i32, i32* %4
%15 = shl i32 %13, %14
br label %16
16: ; preds = %11, %8
%17 = phi i32 [ %10, %8 ], [ %15, %11 ]
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @foo(i8 signext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = icmp slt i8 %0, 0
%5 = select i1 %4, i32 0, i32 %1
%6 = shl i32 %3, %5
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
int get_exp(float);
int is_denormalized(float f) {
  if (get_exp(f) == 0x00000000) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_denormalized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <get_exp@plt>
cmp    $0x0,%eax
jne    113c <is_denormalized+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <is_denormalized+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_denormalized>:
push   %rax
call   1030 <get_exp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @is_denormalized(float %0) {
%2 = tail call i32 @get_exp(float %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}