xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strrchr(char const *const, char);
extern const char *baseFilename(const char *const filePath) {
  const char *tail = strrchr(filePath, '/');
  if (tail == NULL)
    tail = filePath;
  else
    ++tail;
  return tail;
}


x86 assembly (clang, -O0):
<baseFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <baseFilename+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <baseFilename+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @baseFilename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %2
store i8* %9, i8** %3
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
br label %13
13: ; preds = %10, %8
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @baseFilename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
int ft_check_a(char *str) {
  while (*str) {
    if (*str == 'a')
      return (1);
    str++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<ft_check_a>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <ft_check_a+0x42>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jne    1131 <ft_check_a+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1149 <ft_check_a+0x49>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <ft_check_a+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_check_a>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <ft_check_a+0x11>
cmp    $0x61,%al
je     1114 <ft_check_a+0x14>
add    $0x1,%rdi
jmp    1100 <ft_check_a>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ft_check_a(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %14, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 97
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 1, i32* %2
br label %18
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %4
17: ; preds = %4
store i32 0, i32* %2
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @ft_check_a(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %8
i8 97, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  system("apt-get update");
  system("apt-get -y dist-upgrade");
  system("apt-get -y autoremove");
  system("apt-get -y autoclean");
  system("echo>>/var/log/updater-gs.log $(date)");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <setuid@plt>
lea    0xec3(%rip),%rdi
call   1030 <system@plt>
lea    0xec6(%rip),%rdi
call   1030 <system@plt>
lea    0xed2(%rip),%rdi
call   1030 <system@plt>
lea    0xedc(%rip),%rdi
call   1030 <system@plt>
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <setuid@plt>
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
lea    0xed4(%rip),%rdi
call   1030 <system@plt>
lea    0xee0(%rip),%rdi
call   1030 <system@plt>
lea    0xeea(%rip),%rdi
call   1030 <system@plt>
lea    0xef3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"apt-get update\00"
@.str.1 = [24 x i8] c"apt-get -y dist-upgrade\00"
@.str.2 = [22 x i8] c"apt-get -y autoremove\00"
@.str.3 = [21 x i8] c"apt-get -y autoclean\00"
@.str.4 = [38 x i8] c"echo>>/var/log/updater-gs.log $(date)\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @system(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"apt-get update\00"
@.str.1 = [24 x i8] c"apt-get -y dist-upgrade\00"
@.str.2 = [22 x i8] c"apt-get -y autoremove\00"
@.str.3 = [21 x i8] c"apt-get -y autoclean\00"
@.str.4 = [38 x i8] c"echo>>/var/log/updater-gs.log $(date)\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t rollhash_step(uint32_t arg, uint32_t hash, uint8_t old, uint8_t new) {
  return ((hash + 256 * 8355967 - old * arg) % 8355967 * 256 + new) % 8355967;
}


x86 assembly (clang, -O0):
<rollhash_step>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7f807f00,%eax
mov    -0xc(%rbp),%ecx
imul   -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    $0x7f807f,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
shl    $0x8,%eax
add    -0x10(%rbp),%eax
mov    $0x7f807f,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rollhash_step>:
imul   %edx,%edi
sub    %edi,%esi
add    $0x7f807f00,%esi
movslq %esi,%rax
imul   $0x40400041,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x35,%rdx
add    %esi,%edx
imul   $0x7f807f,%edx,%edx
sub    %edx,%eax
shl    $0x8,%eax
add    %ecx,%eax
cltq
imul   $0x40400041,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x35,%rcx
add    %edx,%ecx
imul   $0x7f807f,%ecx,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rollhash_step(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = add nsw i32 %9, 2139127552
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = mul nsw i32 %11, %12
%14 = sub nsw i32 %10, %13
%15 = srem i32 %14, 8355967
%16 = mul nsw i32 %15, 256
%17 = load i32, i32* %8
%18 = add nsw i32 %16, %17
%19 = srem i32 %18, 8355967
ret i32 %19
}

LLVM IR (-O2):
define i32 @rollhash_step(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, 2139127552
%6 = mul nsw i32 %2, %0
%7 = sub i32 %5, %6
%8 = srem i32 %7, 8355967
%9 = shl nsw i32 %8, 8
%10 = add nsw i32 %9, %3
%11 = srem i32 %10, 8355967
ret i32 %11
}
void atomic_read_barrier() { __asm__ __volatile__("lfence" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @atomic_read_barrier() {
tail call void asm sideeffect "lfence", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_close;
int syscall(int /*<<< orphan*/, int);
int close(int fd) {
  if (fd == 1022 || fd == 1023) {
    return 0;
  }
  return syscall(__NR_close, fd);
}


x86 assembly (clang, -O0):
<close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x3fe,-0x8(%rbp)
je     1135 <close+0x25>
cmpl   $0x3ff,-0x8(%rbp)
jne    1141 <close+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1155 <close+0x45>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
call   1030 <syscall@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close>:
mov    %edi,%eax
and    $0xfffffffe,%eax
cmp    $0x3fe,%eax
jne    111f <close+0xf>
xor    %eax,%eax
ret
mov    %edi,%esi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_close = global i32 0
define i32 @close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1022
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1023
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i32 0, i32* %2
br label %14
10: ; preds = %6
%11 = load i32, i32* @__NR_close
%12 = load i32, i32* %3
%13 = call i32 @syscall(i32 %11, i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@__NR_close = global i32 0
define i32 @close(i32 %0) {
%2 = and i32 %0, -2
%3 = icmp eq i32 %2, 1022
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @__NR_close
%6 = tail call i32 @syscall(i32 %5, i32 %0)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ 0, %1 ]
ret i32 %8
}
void GPIOPortQ_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<GPIOPortQ_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <GPIOPortQ_Handler+0x9>
jmp    1109 <GPIOPortQ_Handler+0x9>

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

LLVM IR (-O0):
define void @GPIOPortQ_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @GPIOPortQ_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ComputeRspParamHashOffset(uint32_t ordinal) {
  switch (ordinal) {
  case 230:
  case 65:
    return 4;
  case 10:
    return 24;
  case 11:
    return 44;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ComputeRspParamHashOffset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xa,%eax
je     115c <ComputeRspParamHashOffset+0x5c>
jmp    111b <ComputeRspParamHashOffset+0x1b>
mov    -0xc(%rbp),%eax
sub    $0xb,%eax
je     1168 <ComputeRspParamHashOffset+0x68>
jmp    112c <ComputeRspParamHashOffset+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x41,%eax
je     1150 <ComputeRspParamHashOffset+0x50>
jmp    113d <ComputeRspParamHashOffset+0x3d>
mov    -0xc(%rbp),%eax
sub    $0xe6,%eax
jne    1174 <ComputeRspParamHashOffset+0x74>
jmp    1150 <ComputeRspParamHashOffset+0x50>
movl   $0x4,-0x4(%rbp)
jmp    117b <ComputeRspParamHashOffset+0x7b>
movl   $0x18,-0x4(%rbp)
jmp    117b <ComputeRspParamHashOffset+0x7b>
movl   $0x2c,-0x4(%rbp)
jmp    117b <ComputeRspParamHashOffset+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComputeRspParamHashOffset>:
cmp    $0x40,%edi
jg     1115 <ComputeRspParamHashOffset+0x15>
cmp    $0xa,%edi
je     112b <ComputeRspParamHashOffset+0x2b>
cmp    $0xb,%edi
jne    1128 <ComputeRspParamHashOffset+0x28>
mov    $0x2c,%eax
ret
mov    $0x4,%eax
cmp    $0x41,%edi
je     1127 <ComputeRspParamHashOffset+0x27>
cmp    $0xe6,%edi
jne    1128 <ComputeRspParamHashOffset+0x28>
ret
xor    %eax,%eax
ret
mov    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @ComputeRspParamHashOffset(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 230, label %5
i32 65, label %5
i32 10, label %6
i32 11, label %7
]
5: ; preds = %1, %1
store i32 4, i32* %2
br label %9
6: ; preds = %1
store i32 24, i32* %2
br label %9
7: ; preds = %1
store i32 44, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @ComputeRspParamHashOffset(i32 %0) {
switch i32 %0, label %4 [
i32 230, label %5
i32 65, label %5
i32 10, label %2
i32 11, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %1, %4, %3, %2
%6 = phi i32 [ 0, %4 ], [ 44, %3 ], [ 24, %2 ], [ 4, %1 ], [ 4, %1 ]
ret i32 %6
}
/* Variables and functions */
char *strchr(char const *, char);
const char *check_array(const char *type) {
  const char *str = strchr(type, '[');
  if (str) {
    return str;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<check_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5b,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1146 <check_array+0x36>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <check_array+0x3e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_array>:
mov    $0x5b,%esi
jmp    1030 <strchr@plt>

LLVM IR (-O0):
define i8* @check_array(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 91)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %12
11: ; preds = %1
store i8* null, i8** %2
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @check_array(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 91)
ret i8* %2
}
/* Variables and functions */
bool nrf52_errata_34(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_34() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
char *sprintn(char *, char *, int, int);
void print_num(char *str, int arg) {
  char buf[64];
  char *p;
  puts(str);
  puts(" ");
  p = sprintn(buf, &buf[64], arg, 10);
  *p = '\0';
  puts(buf);
  puts("\n");
}


x86 assembly (clang, -O0):
<print_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    -0x50(%rbp),%rdi
lea    -0x50(%rbp),%rsi
add    $0x40,%rsi
mov    -0xc(%rbp),%edx
mov    $0xa,%ecx
call   1040 <sprintn@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x50(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_num>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebx
call   1030 <puts@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
mov    $0xa,%ecx
call   1040 <sprintn@plt>
movb   $0x0,(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_num(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [64 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @puts(i8* %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 64
%12 = load i32, i32* %4
%13 = call i8* @sprintn(i8* %10, i8* %11, i32 %12, i32 10)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
store i8 0, i8* %14
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
%17 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_num(i8* nocapture %0, i32 %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) %0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 64
%8 = call i8* @sprintn(i8* %4, i8* %7, i32 %1, i32 10)
store i8 0, i8* %8
%9 = call i32 @puts(i8* %4)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ halt();
int /*<<< orphan*/ puts(char *);
__attribute__((noreturn)) void __stack_chk_fail() {
  puts("Someone tried to smash the stack on his own head :(");
  halt();
}


x86 assembly (clang, -O0):
<__stack_chk_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <halt@plt>

x86 assembly (clang, -O2):
<__stack_chk_fail>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <halt@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Someone tried to smash the stack on his own head :(\00"
define void @__stack_chk_fail() {
%1 = call i32 @puts(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @halt()
unreachable
}

LLVM IR (-O2):
@.str = [52 x i8] c"Someone tried to smash the stack on his own head :(\00"
define void @__stack_chk_fail() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @halt()
unreachable
}
void local_mcu_TimerMilli_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @local_mcu_TimerMilli_targetInit__I() {
ret void
}
/* Variables and functions */
char *_resposta_padrao(int, int, char *);
char *DesbloquearSAT(int sessao, char *codigo_ativacao) {
  return _resposta_padrao(sessao, 17000,
                          "Equipamento SAT desbloqueado com sucesso");
}


x86 assembly (clang, -O0):
<DesbloquearSAT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4268,%esi
lea    0xed2(%rip),%rdx
call   1030 <_resposta_padrao@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DesbloquearSAT>:
lea    0xee9(%rip),%rdx
mov    $0x4268,%esi
jmp    1030 <_resposta_padrao@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Equipamento SAT desbloqueado com sucesso\00"
define i8* @DesbloquearSAT(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 = call i8* @_resposta_padrao(i32 %5, i32 17000, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret i8* %6
}

LLVM IR (-O2):
@.str = [41 x i8] c"Equipamento SAT desbloqueado com sucesso\00"
define i8* @DesbloquearSAT(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i8* @_resposta_padrao(i32 %0, i32 17000, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int PMPI_Finalize();
int MPI_Finalize(void) {
  ;
  return PMPI_Finalize();
}


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

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

LLVM IR (-O0):
define i32 @MPI_Finalize() {
%1 = call i32 (...) @PMPI_Finalize()
ret i32 %1
}

LLVM IR (-O2):
define i32 @MPI_Finalize() {
%1 = tail call i32 (...) @PMPI_Finalize()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void compare_element_region_and_base(int *p) {
  int *q = p - 1;
  clang_analyzer_eval(p == q);
}


x86 assembly (clang, -O0):
<compare_element_region_and_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_element_region_and_base>:
xor    %edi,%edi
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @compare_element_region_and_base(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 -1
store i32* %5, i32** %3
%6 = load i32*, i32** %2
%7 = load i32*, i32** %3
%8 = icmp eq i32* %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @clang_analyzer_eval(i32 %9)
ret void
}

LLVM IR (-O2):
define void @compare_element_region_and_base(i32* nocapture readnone %0) {
%2 = tail call i32 @clang_analyzer_eval(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DebugLogControlHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void DebugLogControlRequestUpdate() {
  UAVObjRequestUpdate(DebugLogControlHandle());
}


x86 assembly (clang, -O0):
<DebugLogControlRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <DebugLogControlHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DebugLogControlRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <DebugLogControlHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @DebugLogControlRequestUpdate() {
%1 = call i32 (...) @DebugLogControlHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @DebugLogControlRequestUpdate() {
%1 = tail call i32 (...) @DebugLogControlHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
void MD5_memset(output, value, len) unsigned char *output;
int value;
unsigned int len;
{
  unsigned int i;
  for (i = 0; i < len; i++)
    ((char *)output)[i] = (char)value;
}


x86 assembly (clang, -O0):
<MD5_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    113e <MD5_memset+0x3e>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <MD5_memset+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MD5_memset>:
test   %edx,%edx
je     1120 <MD5_memset+0x10>
push   %rax
mov    %edx,%edx
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @MD5_memset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %19, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i32, i32* %5
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = load i32, i32* %7
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %14, i8* %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %7
%21 = add i32 %20, 1
store i32 %21, i32* %7
br label %8
22: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @MD5_memset(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %5, %3
ret void
}
double median(int n, int *arr) {
  int index = n / 2 - 1;
  return n % 2 == 0 ? (double)(arr[index] + arr[index + 1]) / 2 : arr[index];
}


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1165 <median+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
add    (%rcx,%rdx,4),%eax
cvtsi2sd %eax,%xmm0
movsd  0xea9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1177 <median+0x77>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<median>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
movslq %eax,%rcx
mov    -0x4(%rsi,%rcx,4),%eax
test   $0x1,%dil
jne    1126 <median+0x26>
add    (%rsi,%rcx,4),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xedb(%rip),%xmm0
ret
cvtsi2sd %eax,%xmm0
ret

LLVM IR (-O0):
define double @median(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 2
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = srem i32 %9, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %17, %23
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 2.000000e+00
br label %34
27: ; preds = %2
%28 = load i32*, i32** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = sitofp i32 %32 to double
br label %34
34: ; preds = %27, %12
%35 = phi double [ %26, %12 ], [ %33, %27 ]
ret double %35
}

LLVM IR (-O2):
define double @median(i32 %0, i32* nocapture %1) {
%3 = sdiv i32 %0, 2
%4 = add nsw i32 %3, -1
%5 = and i32 %0, 1
%6 = icmp eq i32 %5, 0
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
br i1 %6, label %10, label %17
10: ; preds = %2
%11 = sext i32 %3 to i64
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, %9
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 5.000000e-01
br label %19
17: ; preds = %2
%18 = sitofp i32 %9 to double
br label %19
19: ; preds = %17, %10
%20 = phi double [ %16, %10 ], [ %18, %17 ]
ret double %20
}
/* Variables and functions */
int /*<<< orphan*/ adc8(int /*<<< orphan*/);
int /*<<< orphan*/ readmem65816(int /*<<< orphan*/);
int /*<<< orphan*/ stack();
void adcSp8(void) { adc8(readmem65816(stack())); }


x86 assembly (clang, -O0):
<adcSp8>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <stack@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
call   1030 <adc8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adcSp8>:
push   %rax
xor    %eax,%eax
call   1040 <stack@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <adc8@plt>

LLVM IR (-O0):
define void @adcSp8() {
%1 = call i32 (...) @stack()
%2 = call i32 @readmem65816(i32 %1)
%3 = call i32 @adc8(i32 %2)
ret void
}

LLVM IR (-O2):
define void @adcSp8() {
%1 = tail call i32 (...) @stack()
%2 = tail call i32 @readmem65816(i32 %1)
%3 = tail call i32 @adc8(i32 %2)
ret void
}
void foo233(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo233(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(int /*<<< orphan*/, int);
void ft_putstr_fd(char const *s, int fd) {
  if (!(s))
    return;
  while (*s)
    ft_putchar_fd(*s++, fd);
}


x86 assembly (clang, -O0):
<ft_putstr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112f <ft_putstr_fd+0x1f>
jmp    1160 <ft_putstr_fd+0x50>
jmp    1134 <ft_putstr_fd+0x24>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1160 <ft_putstr_fd+0x50>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    -0xc(%rbp),%esi
call   1030 <ft_putchar_fd@plt>
jmp    1134 <ft_putstr_fd+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_fd>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1145 <ft_putstr_fd+0x35>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1145 <ft_putstr_fd+0x35>
mov    %esi,%ebp
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %ebp,%esi
call   1030 <ft_putchar_fd@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ft_putstr_fd+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %2
br label %20
8: ; preds = %2
br label %9
9: ; preds = %13, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = load i32, i32* %4
%19 = call i32 @ft_putchar_fd(i32 %17, i32 %18)
br label %9
20: ; preds = %7, %9
ret void
}

LLVM IR (-O2):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4, %7
%8 = phi i8 [ %13, %7 ], [ %5, %4 ]
%9 = phi i8* [ %10, %7 ], [ %0, %4 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = sext i8 %8 to i32
%12 = tail call i32 @ft_putchar_fd(i32 %11, i32 %1)
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %4, %2
ret void
}
/* Variables and functions */
scalar_t__ isdigit(int);
char toupper(int);
int hex_value(int chr) {
  return isdigit(chr) ? chr - '0' : toupper(chr) - 'A' + 10;
}


x86 assembly (clang, -O0):
<hex_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     114b <hex_value+0x2b>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <hex_value+0x3f>
mov    -0x4(%rbp),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_value>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
je     1132 <hex_value+0x12>
add    $0xffffffd0,%ebx
jmp    113f <hex_value+0x1f>
mov    %ebx,%edi
call   1040 <toupper@plt>
movsbl %al,%ebx
add    $0xffffffc9,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hex_value(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isdigit(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 48
br label %15
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call signext i8 @toupper(i32 %10)
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 65
%14 = add nsw i32 %13, 10
br label %15
15: ; preds = %9, %6
%16 = phi i32 [ %8, %6 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @hex_value(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = add nsw i32 %0, -48
br label %10
6: ; preds = %1
%7 = tail call signext i8 @toupper(i32 %0)
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, -55
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ %5, %4 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void captura(int sennal) {
  printf("He conseguido capturar ALARMA\n");
  fflush(NULL);
  return;
}


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

x86 assembly (clang, -O2):
<captura>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"He conseguido capturar ALARMA\0A\00"
define void @captura(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @fflush(i32* null)
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"He conseguido capturar ALARMA\00"
define void @captura(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @fflush(i32* null)
ret void
}
void dmk_inc(int *datap, int tracklen, int density, int fmtimes) {
  *datap = *datap + (density ? 1 : fmtimes);
  if (*datap > tracklen)
    *datap = 0x80;
}


x86 assembly (clang, -O0):
<dmk_inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1131 <dmk_inc+0x31>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <dmk_inc+0x37>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jle    115e <dmk_inc+0x5e>
mov    -0x8(%rbp),%rax
movl   $0x80,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmk_inc>:
test   %edx,%edx
mov    $0x1,%eax
cmove  %ecx,%eax
add    (%rdi),%eax
cmp    %esi,%eax
mov    $0x80,%ecx
cmovle %eax,%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define void @dmk_inc(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* %0
%6 = icmp eq i32 %2, 0
%7 = select i1 %6, i32 %3, i32 1
%8 = add nsw i32 %5, %7
%9 = icmp sgt i32 %8, %1
%10 = select i1 %9, i32 128, i32 %8
store i32 %10, i32* %0
ret void
}
/* Type definitions */
struct sigaction {
  void *sa_handler;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
void set_signal_handler(int sig, void *handler) {
  struct sigaction act = {
      .sa_handler = handler,
  };
  do {
    if (sigaction(sig, &act, NULL) < 0) {
      perror("sigaction(sig, &act, NULL) < 0");
      exit(1);
    }
  } while (0);
}


x86 assembly (clang, -O0):
<set_signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
cmp    $0x0,%rax
jge    1177 <set_signal_handler+0x47>
lea    0xe98(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    117c <set_signal_handler+0x4c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_signal_handler>:
push   %rax
mov    %rsi,(%rsp)
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
test   %rax,%rax
js     1146 <set_signal_handler+0x16>
pop    %rax
ret
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sigaction = type { i8* }
@.str = [31 x i8] c"sigaction(sig, &act, NULL) < 0\00"
define void @set_signal_handler(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
%7 = load i8*, i8** %4
store i8* %7, i8** %6
br label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i64 @sigaction(i32 %9, %struct.sigaction* %5, i32* null)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %8
br label %16
16: ; preds = %15
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i8* }
@.str = [31 x i8] c"sigaction(sig, &act, NULL) < 0\00"
define void @set_signal_handler(i32 %0, i8* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store i8* %1, i8** %5
%6 = call i64 @sigaction(i32 %0, %struct.sigaction* %3, i32* null)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ polyglot_array_typeid(int /*<<< orphan*/,
                                         int /*<<< orphan*/);
void *polyglot_as_typed(void *, int /*<<< orphan*/);
int /*<<< orphan*/ polyglot_i16_typeid();
__attribute__((always_)) int16_t *polyglot_as_i16_array(void *p) {
  void *ret =
      polyglot_as_typed(p, polyglot_array_typeid(polyglot_i16_typeid(), 0));
  return (int16_t *)ret;
}


x86 assembly (clang, -O0):
<polyglot_as_i16_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <polyglot_i16_typeid@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <polyglot_array_typeid@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <polyglot_as_typed@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polyglot_as_i16_array>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <polyglot_i16_typeid@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <polyglot_array_typeid@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <polyglot_as_typed@plt>

LLVM IR (-O0):
define i32* @polyglot_as_i16_array(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (...) @polyglot_i16_typeid()
%6 = call i32 @polyglot_array_typeid(i32 %5, i32 0)
%7 = call i8* @polyglot_as_typed(i8* %4, i32 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
ret i32* %9
}

LLVM IR (-O2):
define i32* @polyglot_as_i16_array(i8* %0) {
%2 = tail call i32 (...) @polyglot_i16_typeid()
%3 = tail call i32 @polyglot_array_typeid(i32 %2, i32 0)
%4 = tail call i8* @polyglot_as_typed(i8* %0, i32 %3)
%5 = bitcast i8* %4 to i32*
ret i32* %5
}
/* Variables and functions */
char random_integer(char);
void random_string(char *buffer, size_t size) {
  for (size_t i = 0; i < size - 1; i++) {
    buffer[i] = 'a' + random_integer('z' - 'a');
  }
  buffer[size - 1] = 0;
}


x86 assembly (clang, -O0):
<random_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    116b <random_string+0x5b>
mov    $0x19,%edi
call   1030 <random_integer@plt>
movsbl %al,%eax
add    $0x61,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <random_string+0x18>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_string>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
add    $0xffffffffffffffff,%r15
je     1149 <random_string+0x39>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x19,%edi
call   1030 <random_integer@plt>
add    $0x61,%al
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <random_string+0x20>
movb   $0x0,(%r14,%r15,1)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @random_string(i8* nocapture writeonly %0, i64 %1) {
%3 = add i64 %1, -1
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %7, %2
%6 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 0, i8* %6
ret void
7: ; preds = %2, %7
%8 = phi i64 [ %12, %7 ], [ 0, %2 ]
%9 = tail call signext i8 @random_integer(i8 signext 25)
%10 = add i8 %9, 97
%11 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %10, i8* %11
%12 = add nuw i64 %8, 1
%13 = icmp eq i64 %12, %3
br i1 %13, label %5, label %7
}
/* Variables and functions */
int /*<<< orphan*/ halt_and_catch_fire();
int /*<<< orphan*/ printk(char *, char *);
void panic(char *msg) {
  if (msg != 0) {
    printk("PANIC MESSAGE: %s\n", msg);
  }
  halt_and_catch_fire();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1147 <panic+0x27>
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <printk@plt>
mov    $0x0,%al
call   1040 <halt_and_catch_fire@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panic>:
test   %rdi,%rdi
je     1139 <panic+0x19>
push   %rax
mov    %rdi,%rsi
lea    0xed0(%rip),%rdi
call   1030 <printk@plt>
add    $0x8,%rsp
xor    %eax,%eax
jmp    1040 <halt_and_catch_fire@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"PANIC MESSAGE: %s\0A\00"
define void @panic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @printk(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %1
%9 = call i32 (...) @halt_and_catch_fire()
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"PANIC MESSAGE: %s\0A\00"
define void @panic(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printk(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 (...) @halt_and_catch_fire()
ret void
}
/* Variables and functions */
char *ltrim(int /*<<< orphan*/);
int /*<<< orphan*/ rtrim(char *);
char *trim(char *s) { return ltrim(rtrim(s)); }


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rtrim@plt>
mov    %eax,%edi
call   1040 <ltrim@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rax
call   1030 <rtrim@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ltrim@plt>

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

LLVM IR (-O2):
define i8* @trim(i8* %0) {
%2 = tail call i32 @rtrim(i8* %0)
%3 = tail call i8* @ltrim(i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void libfoo() { printf("Hello World from libfoo!\n"); }


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"Hello World from libfoo!\00"
define void @libfoo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
void thrower(void) { *(char *)0 = 0; }


x86 assembly (clang, -O0):
<thrower>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @thrower() {
store i8 0, i8* null
ret void
}

LLVM IR (-O2):