xunge/DecIR huggingface dataset:
void foo() {
  int voodoo;
  voodoo = voodoo + 1;
}


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

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

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Type definitions */
struct item_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ reiserfs_warning(char *);
void errcatch_check_item(struct item_head *ih, char *item) {
  reiserfs_warning("green-16005: Invalid item type observed, run fsck ASAP\n");
}


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

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

LLVM IR (-O0):
%struct.item_head = type { i32 }
@.str = [56 x i8] c"green-16005: Invalid item type observed, run fsck ASAP\0A\00"
define void @errcatch_check_item(%struct.item_head* %0, i8* %1) {
%3 = alloca %struct.item_head*
%4 = alloca i8*
store %struct.item_head* %0, %struct.item_head** %3
store i8* %1, i8** %4
%5 = call i32 @reiserfs_warning(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.item_head = type { i32 }
@.str = [56 x i8] c"green-16005: Invalid item type observed, run fsck ASAP\0A\00"
define void @errcatch_check_item(%struct.item_head* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @reiserfs_warning(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct scatterlist {
  int dummy;
};

/* Variables and functions */
scalar_t__ likely(int);
int sg_nents_for_len(struct scatterlist *, int);
int sg_count(struct scatterlist *sg_list, int nbytes) {
  int sg_nents = sg_nents_for_len(sg_list, nbytes);
  if (likely(sg_nents == 1))
    return 0;
  return sg_nents;
}


x86 assembly (clang, -O0):
<sg_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <sg_nents_for_len@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <likely@plt>
cmp    $0x0,%rax
je     1165 <sg_count+0x45>
movl   $0x0,-0x4(%rbp)
jmp    116b <sg_count+0x4b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_count>:
push   %rbx
call   1030 <sg_nents_for_len@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <likely@plt>
xor    %ecx,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.scatterlist = type { i32 }
define i32 @sg_count(%struct.scatterlist* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.scatterlist*
%5 = alloca i32
%6 = alloca i32
store %struct.scatterlist* %0, %struct.scatterlist** %4
store i32 %1, i32* %5
%7 = load %struct.scatterlist*, %struct.scatterlist** %4
%8 = load i32, i32* %5
%9 = call i32 @sg_nents_for_len(%struct.scatterlist* %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i64 @likely(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %18
16: ; preds = %2
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %18
18: ; preds = %16, %15
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.scatterlist = type { i32 }
define i32 @sg_count(%struct.scatterlist* %0, i32 %1) {
%3 = tail call i32 @sg_nents_for_len(%struct.scatterlist* %0, i32 %1)
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
%6 = tail call i64 @likely(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 %3, i32 0
ret i32 %8
}
/* Variables and functions */
scalar_t__ is_upper(char);
char to_lower(char c) { return is_upper(c) ? c - 'A' + 'a' : c; }


x86 assembly (clang, -O0):
<to_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <is_upper@plt>
cmp    $0x0,%rax
je     1143 <to_lower+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <to_lower+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_lower>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_upper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @to_lower(i8 signext %0) {
%2 = tail call i64 @is_upper(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
dhcp_client() {}


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

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

LLVM IR (-O0):
define i32 @dhcp_client() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @dhcp_client() {
ret i32 undef
}
void smc_outsw(unsigned int addr, const void *vbuf, unsigned long len) {
  volatile unsigned short *rp;
  unsigned short *buf, *ebuf;
  buf = (unsigned short *)vbuf;
  rp = (volatile unsigned short *)addr;
  for (ebuf = buf + len; (buf < ebuf);)
    *rp = *buf++;
}


x86 assembly (clang, -O0):
<smc_outsw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    115d <smc_outsw+0x5d>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x2,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%cx
mov    -0x20(%rbp),%rax
mov    %cx,(%rax)
jmp    1131 <smc_outsw+0x31>
pop    %rbp
ret

x86 assembly (clang, -O2):
<smc_outsw>:
lea    (%rsi,%rdx,2),%rax
cmp    %rsi,%rax
jbe    111f <smc_outsw+0x1f>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
movzwl (%rsi),%edx
add    $0x2,%rsi
mov    %dx,(%rcx)
cmp    %rax,%rsi
jb     1110 <smc_outsw+0x10>
ret

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

LLVM IR (-O2):
define void @smc_outsw(i32 %0, i8* %1, i64 %2) {
%4 = bitcast i8* %1 to i16*
%5 = zext i32 %0 to i64
%6 = inttoptr i64 %5 to i16*
%7 = getelementptr inbounds i16, i16* %4, i64 %2
%8 = icmp ugt i16* %7, %4
br i1 %8, label %9, label %14
9: ; preds = %3, %9
%10 = phi i16* [ %11, %9 ], [ %4, %3 ]
%11 = getelementptr inbounds i16, i16* %10, i64 1
%12 = load i16, i16* %10
store volatile i16 %12, i16* %6
%13 = icmp ult i16* %11, %7
br i1 %13, label %9, label %14
14: ; preds = %9, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int /*<<< orphan*/ stderr;
void dummy_set_temperature(void *user, float f) {
  fprintf(stderr, "GCodeParser: set_temperature(%.1f)\n", f);
}


x86 assembly (clang, -O0):
<dummy_set_temperature>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummy_set_temperature>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"GCodeParser: set_temperature(%.1f)\0A\00"
define void @dummy_set_temperature(i8* %0, float %1) {
%3 = alloca i8*
%4 = alloca float
store i8* %0, i8** %3
store float %1, float* %4
%5 = load i32, i32* @stderr
%6 = load float, float* %4
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"GCodeParser: set_temperature(%.1f)\0A\00"
define void @dummy_set_temperature(i8* nocapture readnone %0, float %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %1)
ret void
}
void RTStrFormatV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrFormatV() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CX4_immediate_reg(int);
void CX4_op70(void) { CX4_immediate_reg(27); }


x86 assembly (clang, -O0):
<CX4_op70>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <CX4_immediate_reg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CX4_op70>:
mov    $0x1b,%edi
jmp    1030 <CX4_immediate_reg@plt>

LLVM IR (-O0):
define void @CX4_op70() {
%1 = call i32 @CX4_immediate_reg(i32 27)
ret void
}

LLVM IR (-O2):
define void @CX4_op70() {
%1 = tail call i32 @CX4_immediate_reg(i32 27)
ret void
}
__attribute__((always_)) int pci_num_vf(struct pci_dev *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define i32 @pci_num_vf(%struct.pci_dev* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int pp_send(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int pong(char *addr_str) {
  printf(". send PONG to [%s].\n", addr_str);
  int ret = pp_send(addr_str, "PONG");
  return ret;
}


x86 assembly (clang, -O0):
<pong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <pp_send@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pong>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <pp_send@plt>

LLVM IR (-O0):
@.str = [22 x i8] c". send PONG to [%s].\0A\00"
@.str.1 = [5 x i8] c"PONG\00"
define i32 @pong(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @pp_send(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
@.str = [22 x i8] c". send PONG to [%s].\0A\00"
@.str.1 = [5 x i8] c"PONG\00"
define i32 @pong(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @pp_send(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
struct timeval {
  long long tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long GetMilliTimei(void) {
  struct timeval tv;
  int h = gettimeofday(&tv, NULL);
  assert(!h);
  return (long long)tv.tv_sec * 1000000 + tv.tv_usec;
}


x86 assembly (clang, -O0):
<GetMilliTimei>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
imul   $0xf4240,-0x8(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMilliTimei>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
imul   $0xf4240,0x10(%rsp),%rax
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @GetMilliTimei() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%10 = load i64, i64* %9
%11 = mul nsw i64 %10, 1000000
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%13 = load i64, i64* %12
%14 = add nsw i64 %11, %13
ret i64 %14
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @GetMilliTimei() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = mul nsw i64 %8, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%11 = load i64, i64* %10
%12 = add nsw i64 %9, %11
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ delayUs(int);
void delayMs(unsigned int t) {
  while (t--) {
    delayUs(1000);
  }
}


x86 assembly (clang, -O0):
<delayMs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     113e <delayMs+0x2e>
mov    $0x3e8,%edi
call   1030 <delayUs@plt>
jmp    111b <delayMs+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delayMs>:
push   %rbx
test   %edi,%edi
je     112f <delayMs+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edi
call   1030 <delayUs@plt>
add    $0xffffffff,%ebx
jne    1120 <delayMs+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @delayMs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add i32 %4, -1
%6 = tail call i32 @delayUs(i32 1000)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("hello"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
void ble_rsp_sm_set_bondable_mode(const void *nul) {}


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

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

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

LLVM IR (-O2):
define void @ble_rsp_sm_set_bondable_mode(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int DensitySolid(int /*<<< orphan*/);
int /*<<< orphan*/ GBackDensity(int, int);
int GBackSolid(int x, int y) { return DensitySolid(GBackDensity(x, y)); }


x86 assembly (clang, -O0):
<GBackSolid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <GBackDensity@plt>
mov    %eax,%edi
call   1040 <DensitySolid@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @GBackSolid(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 = call i32 @GBackDensity(i32 %5, i32 %6)
%8 = call i32 @DensitySolid(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @GBackSolid(i32 %0, i32 %1) {
%3 = tail call i32 @GBackDensity(i32 %0, i32 %1)
%4 = tail call i32 @DensitySolid(i32 %3)
ret i32 %4
}
void util_speak_init(const char *host, const int p) {}


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

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

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

LLVM IR (-O2):
define void @util_speak_init(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int shutdown(int, int);
int plat_shutdown(int s, int how) { return (shutdown(s, how)); }


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

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

LLVM IR (-O0):
define i32 @plat_shutdown(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 = call i32 @shutdown(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @plat_shutdown(i32 %0, i32 %1) {
%3 = tail call i32 @shutdown(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
void missing_error_check(const char *filename) {
  FILE *f = fopen(filename, "r");
  fclose(f);
}


x86 assembly (clang, -O0):
<missing_error_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<missing_error_check>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define void @missing_error_check(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @fclose(i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @missing_error_check(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fclose(i32* %2)
ret void
}
int benchmark_optswitch(int opt, char *optarg) { return (0); }


x86 assembly (clang, -O0):
<benchmark_optswitch>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @benchmark_optswitch(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @benchmark_optswitch(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int string_compare(const void *a, size_t a_len, const void *b, size_t b_len) {
  if (a_len != b_len)
    return (int)(a_len - b_len);
  return strcmp((const char *)a, (const char *)b);
}


x86 assembly (clang, -O0):
<string_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1146 <string_compare+0x36>
mov    -0x18(%rbp),%rax
sub    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1156 <string_compare+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_compare>:
cmp    %rcx,%rsi
jne    111d <string_compare+0xd>
mov    %rdx,%rsi
jmp    1030 <strcmp@plt>
sub    %ecx,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @string_compare(i8* nocapture %0, i64 %1, i8* nocapture %2, i64 %3) {
%5 = icmp eq i64 %1, %3
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = sub i64 %1, %3
%8 = trunc i64 %7 to i32
br label %11
9: ; preds = %4
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %2)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ %8, %6 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int select_main(int, char **);
int main(int argc, char **argv) {
  return select_main(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @select_main(i32 %0, i8** %1)
ret i32 %3
}
int test_imm_AAint32_mem(int *val) {
  return ((*val) & (0xAA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_AAint32_mem>:
testb  $0xaa,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_AAint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 170
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int coap_fls(unsigned int i) {
  int n;
  for (n = 0; i; n++)
    i >>= 1;
  return n;
}


x86 assembly (clang, -O0):
<coap_fls>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <coap_fls+0x2f>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <coap_fls+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<coap_fls>:
xor    %eax,%eax
test   %edi,%edi
je     111c <coap_fls+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <coap_fls+0x10>
ret

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

LLVM IR (-O2):
define i32 @coap_fls(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
unsigned int dictGenCaseHashFunction(unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ wstrlen(char *);
unsigned int dictWstrCaseHash(const void *key) {
  return dictGenCaseHashFunction((unsigned char *)key, wstrlen((char *)key));
}


x86 assembly (clang, -O0):
<dictWstrCaseHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <wstrlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <dictGenCaseHashFunction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dictWstrCaseHash>:
push   %rbx
mov    %rdi,%rbx
call   1040 <wstrlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <dictGenCaseHashFunction@plt>

LLVM IR (-O0):
define i32 @dictWstrCaseHash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @wstrlen(i8* %4)
%6 = call i32 @dictGenCaseHashFunction(i8* %3, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @dictWstrCaseHash(i8* %0) {
%2 = tail call i32 @wstrlen(i8* %0)
%3 = tail call i32 @dictGenCaseHashFunction(i8* %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
void *allocator_F7A14A22(void *, size_t);
void *realloc(void *ptr, size_t size) { return allocator_F7A14A22(ptr, size); }


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

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

LLVM IR (-O0):
define i8* @realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @allocator_F7A14A22(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @realloc(i8* %0, i64 %1) {
%3 = tail call i8* @allocator_F7A14A22(i8* %0, i64 %1)
ret i8* %3
}
int emptyneighbor(int flag) {
  flag = (~flag) & 4095;
  if ((flag & 1365) != 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<emptyneighbor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    $0xfff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x555,%eax
cmp    $0x0,%eax
je     1132 <emptyneighbor+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1139 <emptyneighbor+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<emptyneighbor>:
not    %edi
xor    %eax,%eax
test   $0x555,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @emptyneighbor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = xor i32 %4, -1
%6 = and i32 %5, 4095
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = and i32 %7, 1365
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @emptyneighbor(i32 %0) {
%2 = and i32 %0, 1365
%3 = icmp ne i32 %2, 1365
%4 = zext i1 %3 to i32
ret i32 %4
}
int tegra_mc_get_effective_bytes_width(void) { return 4; }


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

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

LLVM IR (-O0):
define i32 @tegra_mc_get_effective_bytes_width() {
ret i32 4
}

LLVM IR (-O2):
define i32 @tegra_mc_get_effective_bytes_width() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
unsigned short begin_with(const char *line, const char *keyword) {
  return (strncmp(line, keyword, strlen(keyword)) == 0);
}


x86 assembly (clang, -O0):
<begin_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<begin_with>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define zeroext i16 @begin_with(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @begin_with(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i16
ret i16 %6
}
int digitstring(char *s) {
  while (*s >= '0' && *s <= '9')
    s++;
  return ((*s == '\0') ? 1 : 0);
}


x86 assembly (clang, -O0):
<digitstring>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x9(%rbp)
jl     112d <digitstring+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <digitstring+0x3d>
jmp    114e <digitstring+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <digitstring+0x8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitstring>:
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%eax
add    $0x1,%rdi
cmp    $0xa,%al
jb     1100 <digitstring>
xor    %eax,%eax
test   %cl,%cl
sete   %al
ret

LLVM IR (-O0):
define i32 @digitstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 48
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
ret i32 %24
}

LLVM IR (-O2):
define i32 @digitstring(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = add i8 %4, -48
%6 = icmp ult i8 %5, 10
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %2, label %8
8: ; preds = %2
%9 = icmp eq i8 %4, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
void null() {}


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

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

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

LLVM IR (-O2):
define void @null() {
ret void
}
void __cpuid(int cpu_info[4], int info_type) {
  __asm__ volatile("cpuid\n"
                   : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]),
                     "=d"(cpu_info[3])
                   : "a"(info_type));
}


x86 assembly (clang, -O0):
<__cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cpuid>:
push   %rbx
mov    %esi,%eax
cpuid
mov    %eax,(%rdi)
mov    %ebx,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @__cpuid(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 2
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 3
%13 = load i32, i32* %4
%14 = call { i32, i32, i32, i32 } asm sideeffect "cpuid\0A", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %13)
%15 = extractvalue { i32, i32, i32, i32 } %14, 0
%16 = extractvalue { i32, i32, i32, i32 } %14, 1
%17 = extractvalue { i32, i32, i32, i32 } %14, 2
%18 = extractvalue { i32, i32, i32, i32 } %14, 3
store i32 %15, i32* %6
store i32 %16, i32* %8
store i32 %17, i32* %10
store i32 %18, i32* %12
ret void
}

LLVM IR (-O2):
define void @__cpuid(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid\0A", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %1)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %0
store i32 %8, i32* %3
store i32 %9, i32* %4
store i32 %10, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ saa7114_read_reg(int, unsigned char *);
unsigned char saa7114_get_decoder_brightness(void) {
  unsigned char brightness = 0;
  saa7114_read_reg(0x0A, &brightness);
  return (brightness);
}


x86 assembly (clang, -O0):
<saa7114_get_decoder_brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
mov    $0xa,%edi
lea    -0x1(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saa7114_get_decoder_brightness>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0xa,%edi
call   1030 <saa7114_read_reg@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @saa7114_get_decoder_brightness() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @saa7114_read_reg(i32 10, i8* %1)
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define zeroext i8 @saa7114_get_decoder_brightness() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @saa7114_read_reg(i32 10, i8* %1)
%3 = load i8, i8* %1
ret i8 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int fchmodat(int, char const *, int /*<<< orphan*/, int);
int lchmodat(int fd, char const *file, mode_t mode) {
  return fchmodat(fd, file, mode, 4096);
}


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

x86 assembly (clang, -O2):
<lchmodat>:
mov    $0x1000,%ecx
jmp    1030 <fchmodat@plt>

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

LLVM IR (-O2):
define i32 @lchmodat(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @fchmodat(i32 %0, i8* %1, i32 %2, i32 4096)
ret i32 %4
}
int charprint(char **s, char c) {
  *((*s)++) = c;
  return 1;
}


x86 assembly (clang, -O0):
<charprint>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charprint>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    %sil,(%rax)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @charprint(i8** %0, i8 signext %1) {
%3 = alloca i8**
%4 = alloca i8
store i8** %0, i8*** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %6
store i8 %5, i8* %7
ret i32 1
}

LLVM IR (-O2):
define i32 @charprint(i8** nocapture %0, i8 signext %1) {
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
store i8 %1, i8* %3
ret i32 1
}
int test_imm_8Cuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x8C << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_8Cuint64_lowword_mem>:
testb  $0x8c,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_8Cuint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 140
%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_8Cuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 140
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  char t[] = {'a', 'b', 'A', 'B'};
  printf("%d", t[1] - t[0] + t[3] - t[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x8(%rbp)
movsbl -0x7(%rbp),%eax
movsbl -0x8(%rbp),%ecx
sub    %ecx,%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
movsbl -0x6(%rbp),%ecx
sub    %ecx,%eax
lea    0xebf(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.t = [4 x i8] c"abAB"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
store i32 0, i32* %1
%3 = bitcast [4 x i8]* %2 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %6, %9
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = add nsw i32 %10, %13
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %14, %17
%19 = trunc i32 %18 to i8
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext 2)
ret i32 0
}
unsigned long djb2_hash(const unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = *str++))
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<djb2_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <djb2_hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <djb2_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<djb2_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <djb2_hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <djb2_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @djb2_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/
UpnpResponse_ConnectionManager_GetCurrentConnectionIDs(void *, char *);
int /*<<< orphan*/ printf(char *);
void UpnpConnectionManager_GetCurrentConnectionIDs(void *upnptoken) {
  printf("Invoke: UpnpConnectionManager_GetCurrentConnectionIDs();\r\n");
  UpnpResponse_ConnectionManager_GetCurrentConnectionIDs(upnptoken,
                                                         "Sample String");
}


x86 assembly (clang, -O0):
<UpnpConnectionManager_GetCurrentConnectionIDs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xef8(%rip),%rsi
call   1030 <UpnpResponse_ConnectionManager_GetCurrentConnectionIDs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpConnectionManager_GetCurrentConnectionIDs>:
push   %rbx
mov    %rdi,%rbx
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <UpnpResponse_ConnectionManager_GetCurrentConnectionIDs@plt>

LLVM IR (-O0):
@.str = [59 x i8] c"Invoke: UpnpConnectionManager_GetCurrentConnectionIDs();\0D\0A\00"
@.str.1 = [14 x i8] c"Sample String\00"
define void @UpnpConnectionManager_GetCurrentConnectionIDs(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @UpnpResponse_ConnectionManager_GetCurrentConnectionIDs(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"Sample String\00"
@str = [58 x i8] c"Invoke: UpnpConnectionManager_GetCurrentConnectionIDs();\0D\00"
define void @UpnpConnectionManager_GetCurrentConnectionIDs(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @UpnpResponse_ConnectionManager_GetCurrentConnectionIDs(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
double modf(double, double *);
double c_modf(double arg0, double *arg1) { return modf(arg0, arg1); }


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

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

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

LLVM IR (-O2):
define double @c_modf(double %0, double* nocapture %1) {
%3 = tail call double @modf(double %0, double* %1)
ret double %3
}