xunge/DecIR huggingface dataset:
int test_imm_C9uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xC9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_C9uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 13172736
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct packet {
  int dummy;
};

/* Variables and functions */
unsigned char *create_kv_packet(unsigned char const *, int,
                                unsigned char const *, size_t, struct packet *,
                                unsigned char *);
unsigned char *create_signature_packet(const unsigned char *signature,
                                       size_t signature_sz, struct packet *pkt,
                                       unsigned char *ptr) {
  return create_kv_packet((const unsigned char *)"signature",
                          (sizeof("signature") - 1), signature, signature_sz,
                          pkt, ptr);
}


x86 assembly (clang, -O0):
<create_signature_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xec1(%rip),%rdi
mov    $0x9,%esi
call   1030 <create_kv_packet@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_signature_packet>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xedd(%rip),%rdi
mov    $0x9,%esi
jmp    1030 <create_kv_packet@plt>

LLVM IR (-O0):
%struct.packet = type { i32 }
@.str = [10 x i8] c"signature\00"
define i8* @create_signature_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.packet*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store %struct.packet* %2, %struct.packet** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load %struct.packet*, %struct.packet** %7
%12 = load i8*, i8** %8
%13 = call i8* @create_kv_packet(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9, i8* %9, i64 %10, %struct.packet* %11, i8* %12)
ret i8* %13
}

