xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
int /*<<< orphan*/ led_init();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ serial_init(int);
int /*<<< orphan*/ test_one(int);
void test_core(void) {
  int reg;
  led_init();
  serial_init(115200);
  test_one(1);
  puts("Done\n");
  delay_ms(1000);
  puts("Done\n");
  delay_ms(1000);
  puts("Done\n");
}


x86 assembly (clang, -O0):
<test_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <led_init@plt>
mov    $0x1c200,%edi
call   1070 <serial_init@plt>
mov    $0x1,%edi
call   1050 <test_one@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3e8,%edi
call   1060 <delay_ms@plt>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3e8,%edi
call   1060 <delay_ms@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_core>:
push   %rbx
xor    %eax,%eax
call   1040 <led_init@plt>
mov    $0x1c200,%edi
call   1070 <serial_init@plt>
mov    $0x1,%edi
call   1050 <test_one@plt>
lea    0xe8d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x3e8,%edi
call   1060 <delay_ms@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x3e8,%edi
call   1060 <delay_ms@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Done\0A\00"
define void @test_core() {
%1 = alloca i32
%2 = call i32 (...) @led_init()
%3 = call i32 @serial_init(i32 115200)
%4 = call i32 @test_one(i32 1)
%5 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @delay_ms(i32 1000)
%7 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @delay_ms(i32 1000)
%9 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Done\0A\00"
define void @test_core() {
%1 = tail call i32 (...) @led_init()
%2 = tail call i32 @serial_init(i32 115200)
%3 = tail call i32 @test_one(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @delay_ms(i32 1000)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @delay_ms(i32 1000)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void signalHandler(int sigid) {
  printf("SIGINT is caught!\n");
  printf("Cancelled by user!\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"SIGINT is caught!\0A\00"
@.str.1 = [20 x i8] c"Cancelled by user!\0A\00"
define void @signalHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [18 x i8] c"SIGINT is caught!\00"
@str.2 = [19 x i8] c"Cancelled by user!\00"
define void @signalHandler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ IF_FALSE();
int /*<<< orphan*/ IF_TRUE();
void TEST_IF(int cond) {
  if (cond) {
    IF_TRUE();
  } else {
    IF_FALSE();
  }
}


x86 assembly (clang, -O0):
<TEST_IF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1141 <TEST_IF+0x21>
mov    $0x0,%al
call   1030 <IF_TRUE@plt>
jmp    1148 <TEST_IF+0x28>
mov    $0x0,%al
call   1040 <IF_FALSE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_IF>:
xor    %eax,%eax
test   %edi,%edi
je     112b <TEST_IF+0xb>
jmp    1030 <IF_TRUE@plt>
jmp    1040 <IF_FALSE@plt>

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

LLVM IR (-O2):
define void @TEST_IF(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @IF_TRUE()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @IF_FALSE()
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned long);
void CSLP_Sleep(int ms) { usleep((unsigned long)(ms * 1000)); }


x86 assembly (clang, -O0):
<CSLP_Sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
movslq %eax,%rdi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSLP_Sleep>:
imul   $0x3e8,%edi,%eax
movslq %eax,%rdi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @CSLP_Sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = sext i32 %4 to i64
%6 = call i32 @usleep(i64 %5)
ret void
}

LLVM IR (-O2):
define void @CSLP_Sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = sext i32 %2 to i64
%4 = tail call i32 @usleep(i64 %3)
ret void
}
const char *decNumberVersion(void) { return "decNumber 3.68"; }


x86 assembly (clang, -O0):
<decNumberVersion>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"decNumber 3.68\00"
define i8* @decNumberVersion() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [15 x i8] c"decNumber 3.68\00"
define i8* @decNumberVersion() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
int sys$setddir2(struct _fab *fab, void *err, void *suc) {
  return ({
    unsigned long resultvar;
    register long int _a3 asm("rdx") = (long)(suc);
    register long int _a2 asm("rsi") = (long)(err);
    register long int _a1 asm("rdi") = (long)(fab);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x82\n\t"
                 : "=a"(resultvar)
                 : "i"(31), "r"(_a1), "r"(_a2), "r"(_a3)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$setddir2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x1f,%rax
int    $0x82
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$setddir2>:
mov    $0x1f,%rax
int    $0x82
ret

LLVM IR (-O0):
%struct._fab = type opaque
define i32 @"sys$setddir2"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = alloca %struct._fab*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store %struct._fab* %0, %struct._fab** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %6
%13 = ptrtoint i8* %12 to i64
store i64 %13, i64* %8
%14 = load i8*, i8** %5
%15 = ptrtoint i8* %14 to i64
store i64 %15, i64* %9
%16 = load %struct._fab*, %struct._fab** %4
%17 = ptrtoint %struct._fab* %16 to i64
store i64 %17, i64* %10
%18 = load i64, i64* %10
%19 = load i64, i64* %9
%20 = load i64, i64* %8
%21 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x82\0A\09", "={ax},i,{rdi},{rsi},{rdx},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 31, i64 %18, i64 %19, i64 %20)
store i64 %21, i64* %7
%22 = load i64, i64* %7
store i64 %22, i64* %11
%23 = load i64, i64* %11
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
%struct._fab = type opaque
define i32 @"sys$setddir2"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %2 to i64
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint %struct._fab* %0 to i64
%7 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x82\0A\09", "={ax},i,{rdi},{rsi},{rdx},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 31, i64 %6, i64 %5, i64 %4)
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fftss_init_threads();
void dfftss_init_threads(void) { fftss_init_threads(); }


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

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

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

LLVM IR (-O2):
define void @dfftss_init_threads() {
%1 = tail call i32 (...) @fftss_init_threads()
ret void
}
char *strcat_filename(name, type)
char *name, *type;
{
  char *s;
  s = (char *)malloc(strlen(name) + strlen(type) + 2);
  strcpy(s, name);
  strcat(s, ".");
  strcat(s, type);
  return s;
}


x86 assembly (clang, -O0):
<strcat_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_filename>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movw   $0x2e,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <strcat@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define i8* @strcat_filename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add i64 %7, %9
%11 = add i64 %10, 2
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = call i8* @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = call i8* @strcat(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = load i8*, i8** %5
%19 = load i8*, i8** %4
%20 = call i8* @strcat(i8* %18, i8* %19)
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @strcat_filename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 2
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i8* @strcpy(i8* dereferenceable(1) %7, i8* dereferenceable(1) %0)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %7)
%10 = getelementptr i8, i8* %7, i64 %9
%11 = bitcast i8* %10 to i16*
store i16 46, i16* %11
%12 = tail call i8* @strcat(i8* dereferenceable(1) %7, i8* dereferenceable(1) %1)
ret i8* %7
}
int validate_endl(int x, int y, int *j, int *i) {
  if (*j != x + 1)
    return (1);
  *j = 0;
  *i += 1;
  return (0);
}


x86 assembly (clang, -O0):
<validate_endl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     1132 <validate_endl+0x32>
movl   $0x1,-0x4(%rbp)
jmp    114e <validate_endl+0x4e>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_endl>:
add    $0x1,%edi
mov    $0x1,%eax
cmp    %edi,(%rdx)
jne    1117 <validate_endl+0x17>
movl   $0x0,(%rdx)
addl   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @validate_endl(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %2
%6 = add nsw i32 %0, 1
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
store i32 0, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %4, %8
%12 = phi i32 [ 0, %8 ], [ 1, %4 ]
ret i32 %12
}
void path_024_expected_5(int a, int b, int c) {
  switch (a) {
  case 0:
    if (b) {
    }
    if (c) {
    }
    break;
  case 1:
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<path_024_expected_5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1131 <path_024_expected_5+0x31>
jmp    1120 <path_024_expected_5+0x20>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1154 <path_024_expected_5+0x54>
jmp    1159 <path_024_expected_5+0x59>
cmpl   $0x0,-0x8(%rbp)
je     1140 <path_024_expected_5+0x40>
jmp    1140 <path_024_expected_5+0x40>
cmpl   $0x0,-0xc(%rbp)
je     114f <path_024_expected_5+0x4f>
jmp    114f <path_024_expected_5+0x4f>
jmp    115e <path_024_expected_5+0x5e>
jmp    1159 <path_024_expected_5+0x59>
jmp    115e <path_024_expected_5+0x5e>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @path_024_expected_5(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int core6_safe(char const *);
int U_EMRPOLYBEZIER16_safe(const char *record) { return (core6_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYBEZIER16_safe>:
jmp    1030 <core6_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYBEZIER16_safe(i8* %0) {
%2 = tail call i32 @core6_safe(i8* %0)
ret i32 %2
}
void array_swap(void **a, int i, int j) {
  void *item = a[i];
  a[i] = a[j];
  a[j] = item;
  return;
}


x86 assembly (clang, -O0):
<array_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_swap>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rcx
movslq %edx,%rdx
mov    (%rdi,%rdx,8),%rsi
mov    %rsi,(%rdi,%rax,8)
mov    %rcx,(%rdi,%rdx,8)
ret

LLVM IR (-O0):
define void @array_swap(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8**, i8*** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %7
%13 = load i8**, i8*** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
store i8* %17, i8** %21
%22 = load i8*, i8** %7
%23 = load i8**, i8*** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
store i8* %22, i8** %26
ret void
}

LLVM IR (-O2):
define void @array_swap(i8** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
store i8* %9, i8** %5
store i8* %6, i8** %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RTFDoGroup(int /*<<< orphan*/, int);
void RTFSkipToLevel(int level) { RTFDoGroup(0, level); }


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

x86 assembly (clang, -O2):
<RTFSkipToLevel>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <RTFDoGroup@plt>

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

LLVM IR (-O2):
define void @RTFSkipToLevel(i32 %0) {
%2 = tail call i32 @RTFDoGroup(i32 0, i32 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
unsigned log_sense_param_len(uint8_t *param) { return param[3]; }


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

x86 assembly (clang, -O2):
<log_sense_param_len>:
mov    0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @log_sense_param_len(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @log_sense_param_len(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
ret i32 %3
}
int null_set_record_device(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @null_set_record_device() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_set_sleep_low() {
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (2 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (2 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (1 << 9) | (2 << 5) | (1)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_set_sleep_low>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_set_sleep_low>:
push   %rax
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc241,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_set_sleep_low() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49729)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49729)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49729)
%6 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_set_sleep_low() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49729)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49729)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49729)
%6 = tail call i32 @delay(i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *my_malloc(size_t);
void *my_malloc0(size_t n_bytes) {
  void *mem;
  mem = my_malloc(n_bytes);
  memset(mem, 0, n_bytes);
  return mem;
}


x86 assembly (clang, -O0):
<my_malloc0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_malloc0>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <my_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @my_malloc0(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @my_malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @my_malloc0(i64 %0) {
%2 = tail call i8* @my_malloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int, int);
int main(void) {
  printf("Sum(1, 2)"
         " = [%d]\n",
         (sum((1), (2))));
  return 0;
}


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

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

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

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


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

x86 assembly (clang, -O2):
<gnu_xfree>:
jmp    1030 <gnu_free@plt>

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

LLVM IR (-O2):
define void @gnu_xfree(i8* %0) {
%2 = tail call i32 @gnu_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error0(char *, char *);
void ac_req(int v, char *vv) {
  if (!v) {
    error0("Require Assertion Violated.", vv);
  }
}


x86 assembly (clang, -O0):
<ac_req>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1139 <ac_req+0x29>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <error0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ac_req>:
test   %edi,%edi
je     1115 <ac_req+0x5>
ret
lea    0xee4(%rip),%rdi
jmp    1030 <error0@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Require Assertion Violated.\00"
define void @ac_req(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @error0(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Require Assertion Violated.\00"
define void @ac_req(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @error0(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __le16;

/* Variables and functions */
int /*<<< orphan*/ cpu_to_le16(int);
__le16 dnet_make_mask(int n) {
  if (n) {
    return cpu_to_le16(~((1 << (16 - n)) - 1));
  }
  return cpu_to_le16(0);
}


x86 assembly (clang, -O0):
<dnet_make_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <dnet_make_mask+0x37>
mov    $0x10,%ecx
sub    -0x8(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
sub    $0x1,%edi
xor    $0xffffffff,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,-0x4(%rbp)
jmp    1151 <dnet_make_mask+0x41>
xor    %edi,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnet_make_mask>:
mov    $0x10,%cl
sub    %dil,%cl
mov    $0xffffffff,%eax
shl    %cl,%eax
test   %edi,%edi
cmovne %eax,%edi
jmp    1030 <cpu_to_le16@plt>

LLVM IR (-O0):
define i32 @dnet_make_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = sub nsw i32 16, %7
%9 = shl i32 1, %8
%10 = sub nsw i32 %9, 1
%11 = xor i32 %10, -1
%12 = call i32 @cpu_to_le16(i32 %11)
store i32 %12, i32* %2
br label %15
13: ; preds = %1
%14 = call i32 @cpu_to_le16(i32 0)
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @dnet_make_mask(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = sub nsw i32 16, %0
%4 = shl nsw i32 -1, %3
%5 = select i1 %2, i32 0, i32 %4
%6 = tail call i32 @cpu_to_le16(i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ __send_to_ppe(int, int, int *);
void sync(void) {
  int sys;
  __send_to_ppe(0x2101, 47, &sys);
}


x86 assembly (clang, -O0):
<sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2101,%edi
mov    $0x2f,%esi
lea    -0x4(%rbp),%rdx
call   1030 <__send_to_ppe@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync>:
push   %rax
lea    0x4(%rsp),%rdx
mov    $0x2101,%edi
mov    $0x2f,%esi
call   1030 <__send_to_ppe@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @sync() {
%1 = alloca i32
%2 = call i32 @__send_to_ppe(i32 8449, i32 47, i32* %1)
ret void
}

LLVM IR (-O2):
define void @sync() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @__send_to_ppe(i32 8449, i32 47, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void xyz(void) { printf("        func1-xyz\n"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c" func1-xyz\0A\00"
define void @xyz() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c" func1-xyz\00"
define void @xyz() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
int main() {
  int x;
  x = 0;
  while (1)
    break;
  while (1) {
    if (x == 5) {
      break;
    }
    x = x + 1;
    continue;
  }
  for (;;) {
    if (x == 10) {
      break;
    }
    x = x + 1;
    continue;
  }
  do {
    if (x == 15) {
      break;
    }
    x = x + 1;
    continue;
  } while (1);
  return x - 15;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    1117 <main+0x17>
jmp    111c <main+0x1c>
cmpl   $0x5,-0x8(%rbp)
jne    112b <main+0x2b>
jmp    1139 <main+0x39>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111c <main+0x1c>
jmp    113e <main+0x3e>
cmpl   $0xa,-0x8(%rbp)
jne    114d <main+0x4d>
jmp    115b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <main+0x3e>
jmp    1160 <main+0x60>
cmpl   $0xf,-0x8(%rbp)
jne    116f <main+0x6f>
jmp    1187 <main+0x87>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1160 <main+0x60>
jmp    1187 <main+0x87>
mov    -0x8(%rbp),%eax
sub    $0xf,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int sscanf(char const *, char *, int *);
int arg2int(const char *arg, int min, int max, int defval) {
  int r;
  if (arg == NULL || sscanf(arg, "%d", &r) != 1)
    return defval;
  return r;
}


x86 assembly (clang, -O0):
<arg2int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <arg2int+0x3d>
mov    -0x10(%rbp),%rdi
lea    0xec5(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1158 <arg2int+0x48>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <arg2int+0x4e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg2int>:
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
test   %rdi,%rdi
je     1136 <arg2int+0x26>
lea    0xedd(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
jne    1136 <arg2int+0x26>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @arg2int(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %17, label %13
13: ; preds = %4
%14 = load i8*, i8** %6
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%16 = icmp ne i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %13, %4
%18 = load i32, i32* %9
store i32 %18, i32* %5
br label %21
19: ; preds = %13
%20 = load i32, i32* %10
store i32 %20, i32* %5
br label %21
21: ; preds = %19, %17
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @arg2int(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = icmp eq i8* %0, null
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%10 = icmp eq i32 %9, 1
%11 = load i32, i32* %5
%12 = select i1 %10, i32 %11, i32 %3
br label %13
13: ; preds = %8, %4
%14 = phi i32 [ %3, %4 ], [ %12, %8 ]
ret i32 %14
}
/* Variables and functions */
double tan(double);
double Tan(double a, double b) { return tan(a); }


x86 assembly (clang, -O0):
<Tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <tan@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tan>:
jmp    1030 <tan@plt>

LLVM IR (-O0):
define double @Tan(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @tan(double %5)
ret double %6
}

LLVM IR (-O2):
define double @Tan(double %0, double %1) {
%3 = tail call double @tan(double %0)
ret double %3
}
/* Variables and functions */
char getchar();
char yesno(void) {
  char n;
  while (1) {
    n = getchar();
    if ((n == 'Y') || (n == 'y'))
      return ('Y');
    if ((n == 'N') || (n == 'n'))
      return ('N');
  }
  return ('N');
}


x86 assembly (clang, -O0):
<yesno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x59,%eax
je     113c <yesno+0x2c>
movsbl -0x2(%rbp),%eax
cmp    $0x79,%eax
jne    1145 <yesno+0x35>
movb   $0x59,-0x1(%rbp)
jmp    116d <yesno+0x5d>
movsbl -0x2(%rbp),%eax
cmp    $0x4e,%eax
je     115f <yesno+0x4f>
movsbl -0x2(%rbp),%eax
cmp    $0x6e,%eax
jne    1168 <yesno+0x58>
movb   $0x4e,-0x1(%rbp)
jmp    116d <yesno+0x5d>
jmp    1118 <yesno+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yesno>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
and    $0xdf,%al
cmp    $0x59,%al
je     1131 <yesno+0x21>
cmp    $0x4e,%al
jne    1120 <yesno+0x10>
pop    %rcx
ret

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

LLVM IR (-O2):
define signext i8 @yesno() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = and i8 %2, -33
switch i8 %3, label %1 [
i8 89, label %4
i8 78, label %4
]
4: ; preds = %1, %1
ret i8 %3
}
/* Variables and functions */
char *mem_free(char *);
char *string_free(char *str) { return mem_free(str); }


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

x86 assembly (clang, -O2):
<string_free>:
jmp    1030 <mem_free@plt>

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

LLVM IR (-O2):
define i8* @string_free(i8* %0) {
%2 = tail call i8* @mem_free(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ link_failure();
void t_exit(void) {
  _exit(1);
  link_failure();
}


x86 assembly (clang, -O0):
<t_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<t_exit>:
push   %rax
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @t_exit() {
%1 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @t_exit() {
%1 = tail call i32 @_exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ crc16_ccitt_update(int /*<<< orphan*/, int /*<<< orphan*/);
uint16_t crc16_ccitt_finalize(uint16_t crc) {
  int i;
  for (i = 0; i < 2; i++) {
    crc = crc16_ccitt_update(0, crc);
  }
  return crc;
}


x86 assembly (clang, -O0):
<crc16_ccitt_finalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1147 <crc16_ccitt_finalize+0x37>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <crc16_ccitt_update@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <crc16_ccitt_finalize+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc16_ccitt_finalize>:
push   %rax
mov    %edi,%esi
xor    %edi,%edi
call   1030 <crc16_ccitt_update@plt>
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <crc16_ccitt_update@plt>

LLVM IR (-O0):
define i32 @crc16_ccitt_finalize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @crc16_ccitt_update(i32 0, i32 %8)
store i32 %9, i32* %2
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @crc16_ccitt_finalize(i32 %0) {
%2 = tail call i32 @crc16_ccitt_update(i32 0, i32 %0)
%3 = tail call i32 @crc16_ccitt_update(i32 0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ emitln(char *);
void prolog() { emitln("PROLOG"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"PROLOG\00"
define void @prolog() {
%1 = tail call i32 @emitln(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
int fun1078() { return 1078; }


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

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

LLVM IR (-O0):
define i32 @fun1078() {
ret i32 1078
}

LLVM IR (-O2):
define i32 @fun1078() {
ret i32 1078
}
/* Variables and functions */
int /*<<< orphan*/ gptimer_test(unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ report_end();
int /*<<< orphan*/ report_start();
int main(int argc, char *argv[]) {
  report_start();
  unsigned int address = 0x8000F000;
  unsigned int irq_addr = 0x8001F000;
  unsigned int irq = 8;
  gptimer_test(address, irq, irq_addr);
  report_end();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <report_start@plt>
movl   $0x8000f000,-0x14(%rbp)
movl   $0x8001f000,-0x18(%rbp)
movl   $0x8,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <gptimer_test@plt>
mov    $0x0,%al
call   1040 <report_end@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <report_start@plt>
mov    $0x8000f000,%edi
mov    $0x8,%esi
mov    $0x8001f000,%edx
call   1030 <gptimer_test@plt>
xor    %eax,%eax
call   1040 <report_end@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @report_start()
store i32 -2147422208, i32* %6
store i32 -2147356672, i32* %7
store i32 8, i32* %8
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = call i32 @gptimer_test(i32 %10, i32 %11, i32 %12)
%14 = call i32 (...) @report_end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @report_start()
%4 = tail call i32 @gptimer_test(i32 -2147422208, i32 8, i32 -2147356672)
%5 = tail call i32 (...) @report_end()
ret i32 0
}
int get_len_offset(int r) {
  switch (r) {
  case 0:
    return 18;
  case 1:
    return 22;
  case 2:
    return 26;
  case 3:
    return 30;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_len_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     115c <get_len_offset+0x5c>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x12,-0x4(%rbp)
jmp    1163 <get_len_offset+0x63>
movl   $0x16,-0x4(%rbp)
jmp    1163 <get_len_offset+0x63>
movl   $0x1a,-0x4(%rbp)
jmp    1163 <get_len_offset+0x63>
movl   $0x1e,-0x4(%rbp)
jmp    1163 <get_len_offset+0x63>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_len_offset>:
cmp    $0x4,%edi
lea    0x12(,%rdi,4),%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_len_offset(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
5: ; preds = %1
store i32 18, i32* %2
br label %10
6: ; preds = %1
store i32 22, i32* %2
br label %10
7: ; preds = %1
store i32 26, i32* %2
br label %10
8: ; preds = %1
store i32 30, i32* %2
br label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @get_len_offset(i32 %0) {
%2 = icmp ult i32 %0, 4
%3 = shl i32 %0, 2
%4 = add i32 %3, 18
%5 = select i1 %2, i32 %4, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ w5100_writeRTR(unsigned int);
void w5100_setRetransmissionTime(unsigned timeout) { w5100_writeRTR(timeout); }


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

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

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

LLVM IR (-O2):
define void @w5100_setRetransmissionTime(i32 %0) {
%2 = tail call i32 @w5100_writeRTR(i32 %0)
ret void
}
int valid_beat_duration(int duration) {
  int r;
  if (duration <= 0)
    return 0;
  r = duration;
  while (r != 1) {
    if (r % 2 == 1)
      return 0;
    r /= 2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<valid_beat_duration>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111d <valid_beat_duration+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1167 <valid_beat_duration+0x67>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1160 <valid_beat_duration+0x60>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    114d <valid_beat_duration+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    1167 <valid_beat_duration+0x67>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1123 <valid_beat_duration+0x23>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_beat_duration>:
xor    %eax,%eax
test   %edi,%edi
jle    1134 <valid_beat_duration+0x34>
cmp    $0x1,%edi
je     112f <valid_beat_duration+0x2f>
mov    %edi,%ecx
nopl   (%rax)
shr    $0x1f,%ecx
add    %edi,%ecx
mov    %ecx,%edx
and    $0xfffffffe,%edx
mov    %edi,%esi
sub    %edx,%esi
cmp    $0x1,%esi
je     1134 <valid_beat_duration+0x34>
sar    %ecx
and    $0xfffffffe,%edi
cmp    $0x2,%edi
mov    %ecx,%edi
jne    1110 <valid_beat_duration+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @valid_beat_duration(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 1
br i1 %4, label %13, label %5
5: ; preds = %3, %10
%6 = phi i32 [ %8, %10 ], [ %0, %3 ]
%7 = srem i32 %6, 2
%8 = sdiv i32 %6, 2
%9 = icmp eq i32 %7, 1
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = and i32 %6, -2
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %5
13: ; preds = %5, %10, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %5 ], [ 1, %10 ]
ret i32 %14
}