xunge/DecIR huggingface dataset:
/* Variables and functions */
int _execvp(char const *, char *const *);
int _execlp(const char *file, const char *arg1, ...) {
  return _execvp(file, (char *const *)&arg1);
}


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

x86 assembly (clang, -O2):
<_execlp>:
push   %rax
mov    %rsi,(%rsp)
mov    %rsp,%rsi
call   1030 <_execvp@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_execlp(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @_execvp(i8* %5, i8** %4)
ret i32 %6
}

LLVM IR (-O2):
define i32 @_execlp(i8* %0, i8* %1, ...) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = call i32 @_execvp(i8* %0, i8** %3)
ret i32 %4
}
/* Variables and functions */
scalar_t__ strlen(char const *);
const char *getnchar(const char *x, int n) {
  static char ch[2] = " ";
  if ((int)strlen(x) < n)
    ch[0] = '\0';
  else
    ch[0] = x[n - 1];
  return ch;
}


x86 assembly (clang, -O0):
<getnchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0xc(%rbp),%eax
jge    113d <getnchar+0x2d>
movb   $0x0,0x2ef0(%rip)
jmp    1153 <getnchar+0x43>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,0x2ed5(%rip)
lea    0x2ece(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnchar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    %ebp,%eax
jge    1125 <getnchar+0x15>
xor    %eax,%eax
jmp    112c <getnchar+0x1c>
movslq %ebp,%rax
mov    -0x1(%rax,%rbx,1),%al
mov    %al,0x2ef6(%rip)
lea    0x2eef(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@getnchar.ch = internal global [2 x i8] c" \00"
define i8* @getnchar(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 = call i64 @strlen(i8* %5)
%7 = trunc i64 %6 to i32
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %2
store i8 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @getnchar.ch, i64 0, i64 0)
br label %18
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @getnchar.ch, i64 0, i64 0)
br label %18
18: ; preds = %11, %10
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @getnchar.ch, i64 0, i64 0)
}

LLVM IR (-O2):
@getnchar.ch = internal global [2 x i8] c" \00"
define i8* @getnchar(i8* nocapture %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = trunc i64 %3 to i32
%5 = icmp slt i32 %4, %1
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = add nsw i32 %1, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
br label %11
11: ; preds = %2, %6
%12 = phi i8 [ %10, %6 ], [ 0, %2 ]
store i8 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @getnchar.ch, i64 0, i64 0)
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @getnchar.ch, i64 0, i64 0)
}
unsigned int addiu(int register2, int number) { return register2 + number; }