LLVM IR (-O2):
%struct.packet = type { i32 }
@.str = [10 x i8] c"signature\00"
define i8* @create_signature_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = tail call i8* @create_kv_packet(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9, i8* %0, i64 %1, %struct.packet* %2, i8* %3)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int strlen(char const *);
int write(int, char const *, int);
int serialport_write(int fd, const char *str) {
  int len = strlen(str);
  int n = write(fd, str, len);
  if (n != len) {
    perror("serialport_write: couldn't write whole string \n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<serialport_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1181 <serialport_write+0x51>
lea    0xe90(%rip),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <serialport_write+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport_write>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebp,%ecx
jne    115e <serialport_write+0x2e>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe9b(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
jmp    1159 <serialport_write+0x29>

LLVM IR (-O0):
@.str = [48 x i8] c"serialport_write: couldn't write whole string \0A\00"
define i32 @serialport_write(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @write(i32 %10, i8* %11, i32 %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @perror(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [48 x i8] c"serialport_write: couldn't write whole string \0A\00"
define i32 @serialport_write(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, %3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
void conio_set_color_to_palette(unsigned short col, unsigned char id) {
  volatile unsigned short *vdp2_cram =
      (volatile unsigned short *)(0x25e00000 + 0x100000);
  vdp2_cram[id] = col;
}


x86 assembly (clang, -O0):
<conio_set_color_to_palette>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    $0x25f00000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rax
movzbl -0x3(%rbp),%ecx
mov    %dx,(%rax,%rcx,2)
pop    %rbp
ret

x86 assembly (clang, -O2):
<conio_set_color_to_palette>:
mov    %esi,%eax
mov    %di,0x25f00000(%rax,%rax,1)
25
ret

LLVM IR (-O0):
define void @conio_set_color_to_palette(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
%5 = alloca i16*
store i16 %0, i16* %3
store i8 %1, i8* %4
store i16* inttoptr (i64 636485632 to i16*), i16** %5
%6 = load i16, i16* %3
%7 = load i16*, i16** %5
%8 = load i8, i8* %4
%9 = zext i8 %8 to i64
%10 = getelementptr inbounds i16, i16* %7, i64 %9
store volatile i16 %6, i16* %10
ret void
}

LLVM IR (-O2):
define void @conio_set_color_to_palette(i16 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i64
%4 = getelementptr inbounds i16, i16* inttoptr (i64 636485632 to i16*), i64 %3
store volatile i16 %0, i16* %4
ret void
}
int default_brightness_step(struct backlight *b) { return 1; }


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

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

LLVM IR (-O0):
%struct.backlight = type opaque
define i32 @default_brightness_step(%struct.backlight* %0) {
%2 = alloca %struct.backlight*
store %struct.backlight* %0, %struct.backlight** %2
ret i32 1
}

LLVM IR (-O2):
%struct.backlight = type opaque
define i32 @default_brightness_step(%struct.backlight* nocapture readnone %0) {
ret i32 1
}
char *version_get_build_time() { return "Unknown build time"; }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Unknown build time\00"
define i8* @version_get_build_time() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [19 x i8] c"Unknown build time\00"
define i8* @version_get_build_time() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ net_send(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
void irc_quit(char *message) {
  char msg[(512 - 3)];
  snprintf(msg, (512 - 3), "%s :%s", "QUIT", message);
  net_send(msg);
}


x86 assembly (clang, -O0):
<irc_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x1fd,%esi
lea    0xeba(%rip),%rdx
lea    0xeba(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <net_send@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_quit>:
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%r8
lea    0xece(%rip),%rdx
lea    0xece(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1fd,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <net_send@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s :%s\00"
@.str.1 = [5 x i8] c"QUIT\00"
define void @irc_quit(i8* %0) {
%2 = alloca i8*
%3 = alloca [509 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [509 x i8], [509 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @snprintf(i8* %4, i32 509, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [509 x i8], [509 x i8]* %3, i64 0, i64 0
%8 = call i32 @net_send(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s :%s\00"
@.str.1 = [5 x i8] c"QUIT\00"
define void @irc_quit(i8* %0) {
%2 = alloca [509 x i8]
%3 = getelementptr inbounds [509 x i8], [509 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 509, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = call i32 @net_send(i8* %3)
ret void
}
/* Variables and functions */
int pm8058_mpp_config(unsigned int, int, unsigned int, unsigned int);
int pm8058_mpp_config_current_sink(unsigned mpp, unsigned level,
                                   unsigned control) {
  return pm8058_mpp_config(mpp, 5, level, control);
}


x86 assembly (clang, -O0):
<pm8058_mpp_config_current_sink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x5,%esi
call   1030 <pm8058_mpp_config@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm8058_mpp_config_current_sink>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x5,%esi
jmp    1030 <pm8058_mpp_config@plt>

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

LLVM IR (-O2):
define i32 @pm8058_mpp_config_current_sink(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @pm8058_mpp_config(i32 %0, i32 5, i32 %1, i32 %2)
ret i32 %4
}
int test_imm_83uint16_mem(unsigned short *val) {
  return ((*val) & (-0x83 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_83uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff7d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_83uint16_mem>:
movzwl (%rdi),%eax
test   $0xff7d,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_83uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -131
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int ft_str_is_alpha(char *str) {
  char *tmp;
  tmp = str;
  while (*tmp) {
    if (!(*tmp >= 'a' && *tmp <= 'z') && !(*tmp >= 'A' && *tmp <= 'Z'))
      return (0);
    tmp++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_str_is_alpha>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     117a <ft_str_is_alpha+0x7a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     113d <ft_str_is_alpha+0x3d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jle    1169 <ft_str_is_alpha+0x69>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     115d <ft_str_is_alpha+0x5d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jle    1169 <ft_str_is_alpha+0x69>
movl   $0x0,-0x4(%rbp)
jmp    1181 <ft_str_is_alpha+0x81>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <ft_str_is_alpha+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_str_is_alpha>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1126 <ft_str_is_alpha+0x26>
add    $0x1,%rdi
nop
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x1a,%cl
jae    1127 <ft_str_is_alpha+0x27>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_str_is_alpha+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ft_str_is_alpha(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
store i8* %5, i8** %4
br label %6
6: ; preds = %31, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %34
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 122
br i1 %19, label %31, label %20
20: ; preds = %15, %10
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 90
br i1 %29, label %31, label %30
30: ; preds = %25, %20
store i32 0, i32* %2
br label %35
31: ; preds = %25, %15
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
br label %6
34: ; preds = %6
store i32 1, i32* %2
br label %35
35: ; preds = %34, %30
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @ft_str_is_alpha(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %7
4: ; preds = %7
%5 = load i8, i8* %13
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %13, %4 ], [ %0, %1 ]
%10 = and i8 %8, -33
%11 = add i8 %10, -65
%12 = icmp ult i8 %11, 26
%13 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %12, label %4, label %14
14: ; preds = %4, %7, %1
%15 = phi i32 [ 1, %1 ], [ 0, %7 ], [ 1, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_byte(unsigned char);
void console_tx_char(unsigned char byte) { console_tx_byte(byte); }


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

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

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

LLVM IR (-O2):
define void @console_tx_char(i8 zeroext %0) {
%2 = tail call i32 @console_tx_byte(i8 zeroext %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
const char *signame(int signal) {
  switch (signal) {}
  static char s[200];
  snprintf(s, sizeof(s), "signal %d", signal);
  return s;
}


x86 assembly (clang, -O0):
<signame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0x2f1b(%rip),%rdi
mov    $0xc8,%esi
lea    0xecf(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2f03(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signame>:
push   %rbx
mov    %edi,%ecx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rdx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@signame.s = internal global [200 x i8] zeroinitializer
@.str = [10 x i8] c"signal %d\00"
define i8* @signame(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %4 [
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 @snprintf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @signame.s, i64 0, i64 0), i32 200, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @signame.s, i64 0, i64 0)
}

LLVM IR (-O2):
@signame.s = internal global [200 x i8] zeroinitializer
@.str = [10 x i8] c"signal %d\00"
define i8* @signame(i32 %0) {
%2 = tail call i32 @snprintf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @signame.s, i64 0, i64 0), i32 200, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @signame.s, i64 0, i64 0)
}
void dr1062(const void *pcv, volatile void *pvv, int i) {
  *pcv;
  i ? *pcv : *pcv;
  *pcv, *pcv;
  *pvv;
  i ? *pvv : *pvv;
  *pvv, *pvv;
}


x86 assembly (clang, -O0):
<dr1062>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     111e <dr1062+0x1e>
jmp    111e <dr1062+0x1e>
cmpl   $0x0,-0x14(%rbp)
je     112d <dr1062+0x2d>
jmp    112d <dr1062+0x2d>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @dr1062(i8* nocapture %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage() {
  printf("kermit_show_image x y width height file waveform_mode\n");
}


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

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

LLVM IR (-O0):
@.str = [55 x i8] c"kermit_show_image x y width height file waveform_mode\0A\00"
define void @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [54 x i8] c"kermit_show_image x y width height file waveform_mode\00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
ret void
}
void test122_SleepWakeImpl_wake__E() {}


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

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

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

LLVM IR (-O2):
define void @test122_SleepWakeImpl_wake__E() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ puts(char const *);
void Log1(const char *prompt, unsigned p1) {
  puts(prompt);
  printf("\tparameter: %u\n", p1);
}


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

x86 assembly (clang, -O2):
<Log1>:
push   %rbx
mov    %esi,%ebx
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"\09parameter: %u\0A\00"
define void @Log1(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 i32 @puts(i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"\09parameter: %u\0A\00"
define void @Log1(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct at_dma {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ atc_setup_irq(struct at_dma *, int, int /*<<< orphan*/);
void atc_disable_chan_irq(struct at_dma *atdma, int chan_id) {
  atc_setup_irq(atdma, chan_id, 0);
}


x86 assembly (clang, -O0):
<atc_disable_chan_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <atc_setup_irq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atc_disable_chan_irq>:
xor    %edx,%edx
jmp    1030 <atc_setup_irq@plt>

LLVM IR (-O0):
%struct.at_dma = type { i32 }
define void @atc_disable_chan_irq(%struct.at_dma* %0, i32 %1) {
%3 = alloca %struct.at_dma*
%4 = alloca i32
store %struct.at_dma* %0, %struct.at_dma** %3
store i32 %1, i32* %4
%5 = load %struct.at_dma*, %struct.at_dma** %3
%6 = load i32, i32* %4
%7 = call i32 @atc_setup_irq(%struct.at_dma* %5, i32 %6, i32 0)
ret void
}

LLVM IR (-O2):
%struct.at_dma = type { i32 }
define void @atc_disable_chan_irq(%struct.at_dma* %0, i32 %1) {
%3 = tail call i32 @atc_setup_irq(%struct.at_dma* %0, i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void command_help(char const *progname, char const *const *argv,
                  char const *filename, int line) {
  puts("Graphgrmap is a test client for the graph_grmap data type in "
       "libgraph.a\n"
       "\n"
       "Quickreference:\n"
       "    initialize           finish           invariant\n"
       "    help                 add X Y N\n"
       "    quit                 read [path]      check [path]\n"
       "    tabsize              write [path]\n"
       "            \n");
}


x86 assembly (clang, -O0):
<command_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [283 x i8] c"Graphgrmap is a test client for the graph_grmap data type in libgraph.a\0A\0AQuickreference:\0A initialize finish invariant\0A help add X Y N\0A quit read [path] check [path]\0A tabsize write [path]\0A \0A\00"
define void @command_help(i8* %0, i8** %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = call i32 @puts(i8* getelementptr inbounds ([283 x i8], [283 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [283 x i8] c"Graphgrmap is a test client for the graph_grmap data type in libgraph.a\0A\0AQuickreference:\0A initialize finish invariant\0A help add X Y N\0A quit read [path] check [path]\0A tabsize write [path]\0A \0A\00"
define void @command_help(i8* nocapture readnone %0, i8** nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([283 x i8], [283 x i8]* @.str, i64 0, i64 0))
ret void
}
void polfs_(n, parray) int *n;
short parray[][3];
{ polfs((long)*n, parray); }


x86 assembly (clang, -O0):
<polfs_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <polfs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polfs_>:
movslq (%rdi),%rdi
xor    %eax,%eax
jmp    1030 <polfs@plt>

LLVM IR (-O0):
define void @polfs_(i32* %0, [3 x i16]* %1) {
%3 = alloca i32*
%4 = alloca [3 x i16]*
store i32* %0, i32** %3
store [3 x i16]* %1, [3 x i16]** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = load [3 x i16]*, [3 x i16]** %4
%9 = call i32 (i64, [3 x i16]*, ...) bitcast (i32 (...)* @polfs to i32 (i64, [3 x i16]*, ...)*)(i64 %7, [3 x i16]* %8)
ret void
}

LLVM IR (-O2):
define void @polfs_(i32* nocapture %0, [3 x i16]* %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = tail call i32 (i64, [3 x i16]*, ...) bitcast (i32 (...)* @polfs to i32 (i64, [3 x i16]*, ...)*)(i64 %4, [3 x i16]* %1)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR79_get(void) { return U_WMRCORENONE_get("U_WMR79"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR79\00"
define i32 @U_WMR79_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR79\00"
define i32 @U_WMR79_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
typedef int GLfloat;

/* Variables and functions */
int sqrtf(int);
GLfloat vec_length(GLfloat *v) {
  return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}


x86 assembly (clang, -O0):
<vec_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
imul   (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x8(%rbp),%rcx
imul   0x4(%rcx),%eax
add    %eax,%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x8(%rbp),%rcx
imul   0x8(%rcx),%eax
add    %eax,%edi
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_length>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
imul   %eax,%eax
imul   %ecx,%ecx
add    %eax,%ecx
mov    0x8(%rdi),%edi
imul   %edi,%edi
add    %ecx,%edi
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define i32 @vec_length(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 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %5, %8
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = mul nsw i32 %12, %15
%17 = add nsw i32 %9, %16
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load i32*, i32** %2
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = mul nsw i32 %20, %23
%25 = add nsw i32 %17, %24
%26 = call i32 @sqrtf(i32 %25)
ret i32 %26
}

LLVM IR (-O2):
define i32 @vec_length(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul nsw i32 %2, %2
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, %5
%7 = add nuw nsw i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, %9
%11 = add nuw nsw i32 %7, %10
%12 = tail call i32 @sqrtf(i32 %11)
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fail(int, char const *, unsigned int, char *, long);
void *malloc(size_t);
void *smalloc(size_t size, const char *file, unsigned line) {
  void *restrict res = malloc(size);
  if (!res && size)
    fail(1, file, line, "allocation of %ld bytes failed\n", (long)size);
  return res;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <smalloc+0x52>
cmpq   $0x0,-0x8(%rbp)
je     1172 <smalloc+0x52>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%r8
mov    $0x1,%edi
lea    0xe93(%rip),%rcx
call   1030 <fail@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smalloc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rbx,%rbx
je     115c <smalloc+0x3c>
test   %rbp,%rbp
jne    115c <smalloc+0x3c>
lea    0xeb7(%rip),%rcx
mov    $0x1,%edi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbx,%r8
call   1030 <fail@plt>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [32 x i8] c"allocation of %ld bytes failed\0A\00"
define noalias i8* @smalloc(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @malloc(i64 %0)
%5 = icmp eq i8* %4, null
%6 = icmp ne i64 %0, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @fail(i32 1, i8* %1, i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %10
10: ; preds = %8, %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ test();
int main(void) {
  test();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
ret i32 0
}
dnint(dev) { wakeup(0175200); }


x86 assembly (clang, -O0):
<dnint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0xfa80,%edi
mov    $0x0,%al
call   1030 <wakeup@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnint>:
mov    $0xfa80,%edi
xor    %eax,%eax
jmp    1030 <wakeup@plt>

LLVM IR (-O0):
define i32 @dnint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @wakeup to i32 (i32, ...)*)(i32 64128)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @dnint(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @wakeup to i32 (i32, ...)*)(i32 64128)
ret i32 undef
}
/* Variables and functions */
int funk(int, int);
int hemmelig_funksjon(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = funk(2, 3);
  printf("%d\n", a);
  printf("%d\n", hemmelig_funksjon(2, 3));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <funk@plt>
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1040 <hemmelig_funksjon@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @funk(i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @hemmelig_funksjon(i32 2, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Ws(char *);
int Winst8(int i, int code) {
  Ws("Inst 8xxx");
  return 0;
}


x86 assembly (clang, -O0):
<Winst8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <Ws@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Winst8>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <Ws@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Inst 8xxx\00"
define i32 @Winst8(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @Ws(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Inst 8xxx\00"
define i32 @Winst8(i32 %0, i32 %1) {
%3 = tail call i32 @Ws(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int titleToNumber(char *s) {
  int n = 0;
  while (*s)
    n = n * 26 + *s++ - 'A' + 1;
  return n;
}


x86 assembly (clang, -O0):
<titleToNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <titleToNumber+0x42>
imul   $0x1a,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x41,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <titleToNumber+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<titleToNumber>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <titleToNumber+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%rax,%rax,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
add    $0xffffffc0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <titleToNumber+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @titleToNumber(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i32 [ %12, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 26
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, -64
%12 = add i32 %11, %10
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %12, %4 ]
ret i32 %16
}
int sign(int x) { return 2; }


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

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

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

LLVM IR (-O2):
define i32 @sign(i32 %0) {
ret i32 2
}
/* Type definitions */
typedef int *__m128d;

/* Variables and functions */
int __attribute__((__always___, __nodebug__)) _mm_cvttsd_si32(__m128d a) {
  return a[0];
}


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

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

LLVM IR (-O0):
define i32 @_mm_cvttsd_si32(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @_mm_cvttsd_si32(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_arm_ldc2(int, int, void const *);
void ldc2(const void *i) { __builtin_arm_ldc2(1, 2, i); }


x86 assembly (clang, -O0):
<ldc2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <__builtin_arm_ldc2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldc2>:
mov    %rdi,%rdx
mov    $0x1,%edi
mov    $0x2,%esi
jmp    1030 <__builtin_arm_ldc2@plt>

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

LLVM IR (-O2):
define void @ldc2(i8* %0) {
%2 = tail call i32 @__builtin_arm_ldc2(i32 1, i32 2, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo32(double);
int /*<<< orphan*/ printf(char *);
int __attribute__((mips16)) main() {
  foo32(4.5678);
  printf("main  \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
call   1040 <foo32@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
call   1040 <foo32@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [7 x i8] c"main \00"
define i32 @main() {
%1 = tail call i32 @foo32(double 4.567800e+00)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


x86 assembly (clang, -O0):
<SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter = [62 x i8] c"SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter\00"
define void @SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter = [62 x i8] c"SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter\00"
define void @SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert_equal_int(int, int, char *, char *);
int pl_startswith(char *, char *);
void test_startwith_empy_string() {
  char the_string[] = "";
  int ret_val = pl_startswith(the_string, "asd");
  assert_equal_int(-1, ret_val, "test_startwith_empy_string",
                   "The function did not return the correct error value.");
}


x86 assembly (clang, -O0):
<test_startwith_empy_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x1(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
lea    -0x1(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1040 <pl_startswith@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xffffffff,%edi
lea    0xe9a(%rip),%rdx
lea    0xeae(%rip),%rcx
call   1050 <assert_equal_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_startwith_empy_string>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xed3(%rip),%rsi
lea    0x7(%rsp),%rdi
call   1030 <pl_startswith@plt>
lea    0xec6(%rip),%rdx
lea    0xeda(%rip),%rcx
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1040 <assert_equal_int@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"asd\00"
@.str.1 = [27 x i8] c"test_startwith_empy_string\00"
@.str.2 = [53 x i8] c"The function did not return the correct error value.\00"
define void @test_startwith_empy_string() {
%1 = alloca [1 x i8]
%2 = alloca i32
%3 = bitcast [1 x i8]* %1 to i8*
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%5 = call i32 @pl_startswith(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @assert_equal_int(i32 -1, i32 %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"asd\00"
@.str.1 = [27 x i8] c"test_startwith_empy_string\00"
@.str.2 = [53 x i8] c"The function did not return the correct error value.\00"
define void @test_startwith_empy_string() {
%1 = alloca [1 x i8]
%2 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%3 = call i32 @pl_startswith(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @assert_equal_int(i32 -1, i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int get_first_child_index(int parent_index) {
  if (0)
    printf("Parent_i %d -> Child_i %d\n", parent_index, 2 * parent_index + 1);
  return (2 * parent_index + 1);
}


x86 assembly (clang, -O0):
<get_first_child_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_first_child_index>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @get_first_child_index(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
void glmCopyVector2f(const float source[2], float target[2]) {
  target[0] = source[0];
  target[1] = source[1];
}


x86 assembly (clang, -O0):
<glmCopyVector2f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmCopyVector2f>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x4(%rsi)
ret

LLVM IR (-O0):
define void @glmCopyVector2f(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
ret void
}

LLVM IR (-O2):
define void @glmCopyVector2f(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
store float %3, float* %1
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 1
store float %5, float* %6
ret void
}