xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn54() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn54");
  return result;
}


x86 assembly (clang, -O0):
<fn54>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn54>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn54\00"
define i8* @fn54() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn54\00"
define i8* @fn54() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
void put_string(char *ptr, char **msg) {
  while (1) {
    **msg = *ptr;
    (*msg)++;
    if (!(*ptr))
      break;
    ptr++;
  }
}


x86 assembly (clang, -O0):
<put_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <put_string+0x3b>
jmp    114c <put_string+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <put_string+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_string>:
mov    (%rsi),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rdi),%ecx
mov    %cl,(%rax)
mov    (%rsi),%rax
add    $0x1,%rax
mov    %rax,(%rsi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <put_string+0x10>
ret

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

LLVM IR (-O2):
define void @put_string(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
br label %4
4: ; preds = %4, %2
%5 = phi i8* [ %3, %2 ], [ %9, %4 ]
%6 = phi i8* [ %0, %2 ], [ %12, %4 ]
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %1
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
%12 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %11, label %13, label %4
13: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kattach_net_linkup(char *);
int /*<<< orphan*/ kattach_sysexec(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
void kattach_net_dhcp(char *devname) {
  char lcmd[255];
  kattach_net_linkup(devname);
  sprintf(lcmd, "%s%s -b -q -C hostname -C resolv.conf -C mtu %s",
          "/kaos/core/dhcpcd/sbin/", "dhcpcd", devname);
  kattach_sysexec(lcmd);
  return;
}


x86 assembly (clang, -O0):
<kattach_net_dhcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <kattach_net_linkup@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%r8
lea    0xea6(%rip),%rsi
lea    0xecf(%rip),%rdx
lea    0xee0(%rip),%rcx
call   1050 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <kattach_sysexec@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kattach_net_dhcp>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
call   1030 <kattach_net_linkup@plt>
lea    0xeb7(%rip),%rsi
lea    0xee0(%rip),%rdx
lea    0xef1(%rip),%rcx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%r8
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1040 <kattach_sysexec@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [48 x i8] c"%s%s -b -q -C hostname -C resolv.conf -C mtu %s\00"
@.str.1 = [24 x i8] c"/kaos/core/dhcpcd/sbin/\00"
@.str.2 = [7 x i8] c"dhcpcd\00"
define void @kattach_net_dhcp(i8* %0) {
%2 = alloca i8*
%3 = alloca [255 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @kattach_net_linkup(i8* %4)
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%10 = call i32 @kattach_sysexec(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"%s%s -b -q -C hostname -C resolv.conf -C mtu %s\00"
@.str.1 = [24 x i8] c"/kaos/core/dhcpcd/sbin/\00"
@.str.2 = [7 x i8] c"dhcpcd\00"
define void @kattach_net_dhcp(i8* %0) {
%2 = alloca [255 x i8]
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @kattach_net_linkup(i8* %0)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%6 = call i32 @kattach_sysexec(i8* %3)
ret void
}
void strength_result5(int *data) {
  int i = 0;
  while (1) {
    i = i + 21;
    if (data[1] && i > data[3])
      break;
    data[data[2]] = 2;
  }
}


x86 assembly (clang, -O0):
<strength_result5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x15,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     113b <strength_result5+0x3b>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jle    113b <strength_result5+0x3b>
jmp    1153 <strength_result5+0x53>
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x8(%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
jmp    110f <strength_result5+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strength_result5>:
mov    $0x15,%eax
jmp    111e <strength_result5+0x1e>
nopw   0x0(%rax,%rax,1)
movslq 0x8(%rdi),%rcx
movl   $0x2,(%rdi,%rcx,4)
add    $0x15,%eax
cmpl   $0x0,0x4(%rdi)
je     1110 <strength_result5+0x10>
cmp    0xc(%rdi),%eax
jle    1110 <strength_result5+0x10>
ret

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

LLVM IR (-O2):
define void @strength_result5(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = getelementptr inbounds i32, i32* %0, i64 2
br label %5
5: ; preds = %13, %1
%6 = phi i32 [ 0, %1 ], [ %7, %13 ]
%7 = add nuw nsw i32 %6, 21
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = load i32, i32* %2
%12 = icmp sgt i32 %7, %11
br i1 %12, label %17, label %13
13: ; preds = %10, %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %0, i64 %15
store i32 2, i32* %16
br label %5
17: ; preds = %10
ret void
}
unsigned long bios32_init(unsigned long memory_start,
                          unsigned long memory_end) {
  return memory_start;
}


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

x86 assembly (clang, -O2):
<bios32_init>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @bios32_init(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @bios32_init(i64 returned %0, i64 %1) {
ret i64 %0
}
nextdown(f, n) {
  nextwind(0, 1);
  forwpage(f, n);
  prevwind(0, 1);
}


x86 assembly (clang, -O0):
<nextdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <nextwind@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1030 <forwpage@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <prevwind@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextdown>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <nextwind@plt>
mov    %ebp,%edi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <forwpage@plt>
xor    %edi,%edi
mov    $0x1,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <prevwind@plt>

LLVM IR (-O0):
define i32 @nextdown(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @nextwind to i32 (i32, i32, ...)*)(i32 0, i32 1)
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 (i32, i32, ...) bitcast (i32 (...)* @forwpage to i32 (i32, i32, ...)*)(i32 %7, i32 %8)
%10 = call i32 (i32, i32, ...) bitcast (i32 (...)* @prevwind to i32 (i32, i32, ...)*)(i32 0, i32 1)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @nextdown(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @nextwind to i32 (i32, i32, ...)*)(i32 0, i32 1)
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @forwpage to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
%5 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @prevwind to i32 (i32, i32, ...)*)(i32 0, i32 1)
ret i32 undef
}
/* Type definitions */
struct TcpdaemonServerEnvironment {
  int dummy;
};

/* Variables and functions */
int CleanDaemonEnv(struct TcpdaemonServerEnvironment *);
int CleanDaemonEnv_IF(struct TcpdaemonServerEnvironment *p_env) {
  return CleanDaemonEnv(p_env);
}


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

x86 assembly (clang, -O2):
<CleanDaemonEnv_IF>:
jmp    1030 <CleanDaemonEnv@plt>

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

LLVM IR (-O2):
%struct.TcpdaemonServerEnvironment = type { i32 }
define i32 @CleanDaemonEnv_IF(%struct.TcpdaemonServerEnvironment* %0) {
%2 = tail call i32 @CleanDaemonEnv(%struct.TcpdaemonServerEnvironment* %0)
ret i32 %2
}
void WpaEAPOLLogoffAction(struct rt_rtmp_adapter *pAd,
                          struct rt_mlme_queue_elem *Elem) {}


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

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

LLVM IR (-O0):
%struct.rt_rtmp_adapter = type opaque
%struct.rt_mlme_queue_elem = type opaque
define void @WpaEAPOLLogoffAction(%struct.rt_rtmp_adapter* %0, %struct.rt_mlme_queue_elem* %1) {
%3 = alloca %struct.rt_rtmp_adapter*
%4 = alloca %struct.rt_mlme_queue_elem*
store %struct.rt_rtmp_adapter* %0, %struct.rt_rtmp_adapter** %3
store %struct.rt_mlme_queue_elem* %1, %struct.rt_mlme_queue_elem** %4
ret void
}

LLVM IR (-O2):
%struct.rt_rtmp_adapter = type opaque
%struct.rt_mlme_queue_elem = type opaque
define void @WpaEAPOLLogoffAction(%struct.rt_rtmp_adapter* nocapture %0, %struct.rt_mlme_queue_elem* nocapture %1) {
ret void
}
int sigmask(int signum) { return 1 << signum; }


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

x86 assembly (clang, -O2):
<sigmask>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @sigmask(i32 %0) {
%2 = shl nuw i32 1, %0
ret i32 %2
}
unsigned long hash_string(const char *str) {
  unsigned long hash = 0;
  int c;
  while ((c = *str++))
    hash = c + (hash << 6) + (hash << 16) - hash;
  return hash;
}


x86 assembly (clang, -O0):
<hash_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1155 <hash_string+0x55>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash_string+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_string>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <hash_string+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbq %cl,%rcx
imul   $0x1003f,%rax,%rax
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_string+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @hash_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 0, 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 = sext i8 %8 to i32
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %5
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = load i64, i64* %3
%15 = shl i64 %14, 6
%16 = add i64 %13, %15
%17 = load i64, i64* %3
%18 = shl i64 %17, 16
%19 = add i64 %16, %18
%20 = load i64, i64* %3
%21 = sub i64 %19, %20
store i64 %21, i64* %3
br label %5
22: ; preds = %5
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
define i64 @hash_string(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 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %5 to i64
%10 = mul i64 %7, 65599
%11 = add i64 %10, %9
%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 [ 0, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void sorter_sort_delete_buffer(int64_t *pointer) { free(pointer); }


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

x86 assembly (clang, -O2):
<sorter_sort_delete_buffer>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @sorter_sort_delete_buffer(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
void printArr(char *str) {
  int strLen = strlen(str);
  for (int i = 0; i < strLen; i++) {
    printf("%c", *(str + i));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1173 <printArr+0x53>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <printArr+0x1f>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArr>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
test   %eax,%eax
jle    1153 <printArr+0x33>
mov    %eax,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <printArr+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @printArr(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %8
6: ; preds = %8, %1
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %14, %8 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 @putchar(i32 %12)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
void runchild(void) {
  printf("Show folder size below /");
  execl("/bin/sh", "/bin/sh", "-c", "sudo du -hs /*", NULL);
  perror("execl");
  exit(1);
}


x86 assembly (clang, -O0):
<runchild>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rsi
lea    0xec3(%rip),%rdx
lea    0xebf(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1060 <execl@plt>
lea    0xeba(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<runchild>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0xec6(%rip),%rdx
lea    0xec2(%rip),%rcx
mov    %rdi,%rsi
xor    %r8d,%r8d
call   1060 <execl@plt>
lea    0xebf(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Show folder size below /\00"
@.str.1 = [8 x i8] c"/bin/sh\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [15 x i8] c"sudo du -hs /*\00"
@.str.4 = [6 x i8] c"execl\00"
define void @runchild() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32* null)
%3 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"Show folder size below /\00"
@.str.1 = [8 x i8] c"/bin/sh\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [15 x i8] c"sudo du -hs /*\00"
@.str.4 = [6 x i8] c"execl\00"
define void @runchild() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32* null)
%3 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
int fn2(int a, int b, int m) { return (a & ~m) | (m & b); }


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0xc(%rbp),%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn2>:
mov    %esi,%eax
xor    %edi,%eax
and    %edx,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @fn2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = xor i32 %8, -1
%10 = and i32 %7, %9
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = and i32 %11, %12
%14 = or i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @fn2(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %2, -1
%5 = and i32 %4, %0
%6 = and i32 %2, %1
%7 = or i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int);
int PrintSquareRoot() {
  printf("Square root of 12345 is %lf\n", sqrt(12345));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<PrintSquareRoot>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3039,%edi
call   1040 <sqrt@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintSquareRoot>:
push   %rax
mov    $0x3039,%edi
call   1040 <sqrt@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Square root of 12345 is %lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @PrintSquareRoot() {
%1 = call i32 @sqrt(i32 12345)
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@.str = [29 x i8] c"Square root of 12345 is %lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @PrintSquareRoot() {
%1 = tail call i32 @sqrt(i32 12345)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0xa6() {
  Assert_real((isxdigit(166) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              835, ("isxdigit should be 0 for 0xa6"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0xa6>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa6,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x343,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0xa6>:
push   %rax
mov    $0xa6,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x343,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xa6\00"
define void @t_isxdigit_0xa6() {
%1 = call i64 @isxdigit(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xa6\00"
define void @t_isxdigit_0xa6() {
%1 = tail call i64 @isxdigit(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
extern long long shmem_longlong_fadd(long long *target, long long value,
                                     int pe) {
  return *target;
}


x86 assembly (clang, -O0):
<shmem_longlong_fadd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmem_longlong_fadd>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @shmem_longlong_fadd(i64* nocapture %0, i64 %1, i32 %2) {
%4 = load i64, i64* %0
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void clr8(int *x) { memset(x, 0, 8); }


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

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

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

LLVM IR (-O2):
define void @clr8(i32* %0) {
%2 = tail call i32 @memset(i32* %0, i32 0, i32 8)
ret void
}
void __DELETE_java_lang_reflect_Modifier(void *me, void *client_data) {}


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

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

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

LLVM IR (-O2):
define void @__DELETE_java_lang_reflect_Modifier(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ USDHC1_DriverIRQHandler();
__attribute__((weak)) void USDHC1_IRQHandler(void) {
  USDHC1_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @USDHC1_IRQHandler() {
%1 = call i32 (...) @USDHC1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @USDHC1_IRQHandler() {
%1 = tail call i32 (...) @USDHC1_DriverIRQHandler()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const wchar_t;

/* Variables and functions */
int /*<<< orphan*/ const *wcspbrk(int /*<<< orphan*/ const *,
                                  int /*<<< orphan*/ const *);
wchar_t *(wcsprbrk)(const wchar_t *string, const wchar_t *stopset) {
  wchar_t *r;
  int found = 0;
  while (string)
    if ((r = wcspbrk(string + 1, stopset)))
      string = r, found = 1;
  return found ? string : NULL;
}


x86 assembly (clang, -O0):
<wcsprbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1165 <wcsprbrk+0x55>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <wcspbrk@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1160 <wcsprbrk+0x50>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x1c(%rbp)
jmp    1127 <wcsprbrk+0x17>
cmpl   $0x0,-0x1c(%rbp)
je     117c <wcsprbrk+0x6c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1187 <wcsprbrk+0x77>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1187 <wcsprbrk+0x77>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsprbrk>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1135 <wcsprbrk+0x25>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
lea    0x4(%rbx),%rdi
mov    %r14,%rsi
call   1030 <wcspbrk@plt>
test   %rax,%rax
cmovne %rax,%rbx
jmp    1120 <wcsprbrk+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i32* @wcsprbrk(i32* %0, i32* %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32* [ %9, %4 ], [ %0, %2 ]
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = tail call i32* @wcspbrk(i32* %6, i32* %1)
%8 = icmp eq i32* %7, null
%9 = select i1 %8, i32* %5, i32* %7
br label %4
10: ; preds = %2
ret i32* null
}
void init_hw_perf_counters(void) {}


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

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

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

LLVM IR (-O2):
define void @init_hw_perf_counters() {
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *xstrdup(const char *s) {
  char *t;
  if (!s)
    return NULL;
  t = malloc(strlen(s) + 1);
  if (t) {
    strcpy(t, s);
  }
  return t;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <xstrdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    118d <xstrdup+0x5d>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1185 <xstrdup+0x55>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115f <xstrdup+0x2f>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <xstrdup+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1161 <xstrdup+0x31>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %3, %8, %1
%11 = phi i8* [ null, %1 ], [ %6, %8 ], [ null, %3 ]
ret i8* %11
}
void my_function() {
  char a[1024];
  my_function();
}


x86 assembly (clang, -O0):
<my_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
call   1030 <my_function@plt>
add    $0x400,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @my_function() {
%1 = alloca [1024 x i8]
ret void
}

LLVM IR (-O2):
define void @my_function() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Falta un argumento\n");
    return 0;
  } else if (argc == 2) {
    remove(argv[1]);
  }
  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)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    117b <main+0x5b>
cmpl   $0x2,-0x8(%rbp)
jne    116f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <remove@plt>
jmp    1174 <main+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1030 <remove@plt>
jmp    113d <main+0x1d>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Falta un argumento\0A\00"
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 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %20
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @remove(i8* %16)
br label %18
18: ; preds = %13, %10
br label %19
19: ; preds = %18
store i32 0, i32* %3
br label %20
20: ; preds = %19, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@str = [19 x i8] c"Falta un argumento\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @remove(i8* %8)
br label %10
10: ; preds = %6, %4
ret i32 0
}
void SSMR3HandleVersion(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3HandleVersion() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char const *);
void ActualFileDelete(const char *filename) { unlink(filename); }


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

x86 assembly (clang, -O2):
<ActualFileDelete>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define void @ActualFileDelete(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret void
}
/* Type definitions */
struct gset_set {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gset_fprint(struct gset_set *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void gset_print(struct gset_set *set) { gset_fprint(set, stdout); }


x86 assembly (clang, -O0):
<gset_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <gset_fprint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gset_print>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <gset_fprint@plt>

LLVM IR (-O0):
%struct.gset_set = type { i32 }
@stdout = global i32 0
define void @gset_print(%struct.gset_set* %0) {
%2 = alloca %struct.gset_set*
store %struct.gset_set* %0, %struct.gset_set** %2
%3 = load %struct.gset_set*, %struct.gset_set** %2
%4 = load i32, i32* @stdout
%5 = call i32 @gset_fprint(%struct.gset_set* %3, i32 %4)
ret void
}

LLVM IR (-O2):
%struct.gset_set = type { i32 }
@stdout = global i32 0
define void @gset_print(%struct.gset_set* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @gset_fprint(%struct.gset_set* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cgbrcond(char *, int);
void cgbrlt(int n) { cgbrcond("jl", n); }


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

x86 assembly (clang, -O2):
<cgbrlt>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <cgbrcond@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"jl\00"
define void @cgbrlt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cgbrcond(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"jl\00"
define void @cgbrlt(i32 %0) {
%2 = tail call i32 @cgbrcond(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
                                      int status) {}


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

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
define void @wpas_dbus_signal_p2p_go_neg_resp(%struct.wpa_supplicant* %0, i32 %1) {
%3 = alloca %struct.wpa_supplicant*
%4 = alloca i32
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @wpas_dbus_signal_p2p_go_neg_resp(%struct.wpa_supplicant* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int rand_num(unsigned int *);
float gpr_random_value(float min_value, float max_value,
                       unsigned int *random_seed) {
  return min_value +
         ((max_value - min_value) * (rand_num(random_seed) % 10000) / 10000.0f);
}


x86 assembly (clang, -O0):
<gpr_random_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rand_num@plt>
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
mov    $0x2710,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm2
mulss  %xmm2,%xmm1
movss  0xe96(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpr_random_value>:
push   %rax
movss  %xmm0,0x4(%rsp)
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
call   1030 <rand_num@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  (%rsp),%xmm0
divss  0xea9(%rip),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @gpr_random_value(float %0, float %1, i32* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32*
store float %0, float* %4
store float %1, float* %5
store i32* %2, i32** %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load i32*, i32** %6
%12 = call i32 @rand_num(i32* %11)
%13 = srem i32 %12, 10000
%14 = sitofp i32 %13 to float
%15 = fmul float %10, %14
%16 = fdiv float %15, 1.000000e+04
%17 = fadd float %7, %16
ret float %17
}

LLVM IR (-O2):
define float @gpr_random_value(float %0, float %1, i32* %2) {
%4 = fsub float %1, %0
%5 = tail call i32 @rand_num(i32* %2)
%6 = srem i32 %5, 10000
%7 = sitofp i32 %6 to float
%8 = fmul float %4, %7
%9 = fdiv float %8, 1.000000e+04
%10 = fadd float %9, %0
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ mse_c(double *, double *, int);
double sqrt(int /*<<< orphan*/);
double rmse_c(double *obs, double *sim, int n) {
  return sqrt(mse_c(obs, sim, n));
}


x86 assembly (clang, -O0):
<rmse_c>:
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
call   1030 <mse_c@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @rmse_c(double* %0, double* %1, i32 %2) {
%4 = tail call i32 @mse_c(double* %0, double* %1, i32 %2)
%5 = tail call double @sqrt(i32 %4)
ret double %5
}
/* Variables and functions */
scalar_t__ bar();
void foo() {
  int a = -100;
  int b = 2;
  while (b) {
    if (bar())
      a += 3;
    else
      a = 2;
    b += a;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff9c,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1164 <foo+0x54>
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%rax
je     114f <foo+0x3f>
mov    -0x4(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <foo+0x46>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <foo+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffff9c,%ebx
mov    $0x2,%r14d
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <bar@plt>
add    $0x3,%ebx
test   %rax,%rax
cmove  %r14d,%ebx
add    %ebx,%ebp
jne    1130 <foo+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 2, %0 ], [ %8, %1 ]
%3 = phi i32 [ -100, %0 ], [ %7, %1 ]
%4 = tail call i64 (...) @bar()
%5 = icmp eq i64 %4, 0
%6 = add nsw i32 %3, 3
%7 = select i1 %5, i32 2, i32 %6
%8 = add nsw i32 %7, %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %1
10: ; preds = %1
ret void
}