x86 assembly (clang, -O0):
<addiu>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addiu>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @addiu(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @addiu(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ stdout;
int write(int /*<<< orphan*/, char *, int);
int term_reset_video() { return write(stdout, "\x1b[0m", 4) != 4; }


x86 assembly (clang, -O0):
<term_reset_video>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_reset_video>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    $0x4,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[0m\00"
define i32 @term_reset_video() {
%1 = load i32, i32* @stdout
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[0m\00"
define i32 @term_reset_video() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}
void ble_rsp_connection_disconnect(
    const struct ble_msg_connection_disconnect_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.ble_msg_connection_disconnect_rsp_t = type opaque
define void @ble_rsp_connection_disconnect(%struct.ble_msg_connection_disconnect_rsp_t* %0) {
%2 = alloca %struct.ble_msg_connection_disconnect_rsp_t*
store %struct.ble_msg_connection_disconnect_rsp_t* %0, %struct.ble_msg_connection_disconnect_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.ble_msg_connection_disconnect_rsp_t = type opaque
define void @ble_rsp_connection_disconnect(%struct.ble_msg_connection_disconnect_rsp_t* nocapture %0) {
ret void
}
void d2i_ECPrivateKey(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_ECPrivateKey() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ faux(int);
int main() {
  for (int tiph = 0; tiph <= 56; tiph++)
    faux(tiph);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x38,-0x8(%rbp)
jg     1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <faux@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <faux@plt>
add    $0x1,%ebx
cmp    $0x39,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @faux(i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 57
br i1 %6, label %1, label %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t mqtt_get_dup(uint8_t *buffer) { return (buffer[0] & 0x08) >> 3; }


x86 assembly (clang, -O0):
<mqtt_get_dup>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x8,%eax
sar    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mqtt_get_dup>:
mov    (%rdi),%eax
shr    $0x3,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @mqtt_get_dup(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 3
%4 = and i32 %3, 1
ret i32 %4
}
int fun163() { return 163; }


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

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

LLVM IR (-O0):
define i32 @fun163() {
ret i32 163
}

LLVM IR (-O2):
define i32 @fun163() {
ret i32 163
}
void copy_typenames(char **dest, char **src) {
  if (!src) {
    return;
  }
  while ((*dest++ = *src++)) {
  }
}


x86 assembly (clang, -O0):
<copy_typenames>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111c <copy_typenames+0x1c>
jmp    1154 <copy_typenames+0x54>
jmp    1121 <copy_typenames+0x21>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x8,%rdx
mov    %rdx,-0x8(%rbp)
mov    %rax,(%rcx)
cmp    $0x0,%rax
je     1154 <copy_typenames+0x54>
jmp    1121 <copy_typenames+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_typenames>:
test   %rsi,%rsi
je     1121 <copy_typenames+0x21>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    (%rsi,%rax,1),%rcx
mov    %rcx,(%rdi,%rax,1)
add    $0x8,%rax
test   %rcx,%rcx
jne    1110 <copy_typenames+0x10>
ret

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

LLVM IR (-O2):
define void @copy_typenames(i8** nocapture writeonly %0, i8** %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i8** [ %9, %4 ], [ %0, %2 ]
%6 = phi i8** [ %7, %4 ], [ %1, %2 ]
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8*, i8** %5, i64 1
store i8* %8, i8** %5
%10 = icmp eq i8* %8, null
br i1 %10, label %11, label %4
11: ; preds = %4, %2
ret void
}
void null_midi_free(void *p) {}


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

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

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

LLVM IR (-O2):
define void @null_midi_free(i8* nocapture %0) {
ret void
}
unsigned str_contains_chr(const char *str, char c) {
  unsigned i = 0;
  while (str[i] != '\0')
    if (str[i++] == c)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<str_contains_chr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115b <str_contains_chr+0x5b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1156 <str_contains_chr+0x56>
movl   $0x1,-0x4(%rbp)
jmp    1162 <str_contains_chr+0x62>
jmp    1115 <str_contains_chr+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_contains_chr>:
xor    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%edx
movzbl (%rdi,%rdx,1),%edx
test   %dl,%dl
je     1127 <str_contains_chr+0x27>
add    $0x1,%ecx
cmp    %sil,%dl
jne    1110 <str_contains_chr+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @str_contains_chr(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i32 [ 0, %2 ], [ %10, %9 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = add i32 %4, 1
%11 = icmp eq i8 %7, %1
br i1 %11, label %12, label %3
12: ; preds = %3, %9
%13 = phi i32 [ 1, %9 ], [ 0, %3 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ xfree(void *);
void Destroy_AN1_Vertex(void *vvertex) { xfree(vvertex); }


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

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

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

LLVM IR (-O2):
define void @Destroy_AN1_Vertex(i8* %0) {
%2 = tail call i32 @xfree(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void err(char s[]) {
  printf("\n !!! FUNKCJA zesp_get: %s !!!\n\n", s);
  exit(1);
}


x86 assembly (clang, -O0):
<err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0A !!! FUNKCJA zesp_get: %s !!!\0A\0A\00"
define void @err(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A !!! FUNKCJA zesp_get: %s !!!\0A\0A\00"
define void @err(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int strndup_test();
int main(void) { return strndup_test(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @strndup_test()
ret i32 %1
}
int isLeapYear(int year) {
  int isLeap;
  if (year % 4 == 0) {
    if (year % 400 == 0) {
      isLeap = 1;
    } else if (year % 100 != 0) {
      isLeap = 1;
    }
  }
  return isLeap;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1160 <isLeapYear+0x60>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113b <isLeapYear+0x3b>
movl   $0x1,-0x8(%rbp)
jmp    115b <isLeapYear+0x5b>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1156 <isLeapYear+0x56>
movl   $0x1,-0x8(%rbp)
jmp    115b <isLeapYear+0x5b>
jmp    1160 <isLeapYear+0x60>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle22() { kprintf("ISR %d.\n", 22); }


x86 assembly (clang, -O0):
<isrHandle22>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x16,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle22>:
lea    0xee9(%rip),%rdi
mov    $0x16,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle22() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 22)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle22() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 22)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t hash(uint64_t x) {
  x = (x ^ (x >> 33)) * 14029467366897019727ULL;
  x = (x ^ (x >> 29)) * 1609587929392839161ULL;
  return x ^ (x >> 32);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    $0x21,%ecx
sar    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
cltq
movabs $0xc2b2ae3d27d4eb4f,%rcx
ae b2 c2
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1d,%ecx
xor    %ecx,%eax
cltq
movabs $0x165667b19e3779f9,%rcx
67 56 16
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @hash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 33
%6 = xor i32 %3, %5
%7 = sext i32 %6 to i64
%8 = mul i64 %7, -4417276706812531889
%9 = trunc i64 %8 to i32
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 29
%13 = xor i32 %10, %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 1609587929392839161
%16 = trunc i64 %15 to i32
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = ashr i32 %18, 32
%20 = xor i32 %17, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @hash(i32 %0) {
ret i32 poison
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void rtl_timespecmono(struct timespec *tv) {
  struct timeval now;
  gettimeofday(&now, NULL);
  tv->tv_sec = now.tv_sec;
  tv->tv_nsec = now.tv_usec * 1000;
}


x86 assembly (clang, -O0):
<rtl_timespecmono>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
imul   $0x3e8,-0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl_timespecmono>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x4(%rbx)
imul   $0x3e8,0x8(%rsp),%eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @rtl_timespecmono(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
%3 = alloca %struct.timeval
store %struct.timespec* %0, %struct.timespec** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%6 = load i32, i32* %5
%7 = load %struct.timespec*, %struct.timespec** %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 1
store i32 %6, i32* %8
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000
%12 = load %struct.timespec*, %struct.timespec** %2
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @rtl_timespecmono(%struct.timespec* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, 1000
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
store i32 %10, i32* %11
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
uint32_t readl(void *addr) { return *((volatile uint32_t *)addr); }


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

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

LLVM IR (-O0):
define i32 @readl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @readl(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
void push_back(double *v, int nv, double back) {
  int i;
  for (i = 0; i < nv - 1; i++)
    v[i] = v[i + 1];
  v[nv - 1] = back;
}


x86 assembly (clang, -O0):
<push_back>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1155 <push_back+0x55>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <push_back+0x17>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_back>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    -0x1(%rsi),%ebp
cmp    $0x2,%esi
jl     113a <push_back+0x2a>
lea    0x8(%rbx),%rsi
mov    %ebp,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
movsd  %xmm0,(%rsp)
call   1030 <memmove@plt>
movsd  (%rsp),%xmm0
movslq %ebp,%rax
movsd  %xmm0,(%rbx,%rax,8)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @push_back(double* nocapture %0, i32 %1, double %2) {
%4 = add i32 %1, -1
%5 = icmp sgt i32 %1, 1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = bitcast double* %0 to i8*
%8 = getelementptr double, double* %0, i64 1
%9 = bitcast double* %8 to i8*
%10 = zext i32 %4 to i64
%11 = shl nuw nsw i64 %10, 3
br label %12
12: ; preds = %6, %3
%13 = sext i32 %4 to i64
%14 = getelementptr inbounds double, double* %0, i64 %13
store double %2, double* %14
ret void
}
char valueToHexCh(const int value) {
  char result = '\0';
  if (value >= 0 && value <= 9) {
    result = (char)(value + 48);
  } else if (value >= 10 && value <= 15) {
    result = (char)(value - 10 + 65);
  } else {
    ;
  }
  return result;
}


x86 assembly (clang, -O0):
<valueToHexCh>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     112d <valueToHexCh+0x2d>
cmpl   $0x9,-0x4(%rbp)
jg     112d <valueToHexCh+0x2d>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x5(%rbp)
jmp    115c <valueToHexCh+0x5c>
cmpl   $0xa,-0x4(%rbp)
jl     1152 <valueToHexCh+0x52>
cmpl   $0xf,-0x4(%rbp)
jg     1152 <valueToHexCh+0x52>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %al,-0x5(%rbp)
jmp    1157 <valueToHexCh+0x57>
jmp    1157 <valueToHexCh+0x57>
jmp    115c <valueToHexCh+0x5c>
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valueToHexCh>:
mov    %edi,%eax
cmp    $0x9,%edi
ja     110a <valueToHexCh+0xa>
add    $0x30,%al
ret
lea    -0xa(%rax),%ecx
cmp    $0x5,%ecx
ja     1115 <valueToHexCh+0x15>
add    $0x37,%al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define signext i8 @valueToHexCh(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = trunc i32 %0 to i8
%5 = add nuw nsw i8 %4, 48
br label %12
6: ; preds = %1
%7 = add i32 %0, -10
%8 = icmp ult i32 %7, 6
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = trunc i32 %0 to i8
%11 = add nuw nsw i8 %10, 55
br label %12
12: ; preds = %9, %6, %3
%13 = phi i8 [ %5, %3 ], [ %11, %9 ], [ 0, %6 ]
ret i8 %13
}
/* Variables and functions */
scalar_t__ is_char(char const);
int __char_len(const char *s) {
  int l;
  for (l = 0; is_char(*s); l++)
    s++;
  return l;
}


x86 assembly (clang, -O0):
<__char_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_char@plt>
cmp    $0x0,%rax
je     1153 <__char_len+0x43>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <__char_len+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__char_len>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl (%rdi),%edi
call   1030 <is_char@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1144 <__char_len+0x34>
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%r14,%rbx,1),%edi
call   1030 <is_char@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <__char_len+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @__char_len(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = call i64 @is_char(i8 signext %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
br label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @__char_len(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @is_char(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 0, %1 ]
%7 = phi i8* [ %8, %5 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = add nuw nsw i32 %6, 1
%10 = load i8, i8* %8
%11 = tail call i64 @is_char(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %14
}
char *(strchr)(const char *src, int ch) {
  char *result = (char *)src;
  while (*result != '\0') {
    if (*result == (char)ch) {
      break;
    }
  }
  return (*result == '\0') ? ((void *)0) : result;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1142 <strchr+0x42>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    -0xc(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    113d <strchr+0x3d>
jmp    1142 <strchr+0x42>
jmp    1113 <strchr+0x13>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115d <strchr+0x5d>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1165 <strchr+0x65>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
movsbl (%rdi),%eax
test   %eax,%eax
je     1112 <strchr+0x12>
movsbl %sil,%ecx
cmp    %eax,%ecx
je     1112 <strchr+0x12>
nop
jmp    1110 <strchr+0x10>
xor    %ecx,%ecx
test   %al,%al
cmove  %rcx,%rdi
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
%5 = sext i8 %3 to i32
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
%8 = icmp eq i32 %7, %5
%9 = select i1 %4, i1 true, i1 %8
br i1 %9, label %11, label %10
10: ; preds = %2, %10
br label %10
11: ; preds = %2
%12 = select i1 %4, i8* null, i8* %0
ret i8* %12
}
/* Variables and functions */
int atoi(char *);
char *conf_get_str(char *, char *);
int conf_get_num(char *section, char *tag, int def) {
  char *value = conf_get_str(section, tag);
  if (value)
    return (atoi(value));
  return (def);
}


x86 assembly (clang, -O0):
<conf_get_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <conf_get_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1160 <conf_get_num+0x40>
mov    -0x28(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1166 <conf_get_num+0x46>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_get_num>:
push   %rbx
mov    %edx,%ebx
call   1030 <conf_get_str@plt>
test   %rax,%rax
je     1136 <conf_get_num+0x16>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <atoi@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @conf_get_num(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @conf_get_str(i8* %0, i8* %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @atoi(i8* %4)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ %2, %3 ]
ret i32 %9
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void USBHostPwrDisable(uint32_t ui32Base) {
  ;
  (*((volatile unsigned short *)(ui32Base + 0x00000400))) &= ~0x00000004;
}


x86 assembly (clang, -O0):
<USBHostPwrDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x400(%rax),%cx
movzwl %cx,%ecx
and    $0xfffffffb,%ecx
mov    %cx,0x400(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostPwrDisable>:
andw   $0xfffb,0x400(%rdi)
fb
ret

LLVM IR (-O0):
define void @USBHostPwrDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 1024
%5 = inttoptr i64 %4 to i16*
%6 = load volatile i16, i16* %5
%7 = zext i16 %6 to i32
%8 = and i32 %7, -5
%9 = trunc i32 %8 to i16
store volatile i16 %9, i16* %5
ret void
}

LLVM IR (-O2):
define void @USBHostPwrDisable(i64 %0) {
%2 = add nsw i64 %0, 1024
%3 = inttoptr i64 %2 to i16*
%4 = load volatile i16, i16* %3
%5 = and i16 %4, -5
store volatile i16 %5, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ARCH_SET_FS;
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ arch_prctl(int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void set_fs(void *addr) {
  if (arch_prctl(ARCH_SET_FS, (unsigned long)addr)) {
    perror("arch_prctl(ARCH_SET_FS)");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<set_fs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <arch_prctl@plt>
cmp    $0x0,%rax
je     1172 <set_fs+0x42>
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_fs>:
push   %rax
mov    %rdi,%rsi
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1030 <arch_prctl@plt>
test   %rax,%rax
jne    1149 <set_fs+0x19>
pop    %rax
ret
lea    0xeb0(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@ARCH_SET_FS = global i32 0
@.str = [24 x i8] c"arch_prctl(ARCH_SET_FS)\00"
@EXIT_FAILURE = global i32 0
define void @set_fs(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ARCH_SET_FS
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = call i64 @arch_prctl(i32 %3, i64 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@ARCH_SET_FS = global i32 0
@.str = [24 x i8] c"arch_prctl(ARCH_SET_FS)\00"
@EXIT_FAILURE = global i32 0
define void @set_fs(i8* %0) {
%2 = load i32, i32* @ARCH_SET_FS
%3 = ptrtoint i8* %0 to i64
%4 = tail call i64 @arch_prctl(i32 %2, i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}
/* Variables and functions */
void *realloc(void *, size_t);
void *xmalloc_fatal(size_t);
void *xrealloc(void *ptr, size_t size) {
  void *p = realloc(ptr, size);
  if (p == NULL) {
    return xmalloc_fatal(size);
  }
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115e <xrealloc+0x3e>
mov    -0x18(%rbp),%rdi
call   1040 <xmalloc_fatal@plt>
mov    %rax,-0x8(%rbp)
jmp    1166 <xrealloc+0x46>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
mov    %rsi,%rbx
call   1030 <realloc@plt>
test   %rax,%rax
je     1130 <xrealloc+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <xmalloc_fatal@plt>

LLVM IR (-O0):
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = call i8* @realloc(i8* %7, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i64, i64* %5
%14 = call i8* @xmalloc_fatal(i64 %13)
store i8* %14, i8** %3
br label %17
15: ; preds = %2
%16 = load i8*, i8** %6
store i8* %16, i8** %3
br label %17
17: ; preds = %15, %12
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* @xmalloc_fatal(i64 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ %3, %2 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d;
  scanf("%d", &d);
  printf("%d minutos\n", (d * 2));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    %esi,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%d minutos\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl nsw i32 %4, 1
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ writePeriod(int);
void writePeriods(int count, int freq) {
  for (int i = 0; i < count; i++) {
    writePeriod(freq);
  }
}


x86 assembly (clang, -O0):
<writePeriods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1147 <writePeriods+0x37>
mov    -0x8(%rbp),%edi
call   1030 <writePeriod@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <writePeriods+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writePeriods>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112c <writePeriods+0x1c>
mov    %esi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <writePeriod@plt>
add    $0xffffffff,%ebp
jne    1120 <writePeriods+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @writePeriods(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %5, label %4
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @writePeriod(i32 %1)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %4, label %5
}
double freqbin2freq(double fs, int fft_len, int freqbin) {
  double delta_f;
  double f;
  delta_f = fs / fft_len;
  f = freqbin * delta_f;
  return f;
}


x86 assembly (clang, -O0):
<freqbin2freq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<freqbin2freq>:
cvtsi2sd %edi,%xmm1
divsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @freqbin2freq(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load double, double* %4
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
store double %12, double* %7
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to double
%15 = load double, double* %7
%16 = fmul double %14, %15
store double %16, double* %8
%17 = load double, double* %8
ret double %17
}

LLVM IR (-O2):
define double @freqbin2freq(double %0, i32 %1, i32 %2) {
%4 = sitofp i32 %1 to double
%5 = fdiv double %0, %4
%6 = sitofp i32 %2 to double
%7 = fmul double %5, %6
ret double %7
}
/* Variables and functions */
double log(double);
double oates_cohen_function(double d1, double d2) {
  double the_result;
  if ((d1 == 0) && (d2 == 0))
    the_result = 0;
  else
    the_result = d1 * log(d2);
  return the_result;
}


x86 assembly (clang, -O0):
<oates_cohen_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115f <oates_cohen_function+0x4f>
jp     115f <oates_cohen_function+0x4f>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115f <oates_cohen_function+0x4f>
jp     115f <oates_cohen_function+0x4f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1184 <oates_cohen_function+0x74>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oates_cohen_function>:
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    112d <oates_cohen_function+0x1d>
jp     112d <oates_cohen_function+0x1d>
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    112d <oates_cohen_function+0x1d>
jp     112d <oates_cohen_function+0x1d>
ret
push   %rax
movapd %xmm1,%xmm0
movsd  %xmm3,(%rsp)
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
add    $0x8,%rsp
ret

LLVM IR (-O0):
define double @oates_cohen_function(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 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double, double* %4
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store double 0.000000e+00, double* %5
br label %17
12: ; preds = %8, %2
%13 = load double, double* %3
%14 = load double, double* %4
%15 = call double @log(double %14)
%16 = fmul double %13, %15
store double %16, double* %5
br label %17
17: ; preds = %12, %11
%18 = load double, double* %5
ret double %18
}

LLVM IR (-O2):
define double @oates_cohen_function(double %0, double %1) {
%3 = fcmp oeq double %0, 0.000000e+00
%4 = fcmp oeq double %1, 0.000000e+00
%5 = and i1 %3, %4
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call double @log(double %1)
%8 = fmul double %7, %0
br label %9
9: ; preds = %2, %6
%10 = phi double [ %8, %6 ], [ 0.000000e+00, %2 ]
ret double %10
}
int Test() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Test() {
ret i32 0
}