xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("injectoid [-a] <DSO> <PID>\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"injectoid [-a] <DSO> <PID>\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [27 x i8] c"injectoid [-a] <DSO> <PID>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
float mmapAdd(float *, long, double);
float mmapInc(float *addr, long i) { return mmapAdd(addr, i, 1.0); }


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

x86 assembly (clang, -O2):
<mmapInc>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <mmapAdd@plt>

LLVM IR (-O0):
define float @mmapInc(float* %0, i64 %1) {
%3 = alloca float*
%4 = alloca i64
store float* %0, float** %3
store i64 %1, i64* %4
%5 = load float*, float** %3
%6 = load i64, i64* %4
%7 = call float @mmapAdd(float* %5, i64 %6, double 1.000000e+00)
ret float %7
}

LLVM IR (-O2):
define float @mmapInc(float* %0, i64 %1) {
%3 = tail call float @mmapAdd(float* %0, i64 %1, double 1.000000e+00)
ret float %3
}
int any_odd_one(unsigned x) { return (x & 0xAAAAAAAAu) != 0u; }


x86 assembly (clang, -O0):
<any_odd_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @any_odd_one(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -1431655766
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @any_odd_one(i32 %0) {
%2 = and i32 %0, -1431655766
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a = 1, b = 2;
  int c = add(a, b);
  printf("%d\n\n", c);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @add(i32 1, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
long jround_up(a, b)
long a;
long b;
{
  a += b - 1;
  return a - (a % b);
}


x86 assembly (clang, -O0):
<jround_up>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    -0x18(%rbp),%rax
sub    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jround_up>:
lea    (%rdi,%rsi,1),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     111e <jround_up+0x1e>
mov    %rcx,%rax
cqto
idiv   %rsi
jmp    1124 <jround_up+0x24>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
sub    %rdx,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @jround_up(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = sub nsw i64 %5, 1
%7 = load i64, i64* %3
%8 = add nsw i64 %7, %6
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = load i64, i64* %3
%11 = load i64, i64* %4
%12 = srem i64 %10, %11
%13 = sub nsw i64 %9, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @jround_up(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = srem i64 %4, %1
%6 = sub nsw i64 %4, %5
ret i64 %6
}
int _read(int fd, void *buf, int count) { return -1; }


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_read(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
ret i32 -1
}

LLVM IR (-O2):
define i32 @_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 -1
}
void fb_DylibFree(void *library) {}


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

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

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

LLVM IR (-O2):
define void @fb_DylibFree(i8* nocapture %0) {
ret void
}
int Mul(int a, int b) { return a * b; }


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

x86 assembly (clang, -O2):
<Mul>:
mov    %edi,%eax
imul   %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @Mul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
char *strings_alloc(int);
char *strings_empty() {
  char *ret = strings_alloc(1);
  ret[0] = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<strings_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <strings_alloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_empty>:
push   %rax
mov    $0x1,%edi
call   1030 <strings_alloc@plt>
movb   $0x0,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i8* @strings_empty() {
%1 = alloca i8*
%2 = call i8* @strings_alloc(i32 1)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 0, i8* %4
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
define i8* @strings_empty() {
%1 = tail call i8* @strings_alloc(i32 1)
store i8 0, i8* %1
ret i8* %1
}
/* Variables and functions */
int sck_sendf(int, char *, char const *, char const *);
int irc_action(int s, const char *channel, const char *data) {
  return sck_sendf(s, "PRIVMSG %s :\001ACTION %s\001\r\n", channel, data);
}


x86 assembly (clang, -O0):
<irc_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rsi
call   1030 <sck_sendf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_action>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <sck_sendf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"PRIVMSG %s :\01ACTION %s\01\0D\0A\00"
define i32 @irc_action(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @sck_sendf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [26 x i8] c"PRIVMSG %s :\01ACTION %s\01\0D\0A\00"
define i32 @irc_action(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @sck_sendf(i32 %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret i32 %4
}
/* Type definitions */
struct ifreq {
  int /*<<< orphan*/ ifr_name;
};

/* Variables and functions */
int ioctl(int, int, struct ifreq *);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char const *);
int ifconfig_ioctl(int fd, const char *ifname, int cmd, struct ifreq *ifr) {
  strcpy(ifr->ifr_name, ifname);
  return ioctl(fd, cmd, ifr);
}


x86 assembly (clang, -O0):
<ifconfig_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <ioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifconfig_ioctl>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %edi,%ebp
mov    (%rcx),%edi
call   1030 <strcpy@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
%struct.ifreq = type { i32 }
define i32 @ifconfig_ioctl(i32 %0, i8* %1, i32 %2, %struct.ifreq* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.ifreq*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store %struct.ifreq* %3, %struct.ifreq** %8
%9 = load %struct.ifreq*, %struct.ifreq** %8
%10 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load i8*, i8** %6
%13 = call i32 @strcpy(i32 %11, i8* %12)
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = load %struct.ifreq*, %struct.ifreq** %8
%17 = call i32 @ioctl(i32 %14, i32 %15, %struct.ifreq* %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.ifreq = type { i32 }
define i32 @ifconfig_ioctl(i32 %0, i8* %1, i32 %2, %struct.ifreq* %3) {
%5 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i32 @strcpy(i32 %6, i8* %1)
%8 = tail call i32 @ioctl(i32 %0, i32 %2, %struct.ifreq* %3)
ret i32 %8
}
double ldexp(double x, int exp) { return 4; }


x86 assembly (clang, -O0):
<ldexp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  0xeec(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexp>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @ldexp(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
ret double 4.000000e+00
}

LLVM IR (-O2):
define double @ldexp(double %0, i32 %1) {
ret double 4.000000e+00
}
void *clrmem2(void *s) { return __builtin_memset(s, 0, 700); }


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

x86 assembly (clang, -O2):
<clrmem2>:
mov    $0x2bc,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define i8* @clrmem2(i8* returned writeonly %0) {
tail call void @llvm.memset.p0i8.i64(i8* align 1 dereferenceable(700) %0, i8 0, i64 700, i1 false)
ret i8* %0
}
/* Type definitions */
struct Mt3dInput {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(struct Mt3dInput *const);
void Mt3dInput_delete(struct Mt3dInput *const inObj) {
  assert(inObj != NULL);
  free(inObj);
}


x86 assembly (clang, -O0):
<Mt3dInput_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mt3dInput_delete>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Mt3dInput = type { i32 }
define void @Mt3dInput_delete(%struct.Mt3dInput* %0) {
%2 = alloca %struct.Mt3dInput*
store %struct.Mt3dInput* %0, %struct.Mt3dInput** %2
%3 = load %struct.Mt3dInput*, %struct.Mt3dInput** %2
%4 = icmp ne %struct.Mt3dInput* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.Mt3dInput*, %struct.Mt3dInput** %2
%8 = call i32 @free(%struct.Mt3dInput* %7)
ret void
}

LLVM IR (-O2):
%struct.Mt3dInput = type { i32 }
define void @Mt3dInput_delete(%struct.Mt3dInput* %0) {
%2 = icmp ne %struct.Mt3dInput* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @free(%struct.Mt3dInput* %0)
ret void
}
void ff_hevc_put_hevc_uni_w_pel_pixels6_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_pel_pixels6_12_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
long ptrace(int x, int y, int z) {
  printf("B-)\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"B-)\0A\00"
define i64 @ptrace(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 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i64 0
}

LLVM IR (-O2):
@str = [4 x i8] c"B-)\00"
define i64 @ptrace(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "usage: uname [-amnrsv]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"usage: uname [-amnrsv]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"usage: uname [-amnrsv]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int do_getline(char const *, char *, int, int /*<<< orphan*/);
int console_input(const char *prompt, char *buf, int buflen) {
  return do_getline(prompt, buf, buflen, 0);
}


x86 assembly (clang, -O0):
<console_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <do_getline@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_input>:
xor    %ecx,%ecx
jmp    1030 <do_getline@plt>

LLVM IR (-O0):
define i32 @console_input(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 i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @do_getline(i8* %7, i8* %8, i32 %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @console_input(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @do_getline(i8* %0, i8* %1, i32 %2, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void version(void) {
  printf("prim v%s\n", "0.1");
  printf("(c) Phillip Heikoop 2016\n");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedb(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"prim v%s\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
@.str.2 = [26 x i8] c"(c) Phillip Heikoop 2016\0A\00"
define void @version() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"prim v%s\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
@str = [25 x i8] c"(c) Phillip Heikoop 2016\00"
define void @version() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void dieif(bool w, char *str) {
  if (w) {
    fprintf(stderr, "stringlib: %s\n", str);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<dieif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     115c <dieif+0x3c>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dieif>:
test   %edi,%edi
jne    1125 <dieif+0x5>
ret
push   %rax
mov    %rsi,%rdx
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"stringlib: %s\0A\00"
define void @dieif(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
void *__builtin_alloca(unsigned long);
void *__builtin_malloc(unsigned long);
int /*<<< orphan*/ f(void *);
void foo(long unsigned int len) {
  void *p;
  if (len < 500)
    p = __builtin_malloc(len);
  else
    p = __builtin_alloca(len);
  f(p);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1f4,-0x8(%rbp)
jae    114c <foo+0x2c>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
jmp    1165 <foo+0x45>
mov    -0x8(%rbp),%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <f@plt>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
mov    %rsp,%rbp
cmp    $0x1f3,%rdi
ja     1134 <foo+0x14>
call   1040 <malloc@plt>
jmp    1145 <foo+0x25>
mov    %rsp,%rax
add    $0xf,%rdi
and    $0xfffffffffffffff0,%rdi
sub    %rdi,%rax
mov    %rax,%rsp
mov    %rax,%rdi
call   1030 <f@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @foo(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ult i64 %4, 500
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %2
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %3
br label %12
9: ; preds = %1
%10 = load i64, i64* %2
%11 = alloca i8, i64 %10
store i8* %11, i8** %3
br label %12
12: ; preds = %9, %6
%13 = load i8*, i8** %3
%14 = call i32 @f(i8* %13)
ret void
}

LLVM IR (-O2):
define void @foo(i64 %0) {
%2 = icmp ult i64 %0, 500
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @malloc(i64 %0)
br label %7
5: ; preds = %1
%6 = alloca i8, i64 %0
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ %4, %3 ], [ %6, %5 ]
%9 = call i32 @f(i8* %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(int);
int /*<<< orphan*/ debug_print_str_nonl(char *, int);
int /*<<< orphan*/ debug_print_str_start(char *, int);
int fail_real(int x, int line) {
  debug_print_str_start("failed arith test at line ", 26);
  debug(line);
  debug_print_str_nonl("\n", 1);
  return 1 / x;
}


x86 assembly (clang, -O0):
<fail_real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x1a,%esi
call   1030 <debug_print_str_start@plt>
mov    -0x8(%rbp),%edi
call   1040 <debug@plt>
lea    0xebd(%rip),%rdi
mov    $0x1,%esi
call   1050 <debug_print_str_nonl@plt>
mov    $0x1,%eax
cltd
idivl  -0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_real>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xec2(%rip),%rdi
mov    $0x1a,%esi
call   1030 <debug_print_str_start@plt>
mov    %ebp,%edi
call   1040 <debug@plt>
lea    0xec5(%rip),%rdi
mov    $0x1,%esi
call   1050 <debug_print_str_nonl@plt>
lea    0x1(%rbx),%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
cmovb  %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"failed arith test at line \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @fail_real(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @debug_print_str_start(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26)
%6 = load i32, i32* %4
%7 = call i32 @debug(i32 %6)
%8 = call i32 @debug_print_str_nonl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = load i32, i32* %3
%10 = sdiv i32 1, %9
ret i32 %10
}

LLVM IR (-O2):
@.str = [27 x i8] c"failed arith test at line \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @fail_real(i32 %0, i32 %1) {
%3 = tail call i32 @debug_print_str_start(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26)
%4 = tail call i32 @debug(i32 %1)
%5 = tail call i32 @debug_print_str_nonl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = add i32 %0, 1
%7 = icmp ult i32 %6, 3
%8 = select i1 %7, i32 %0, i32 0
ret i32 %8
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
void spi_clkdiv(unsigned int d) { *(volatile uint32_t *)(0x1400000 + 4) = d; }


x86 assembly (clang, -O0):
<spi_clkdiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1400004,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_clkdiv>:
mov    %edi,0x1400004
ret

LLVM IR (-O0):
define void @spi_clkdiv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store volatile i32 %3, i32* inttoptr (i64 20971524 to i32*)
ret void
}

LLVM IR (-O2):
define void @spi_clkdiv(i32 %0) {
store volatile i32 %0, i32* inttoptr (i64 20971524 to i32*)
ret void
}
void PRCMHibernateEnter() {
  PRCMHIBRegWrite((0x4402F800 + 0x00000000), 0x1);
  __asm("    nop\n"
        "    nop\n"
        "    nop\n"
        "    nop\n");
}


x86 assembly (clang, -O0):
<PRCMHibernateEnter>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4402f800,%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <PRCMHIBRegWrite@plt>
nop
nop
nop
nop
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMHibernateEnter>:
push   %rax
mov    $0x4402f800,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <PRCMHIBRegWrite@plt>
nop
nop
nop
nop
pop    %rax
ret

LLVM IR (-O0):
define void @PRCMHibernateEnter() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @PRCMHIBRegWrite to i32 (i32, i32, ...)*)(i32 1141045248, i32 1)
ret void
}

LLVM IR (-O2):
define void @PRCMHibernateEnter() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @PRCMHIBRegWrite to i32 (i32, i32, ...)*)(i32 1141045248, i32 1)
tail call void asm sideeffect " nop\0A nop\0A nop\0A nop\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t test_untagged_nonint_enum(uint8_t val) { return val; }


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

x86 assembly (clang, -O2):
<test_untagged_nonint_enum>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @test_untagged_nonint_enum(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ StubBug(char *);
void openlog(const char *a, int b, int c) {
  (void)a;
  (void)b;
  (void)c;
  StubBug("STUB:"
          "openlog");
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"STUB:openlog\00"
define void @openlog(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @StubBug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"STUB:openlog\00"
define void @openlog(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 @StubBug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_bt();
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void handler2() {
  write(2, "handler2\n", strlen("handler2\n"));
  do_bt();
}


x86 assembly (clang, -O0):
<handler2>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xeb2(%rip),%rsi
call   1030 <write@plt>
mov    $0x0,%al
call   1050 <do_bt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler2>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <do_bt@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"handler2\0A\00"
define void @handler2() {
%1 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write(i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @do_bt()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"handler2\0A\00"
define void @handler2() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @do_bt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setLift(int);
int /*<<< orphan*/ wait1Msec(int);
void setLiftTime(int pwr, int mSec) {
  setLift(pwr);
  wait1Msec(mSec);
  setLift(0);
}


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

x86 assembly (clang, -O2):
<setLiftTime>:
push   %rbx
mov    %esi,%ebx
call   1040 <setLift@plt>
mov    %ebx,%edi
call   1030 <wait1Msec@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <setLift@plt>

LLVM IR (-O0):
define void @setLiftTime(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 = call i32 @setLift(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @wait1Msec(i32 %7)
%9 = call i32 @setLift(i32 0)
ret void
}

LLVM IR (-O2):
define void @setLiftTime(i32 %0, i32 %1) {
%3 = tail call i32 @setLift(i32 %0)
%4 = tail call i32 @wait1Msec(i32 %1)
%5 = tail call i32 @setLift(i32 0)
ret void
}
void ff_hevc_put_hevc_qpel_hv24_10_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_hv24_10_avx2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void mem_chk(void *arr) {
  if (arr == NULL) {
    fprintf(stderr, "Failure while allocating memory.\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<mem_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115a <mem_chk+0x3a>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_chk>:
test   %rdi,%rdi
je     1126 <mem_chk+0x6>
ret
push   %rax
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Failure while allocating memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @mem_chk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Failure while allocating memory.\0A\00"
@EXIT_FAILURE = global i32 0
define void @mem_chk(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int _iTlvCheckTlvObj(unsigned char *);
int iTlvObjLen(unsigned char *psTlvObj) {
  int iRet;
  iRet = _iTlvCheckTlvObj(psTlvObj);
  if (iRet < 0)
    return (-10005);
  return (iRet);
}


x86 assembly (clang, -O0):
<iTlvObjLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_iTlvCheckTlvObj@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    113e <iTlvObjLen+0x2e>
movl   $0xffffd8eb,-0x4(%rbp)
jmp    1144 <iTlvObjLen+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTlvObjLen>:
push   %rax
call   1030 <_iTlvCheckTlvObj@plt>
test   %eax,%eax
mov    $0xffffd8eb,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @iTlvObjLen(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @_iTlvCheckTlvObj(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -10005, i32* %2
br label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @iTlvObjLen(i8* %0) {
%2 = tail call i32 @_iTlvCheckTlvObj(i8* %0)
%3 = icmp slt i32 %2, 0
%4 = select i1 %3, i32 -10005, i32 %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
void uninivar_strlen(void) {
  char *s;
  (void)strlen(s);
}


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

x86 assembly (clang, -O2):
<uninivar_strlen>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define void @uninivar_strlen() {
%1 = alloca i8*
%2 = load i8*, i8** %1
%3 = call i32 @strlen(i8* %2)
ret void
}

LLVM IR (-O2):
define void @uninivar_strlen() {
%1 = tail call i32 @strlen(i8* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send_x10state_command(int, int /*<<< orphan*/);
int c_restart_old(int argc, char *argv[]) {
  send_x10state_command(20, 0);
  return 0;
}


x86 assembly (clang, -O0):
<c_restart_old>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x14,%edi
xor    %esi,%esi
call   1030 <send_x10state_command@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_restart_old>:
push   %rax
mov    $0x14,%edi
xor    %esi,%esi
call   1030 <send_x10state_command@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @c_restart_old(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @send_x10state_command(i32 20, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
void *suprabhat(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Suprabhat, thread #%ld!\n", tid);
  sleep(2);
  printf("Dhanyawad, thread #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<suprabhat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
mov    -0x18(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suprabhat>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Suprabhat, thread #%ld!\0A\00"
@.str.1 = [25 x i8] c"Dhanyawad, thread #%ld!\0A\00"
define i8* @suprabhat(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @sleep(i32 2)
%10 = load i64, i64* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %10)
%12 = call i32 @pthread_exit(i32* null)
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [25 x i8] c"Suprabhat, thread #%ld!\0A\00"
@.str.1 = [25 x i8] c"Dhanyawad, thread #%ld!\0A\00"
define noalias i8* @suprabhat(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @sleep(i32 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%6 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Type definitions */
struct addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
void _nxweb_free_addrinfo(struct addrinfo *ai) { freeaddrinfo(ai); }


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

x86 assembly (clang, -O2):
<_nxweb_free_addrinfo>:
jmp    1030 <freeaddrinfo@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32 }
define void @_nxweb_free_addrinfo(%struct.addrinfo* %0) {
%2 = alloca %struct.addrinfo*
store %struct.addrinfo* %0, %struct.addrinfo** %2
%3 = load %struct.addrinfo*, %struct.addrinfo** %2
%4 = call i32 @freeaddrinfo(%struct.addrinfo* %3)
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32 }
define void @_nxweb_free_addrinfo(%struct.addrinfo* %0) {
%2 = tail call i32 @freeaddrinfo(%struct.addrinfo* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf(
      "-i <ip address/hostname>   server to connect to (default: localhost)\n"
      "-p <port number>              port number to connect to (default: "
      "4242)\n"
      "-m <message>                  message to send (default: hello)\n"
      "-c <number of messages>      (default: 1)\n"
      "-n <number of threads>       (default: 1)\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [289 x i8] c"-i <ip address/hostname> server to connect to (default: localhost)\0A-p <port number> port number to connect to (default: 4242)\0A-m <message> message to send (default: hello)\0A-c <number of messages> (default: 1)\0A-n <number of threads> (default: 1)\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([289 x i8], [289 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [288 x i8] c"-i <ip address/hostname> server to connect to (default: localhost)\0A-p <port number> port number to connect to (default: 4242)\0A-m <message> message to send (default: hello)\0A-c <number of messages> (default: 1)\0A-n <number of threads> (default: 1)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([288 x i8], [288 x i8]* @str, i64 0, i64 0))
ret void
}
const unsigned int rol(const unsigned int num, const unsigned int cnt) {
  return ((num << cnt) | (num >> (32 - cnt)));
}


x86 assembly (clang, -O0):
<rol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rol>:
mov    %esi,%ecx
mov    %edi,%eax
rol    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rol(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 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 32, %9
%11 = lshr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rol(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub i32 32, %1
%5 = lshr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
int test_imm_4Euint16_reg(unsigned short val) {
  return ((val) & (0x4E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Euint16_reg>:
test   $0x4e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Euint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 78
%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_4Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 78
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double current_time() {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
}


x86 assembly (clang, -O0):
<current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @current_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @current_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
extern int sfvfs_fsnode_read(struct sfvfs_fs *sfs, int fid, void *buffer,
                             int len) {
  return 0;
}


x86 assembly (clang, -O0):
<sfvfs_fsnode_read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sfvfs_fs = type opaque
define i32 @sfvfs_fsnode_read(%struct.sfvfs_fs* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.sfvfs_fs*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct.sfvfs_fs* %0, %struct.sfvfs_fs** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.sfvfs_fs = type opaque
define i32 @sfvfs_fsnode_read(%struct.sfvfs_fs* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __sh_fetch_add(int volatile *, int);
void a_dec(volatile int *x) { __sh_fetch_add(x, -1); }


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

x86 assembly (clang, -O2):
<a_dec>:
mov    $0xffffffff,%esi
jmp    1030 <__sh_fetch_add@plt>

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

LLVM IR (-O2):
define void @a_dec(i32* %0) {
%2 = tail call i32 @__sh_fetch_add(i32* %0, i32 -1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int syscall(int, int /*<<< orphan*/);
int setfsuid(uid_t uid) { return syscall(138, uid); }


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

x86 assembly (clang, -O2):
<setfsuid>:
mov    %edi,%esi
mov    $0x8a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @setfsuid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @syscall(i32 138, i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @setfsuid(i32 %0) {
%2 = tail call i32 @syscall(i32 138, i32 %0)
ret i32 %2
}