xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ EEXIST;
scalar_t__ errno;
int link(char *, char *);
extern int lock_txt(void) {
  int respone = 0;
  if (link("txt", "txt.LCK") == -1)
    respone = (errno == EEXIST ? 1 : 2);
  return respone;
}


x86 assembly (clang, -O0):
<lock_txt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <link@plt>
cmp    $0xffffffff,%eax
jne    1162 <lock_txt+0x52>
mov    0x2e96(%rip),%rax
mov    (%rax),%rdx
mov    0x2e94(%rip),%rax
mov    (%rax),%rsi
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lock_txt>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee5(%rip),%rsi
call   1030 <link@plt>
mov    0x2ead(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2eab(%rip),%rdx
xor    %esi,%esi
cmp    (%rdx),%rcx
sete   %sil
mov    $0x2,%edx
sub    %esi,%edx
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"txt\00"
@.str.1 = [8 x i8] c"txt.LCK\00"
@errno = global i64 0
@EEXIST = global i64 0
define i32 @lock_txt() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @link(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @EEXIST
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 2
store i32 %9, i32* %1
br label %10
10: ; preds = %4, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [4 x i8] c"txt\00"
@.str.1 = [8 x i8] c"txt.LCK\00"
@errno = global i64 0
@EEXIST = global i64 0
define i32 @lock_txt() {
%1 = tail call i32 @link(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
%3 = load i64, i64* @errno
%4 = load i64, i64* @EEXIST
%5 = icmp eq i64 %3, %4
%6 = select i1 %5, i32 1, i32 2
%7 = select i1 %2, i32 %6, i32 0
ret i32 %7
}
int test_imm_C1int16_reg(short val) {
  return ((val) & (-0xC1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C1int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff3f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C1int16_reg>:
test   $0xff3f,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C1int16_reg(i16 signext %0) {
%2 = and i16 %0, -193
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void func1(void *arg) {
  puts("1");
  puts("11");
  puts("111");
  puts("1111");
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
push   %rax
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [3 x i8] c"11\00"
@.str.2 = [4 x i8] c"111\00"
@.str.3 = [5 x i8] c"1111\00"
define void @func1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [3 x i8] c"11\00"
@.str.2 = [4 x i8] c"111\00"
@.str.3 = [5 x i8] c"1111\00"
define void @func1(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
char log10(char);
char internal_log10_b(char value) { return log10(value); }


x86 assembly (clang, -O0):
<internal_log10_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <log10@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @internal_log10_b(i8 signext %0) {
%2 = tail call signext i8 @log10(i8 signext %0)
ret i8 %2
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void SysExcIntEnable(uint32_t ui32IntFlags) {
  (*((volatile unsigned long *)(0x400F9004))) |= ui32IntFlags;
}


x86 assembly (clang, -O0):
<SysExcIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x400f9004,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400f9004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysExcIntEnable>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
or     %rax,0x400f9004
40
ret

LLVM IR (-O0):
define void @SysExcIntEnable(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1074761732 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1074761732 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysExcIntEnable(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1074761732 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1074761732 to i64*)
ret void
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *mystrdup(char *s) {
  char *buf;
  if (!(buf = (char *)malloc(strlen(s) + 1)))
    return NULL;
  strcpy(buf, s);
  return buf;
}


x86 assembly (clang, -O0):
<mystrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    116c <mystrdup+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    1181 <mystrdup+0x51>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115a <mystrdup+0x2a>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    115c <mystrdup+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mystrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %1
store i8* null, i8** %2
br label %17
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %4
store i8* %16, i8** %2
br label %17
17: ; preds = %12, %11
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
define i8* @mystrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %1, %7
%10 = phi i8* [ %5, %7 ], [ null, %1 ]
ret i8* %10
}
int stuff2byteuint(unsigned short data, unsigned char *buffer,
                   unsigned short *index) {
  buffer[*index] = (data >> 0) & 0xff;
  *index += 1;
  buffer[*index] = (data >> 8) & 0xff;
  *index += 1;
  return (*index);
}


x86 assembly (clang, -O0):
<stuff2byteuint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
add    $0x1,%ecx
mov    %cx,(%rax)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
add    $0x1,%ecx
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stuff2byteuint>:
mov    %edi,%eax
movzwl (%rdx),%ecx
mov    %al,(%rsi,%rcx,1)
movzwl (%rdx),%ecx
add    $0x1,%ecx
mov    %cx,(%rdx)
movzwl %cx,%ecx
mov    %ah,(%rsi,%rcx,1)
movzwl (%rdx),%eax
add    $0x1,%eax
mov    %ax,(%rdx)
movzwl %ax,%eax
ret

LLVM IR (-O0):
define i32 @stuff2byteuint(i16 zeroext %0, i8* %1, i16* %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i16*
store i16 %0, i16* %4
store i8* %1, i8** %5
store i16* %2, i16** %6
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 0
%10 = and i32 %9, 255
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %5
%13 = load i16*, i16** %6
%14 = load i16, i16* %13
%15 = zext i16 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
store i8 %11, i8* %16
%17 = load i16*, i16** %6
%18 = load i16, i16* %17
%19 = zext i16 %18 to i32
%20 = add nsw i32 %19, 1
%21 = trunc i32 %20 to i16
store i16 %21, i16* %17
%22 = load i16, i16* %4
%23 = zext i16 %22 to i32
%24 = ashr i32 %23, 8
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %5
%28 = load i16*, i16** %6
%29 = load i16, i16* %28
%30 = zext i16 %29 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
store i8 %26, i8* %31
%32 = load i16*, i16** %6
%33 = load i16, i16* %32
%34 = zext i16 %33 to i32
%35 = add nsw i32 %34, 1
%36 = trunc i32 %35 to i16
store i16 %36, i16* %32
%37 = load i16*, i16** %6
%38 = load i16, i16* %37
%39 = zext i16 %38 to i32
ret i32 %39
}

LLVM IR (-O2):
define i32 @stuff2byteuint(i16 zeroext %0, i8* nocapture writeonly %1, i16* nocapture %2) {
%4 = trunc i16 %0 to i8
%5 = load i16, i16* %2
%6 = zext i16 %5 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
store i8 %4, i8* %7
%8 = load i16, i16* %2
%9 = add i16 %8, 1
store i16 %9, i16* %2
%10 = lshr i16 %0, 8
%11 = trunc i16 %10 to i8
%12 = zext i16 %9 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
store i8 %11, i8* %13
%14 = load i16, i16* %2
%15 = add i16 %14, 1
store i16 %15, i16* %2
%16 = zext i16 %15 to i32
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void test_log_fn(int level, int dm_errno, const char *file, int line,
                 const char *format) {
  if (level != 4)
    return;
  printf("%s\n", format);
  return;
}


x86 assembly (clang, -O0):
<test_log_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     1138 <test_log_fn+0x28>
jmp    1148 <test_log_fn+0x38>
mov    -0x20(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_log_fn>:
cmp    $0x4,%edi
jne    1124 <test_log_fn+0x14>
lea    0xee4(%rip),%rdi
mov    %r8,%rsi
jmp    1030 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @test_log_fn(i32 %0, i32 %1, i8* nocapture readnone %2, i32 %3, i8* %4) {
%6 = icmp eq i32 %0, 4
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %9
9: ; preds = %5, %7
ret void
}
void slab_stats(void) {}


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

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

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

LLVM IR (-O2):
define void @slab_stats() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void trata_sigint(int signal) {
  printf("\nSnapstatsd - Recebi e ignorei um sinal SIGINT\n");
}


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

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

LLVM IR (-O0):
@.str = [48 x i8] c"\0ASnapstatsd - Recebi e ignorei um sinal SIGINT\0A\00"
define void @trata_sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [47 x i8] c"\0ASnapstatsd - Recebi e ignorei um sinal SIGINT\00"
define void @trata_sigint(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
ret void
}
double clamp(double a, double min_val, double max_val) {
  return (a < min_val ? min_val : (a > max_val ? max_val : a));
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <clamp+0x36>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1169 <clamp+0x69>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1155 <clamp+0x55>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    115f <clamp+0x5f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @clamp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp olt double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load double, double* %5
br label %22
12: ; preds = %3
%13 = load double, double* %4
%14 = load double, double* %6
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load double, double* %6
br label %20
18: ; preds = %12
%19 = load double, double* %4
br label %20
20: ; preds = %18, %16
%21 = phi double [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi double [ %11, %10 ], [ %21, %20 ]
ret double %23
}

LLVM IR (-O2):
define double @clamp(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
const char *TA_GetVersionTime(void) { return "17:24:07"; }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"17:24:07\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"17:24:07\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int __BNF_trans_string(char *);
int weapon(void) {
  int state;
  do {
    state = __BNF_trans_string("axe");
    if (!state)
      break;
    state = __BNF_trans_string("wand");
    if (!state)
      break;
    state = __BNF_trans_string("rod");
  } while (0);
  return state;
}


x86 assembly (clang, -O0):
<weapon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <__BNF_trans_string@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1136 <weapon+0x26>
jmp    1163 <weapon+0x53>
lea    0xec7(%rip),%rdi
call   1030 <__BNF_trans_string@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1154 <weapon+0x44>
jmp    1163 <weapon+0x53>
lea    0xeae(%rip),%rdi
call   1030 <__BNF_trans_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weapon>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <__BNF_trans_string@plt>
test   %eax,%eax
je     113e <weapon+0x2e>
lea    0xedc(%rip),%rdi
call   1030 <__BNF_trans_string@plt>
test   %eax,%eax
je     113e <weapon+0x2e>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <__BNF_trans_string@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"axe\00"
@.str.1 = [5 x i8] c"wand\00"
@.str.2 = [4 x i8] c"rod\00"
define i32 @weapon() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @__BNF_trans_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %2
br label %14
7: ; preds = %2
%8 = call i32 @__BNF_trans_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
br label %14
12: ; preds = %7
%13 = call i32 @__BNF_trans_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 %13, i32* %1
br label %14
14: ; preds = %12, %11, %6
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"axe\00"
@.str.1 = [5 x i8] c"wand\00"
@.str.2 = [4 x i8] c"rod\00"
define i32 @weapon() {
%1 = tail call i32 @__BNF_trans_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32 @__BNF_trans_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @__BNF_trans_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %3, %0, %6
%9 = phi i32 [ %7, %6 ], [ 0, %3 ], [ 0, %0 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ app(char *);
int /*<<< orphan*/ cls();
int /*<<< orphan*/ println(char *);
void launcher() {
  cls();
  println("************************* PortOS Application Launcher "
          "**************************\n");
  app("Settings");
  app("About");
}


x86 assembly (clang, -O0):
<launcher>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <cls@plt>
lea    0xebe(%rip),%rdi
call   1030 <println@plt>
lea    0xf04(%rip),%rdi
call   1040 <app@plt>
lea    0xf01(%rip),%rdi
call   1040 <app@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<launcher>:
push   %rax
xor    %eax,%eax
call   1050 <cls@plt>
lea    0xec1(%rip),%rdi
call   1030 <println@plt>
lea    0xf07(%rip),%rdi
call   1040 <app@plt>
lea    0xf04(%rip),%rdi
pop    %rax
jmp    1040 <app@plt>

LLVM IR (-O0):
@.str = [82 x i8] c"************************* PortOS Application Launcher **************************\0A\00"
@.str.1 = [9 x i8] c"Settings\00"
@.str.2 = [6 x i8] c"About\00"
define void @launcher() {
%1 = call i32 (...) @cls()
%2 = call i32 @println(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @app(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @app(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [82 x i8] c"************************* PortOS Application Launcher **************************\0A\00"
@.str.1 = [9 x i8] c"Settings\00"
@.str.2 = [6 x i8] c"About\00"
define void @launcher() {
%1 = tail call i32 (...) @cls()
%2 = tail call i32 @println(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @app(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @app(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void _set_cons_check(unsigned char *u) { u[1] |= (1 << 4); }


x86 assembly (clang, -O0):
<_set_cons_check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%ecx
or     $0x10,%ecx
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_cons_check>:
orb    $0x10,0x1(%rdi)
ret

LLVM IR (-O0):
define void @_set_cons_check(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = or i32 %6, 16
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
ret void
}

LLVM IR (-O2):
define void @_set_cons_check(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = or i8 %3, 16
store i8 %4, i8* %2
ret void
}
/* Variables and functions */
int fdwrite(int, char *, int);
int cornet_write(int fd, const char *buf, int len) {
  return fdwrite(fd, (char *)buf, len);
}


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

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

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

LLVM IR (-O2):
define i32 @cornet_write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @fdwrite(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int send_event;
};
typedef TYPE_1__ XUnmapEvent;

/* Variables and functions */
void set_XUnmapEvent_send_event(void *_p, int _v) {
  ((XUnmapEvent *)_p)->send_event = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XUnmapEvent_send_event>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XUnmapEvent_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
double psi_h_stable(double zeta, double zeta0) {
  double psi_h = -6.351351351351352 * (zeta - zeta0);
  return psi_h;
}


x86 assembly (clang, -O0):
<psi_h_stable>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<psi_h_stable>:
subsd  %xmm1,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @psi_h_stable(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fsub double %6, %7
%9 = fmul double 0xC01967C8A60DD67D, %8
store double %9, double* %5
%10 = load double, double* %5
ret double %10
}

LLVM IR (-O2):
define double @psi_h_stable(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fmul double %3, 0xC01967C8A60DD67D
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int syscall(int, int, char const *, int /*<<< orphan*/, int);
int fchmodat(int fd, const char *path, mode_t mode, int flag) {
  return syscall(333, fd, path, mode, flag);
}


x86 assembly (clang, -O0):
<fchmodat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x14d,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fchmodat>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x14d,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @fchmodat(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @syscall(i32 333, i32 %9, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @fchmodat(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @syscall(i32 333, i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
void *Object_init(void *self) { return self; }


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

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

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

LLVM IR (-O2):
define i8* @Object_init(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
char *copy_token(char **, char);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ malformed_events();
unsigned long strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
unsigned long copy_ulong(char **c, char delim) {
  unsigned long val = 0;
  char *str = copy_token(c, delim);
  if (!str)
    malformed_events();
  val = strtoul(str, NULL, 0);
  free(str);
  return val;
}


x86 assembly (clang, -O0):
<copy_ulong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <copy_token@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117d <copy_ulong+0x3d>
mov    $0x0,%al
call   1050 <malformed_events@plt>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_ulong>:
push   %r14
push   %rbx
push   %rax
call   1040 <copy_token@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1158 <copy_ulong+0x18>
xor    %eax,%eax
call   1050 <malformed_events@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @copy_ulong(i8** %0, i8 signext %1) {
%3 = alloca i8**
%4 = alloca i8
%5 = alloca i64
%6 = alloca i8*
store i8** %0, i8*** %3
store i8 %1, i8* %4
store i64 0, i64* %5
%7 = load i8**, i8*** %3
%8 = load i8, i8* %4
%9 = call i8* @copy_token(i8** %7, i8 signext %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 (...) @malformed_events()
br label %14
14: ; preds = %12, %2
%15 = load i8*, i8** %6
%16 = call i64 @strtoul(i8* %15, i32* null, i32 0)
store i64 %16, i64* %5
%17 = load i8*, i8** %6
%18 = call i32 @free(i8* %17)
%19 = load i64, i64* %5
ret i64 %19
}

LLVM IR (-O2):
define i64 @copy_ulong(i8** %0, i8 signext %1) {
%3 = tail call i8* @copy_token(i8** %0, i8 signext %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @malformed_events()
br label %7
7: ; preds = %5, %2
%8 = tail call i64 @strtoul(i8* nocapture %3, i32* null, i32 0)
%9 = tail call i32 @free(i8* %3)
ret i64 %8
}
/* Variables and functions */
double __ocml_erfcinv_f64(double);
double erfcinv(double x) { return __ocml_erfcinv_f64(x); }


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

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

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

LLVM IR (-O2):
define double @erfcinv(double %0) {
%2 = tail call double @__ocml_erfcinv_f64(double %0)
ret double %2
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ power_update();
void power_tick(void) {
  static uint16_t c = 0;
  if (c-- == 0) {
    c = 500;
    power_update();
  }
}


x86 assembly (clang, -O0):
<power_tick>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f12(%rip),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,0x2f07(%rip)
cmp    $0x0,%eax
jne    113f <power_tick+0x2f>
movl   $0x1f4,0x2ef4(%rip)
mov    $0x0,%al
call   1030 <power_update@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_tick>:
subl   $0x1,0x2f15(%rip)
jae    112a <power_tick+0x1a>
movl   $0x1f4,0x2f09(%rip)
xor    %eax,%eax
jmp    1030 <power_update@plt>
ret

LLVM IR (-O0):
@power_tick.c = internal global i32 0
define void @power_tick() {
%1 = load i32, i32* @power_tick.c
%2 = add nsw i32 %1, -1
store i32 %2, i32* @power_tick.c
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %0
store i32 500, i32* @power_tick.c
%5 = call i32 (...) @power_update()
br label %6
6: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@power_tick.c = internal unnamed_addr global i32 0
define void @power_tick() {
%1 = load i32, i32* @power_tick.c
%2 = add nsw i32 %1, -1
store i32 %2, i32* @power_tick.c
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %0
store i32 500, i32* @power_tick.c
%5 = tail call i32 (...) @power_update()
br label %6
6: ; preds = %4, %0
ret void
}
void write_magic(const void *addr) {
  *(unsigned char *)addr = (unsigned char)(0xFAU);
  *((unsigned char *)addr + 1) = (unsigned char)(0xD3U);
}


x86 assembly (clang, -O0):
<write_magic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0xfa,(%rax)
mov    -0x8(%rbp),%rax
movb   $0xd3,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_magic>:
movw   $0xd3fa,(%rdi)
ret

LLVM IR (-O0):
define void @write_magic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
store i8 -6, i8* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 -45, i8* %5
ret void
}

LLVM IR (-O2):
define void @write_magic(i8* nocapture writeonly %0) {
store i8 -6, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
store i8 -45, i8* %2
ret void
}
unsigned long PRCMLPDSWakeupCauseGet() {
  return ((*((volatile unsigned long *)(0x4402D000 + 0x00000008))));
}


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

x86 assembly (clang, -O2):
<PRCMLPDSWakeupCauseGet>:
mov    0x4402d008,%rax
44
ret

LLVM IR (-O0):
define i64 @PRCMLPDSWakeupCauseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1141035016 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @PRCMLPDSWakeupCauseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1141035016 to i64*)
ret i64 %1
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISREG(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int is_file(const char *path) {
  if (!path) {
    return 0;
  }
  struct stat st;
  if (stat(path, &st) != 0) {
    return 0;
  }
  return S_ISREG(st.st_mode);
}


x86 assembly (clang, -O0):
<is_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <is_file+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1171 <is_file+0x51>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     1166 <is_file+0x46>
movl   $0x0,-0x4(%rbp)
jmp    1171 <is_file+0x51>
mov    -0x18(%rbp),%edi
call   1040 <S_ISREG@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_file>:
test   %rdi,%rdi
je     113d <is_file+0x1d>
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1140 <is_file+0x20>
add    $0x8,%rsp
ret
xor    %eax,%eax
ret
mov    (%rsp),%edi
call   1040 <S_ISREG@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_file(i8* %0) {
%2 = alloca %struct.stat
%3 = icmp eq i8* %0, null
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = bitcast %struct.stat* %2 to i8*
%6 = call i64 @stat(i8* %0, %struct.stat* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @S_ISREG(i32 %10)
br label %12
12: ; preds = %4, %8
%13 = phi i32 [ %11, %8 ], [ 0, %4 ]
br label %14
14: ; preds = %1, %12
%15 = phi i32 [ %13, %12 ], [ 0, %1 ]
ret i32 %15
}
const char *group_getname(void *unused) {
  (void)unused;
  return "Group";
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"Group\00"
define i8* @group_getname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"Group\00"
define i8* @group_getname(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ bubbleSort(int *, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int arr[] = {64, 34, 25, 12, 22, 11, 90};
  int n = sizeof(arr) / sizeof(arr[0]);
  bubbleSort(arr, n);
  printf("Sorted array: \n");
  printArray(arr, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <bubbleSort@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xed0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <bubbleSort@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 64, i32 34, i32 25, i32 12, i32 22, i32 11, i32 90]
@.str = [16 x i8] c"Sorted array: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i32]* %2 to i8*
store i32 7, i32* %3
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @bubbleSort(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @printArray(i32* %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 64, i32 34, i32 25, i32 12, i32 22, i32 11, i32 90]
@str = [15 x i8] c"Sorted array: \00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @bubbleSort(i32* %3, i32 7)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = call i32 @printArray(i32* %3, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FH_DU();
int /*<<< orphan*/ init();
int /*<<< orphan*/ interface();
int main(void) {
  init();
  interface();
  FH_DU();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 (...) @interface()
%3 = tail call i32 (...) @FH_DU()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
scalar_t__ system(char *);
void output_bad_records(char *bad_parse_file, char *bad_insert_file,
                        char *bad_update_file) {
  char sys_string[1024];
  sprintf(sys_string, "cat %s %s %s | html_table.e '^^Bad Records' '' ''",
          bad_parse_file, bad_insert_file, bad_update_file);
  if (system(sys_string)) {
  };
}


x86 assembly (clang, -O0):
<output_bad_records>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xeaf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     1171 <output_bad_records+0x51>
jmp    1171 <output_bad_records+0x51>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_bad_records>:
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xec8(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"cat %s %s %s | html_table.e '^^Bad Records' '' ''\00"
define void @output_bad_records(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%14 = call i64 @system(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
br label %17
17: ; preds = %16, %3
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"cat %s %s %s | html_table.e '^^Bad Records' '' ''\00"
define void @output_bad_records(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = call i64 @system(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printstr(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main() {
  printstr(stdout, "heisann!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <printstr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <printstr@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [10 x i8] c"heisann!\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @printstr(i32 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
adr0adr1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((*((int *)10000000)) <= (*((int *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adr0adr1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    $0x989680,%eax
mov    (%rax),%eax
mov    $0xa98ac7,%ecx
cmp    (%rcx),%eax
jg     1138 <adr0adr1+0x38>
movl   $0x1,-0x4(%rbp)
jmp    113f <adr0adr1+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0adr1>:
mov    0x989680,%ecx
xor    %eax,%eax
cmp    0xa98ac7,%ecx
setle  %al
ret

LLVM IR (-O0):
define i32 @adr0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* inttoptr (i64 10000000 to i32*)
%15 = load i32, i32* inttoptr (i64 11111111 to i32*)
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %6
store i32 1, i32* %7
br label %19
18: ; preds = %6
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @adr0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
%7 = load i32, i32* inttoptr (i64 10000000 to i32*)
%8 = load i32, i32* inttoptr (i64 11111111 to i32*)
%9 = icmp sle i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int function_3(int);
int /*<<< orphan*/ printf(char *, int);
void function_2(int number) {
  printf("%c", function_3(number / 16));
  printf("%c", function_3(number % 16));
}


x86 assembly (clang, -O0):
<function_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <function_3@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <function_3@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_2>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xf(%rbx),%ebp
test   %edi,%edi
cmovns %edi,%ebp
mov    %ebp,%edi
sar    $0x4,%edi
call   1040 <function_3@plt>
lea    0xec1(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
and    $0xfffffff0,%ebp
sub    %ebp,%ebx
mov    %ebx,%edi
call   1040 <function_3@plt>
mov    %r14,%rdi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @function_2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 16
%5 = call i32 @function_3(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = srem i32 %7, 16
%9 = call i32 @function_3(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @function_2(i32 %0) {
%2 = sdiv i32 %0, 16
%3 = tail call i32 @function_3(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = srem i32 %0, 16
%6 = tail call i32 @function_3(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void hello_c_() { printf("%s\n", "hello_c: Hello World!"); }


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

x86 assembly (clang, -O2):
<hello_c_>:
lea    0xee9(%rip),%rdi
lea    0xee6(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [22 x i8] c"hello_c: Hello World!\00"
define void @hello_c_() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [22 x i8] c"hello_c: Hello World!\00"
define void @hello_c_() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret void
}