xunge/DecIR huggingface dataset:
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ perror(char *);
int bindAddress(int sockfd, struct sockaddr *addr) {
  int ret = bind(sockfd, addr, sizeof(struct sockaddr));
  if (ret == -1) {
    perror("bind sock addr error:");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bindAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <bind@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1165 <bindAddress+0x45>
lea    0xeac(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <bindAddress+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bindAddress>:
push   %rax
mov    $0x4,%edx
call   1030 <bind@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1136 <bindAddress+0x16>
pop    %rcx
ret
lea    0xec3(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"bind sock addr error:\00"
define i32 @bindAddress(i32 %0, %struct.sockaddr* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = call i32 @bind(i32 %7, %struct.sockaddr* %8, i32 4)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %15
15: ; preds = %14, %12
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"bind sock addr error:\00"
define i32 @bindAddress(i32 %0, %struct.sockaddr* %1) {
%3 = tail call i32 @bind(i32 %0, %struct.sockaddr* %1, i32 4)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("DAYS is %d.\n", 30);
  printf("MONTHS should be 12.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1e,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"DAYS is %d.\0A\00"
@.str.1 = [22 x i8] c"MONTHS should be 12.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 30)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"DAYS is %d.\0A\00"
@str = [21 x i8] c"MONTHS should be 12.\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 30)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, int);
char *g_get_current_dir(char *dirname, int maxlen) {
  getcwd(dirname, maxlen);
  return 0;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @g_get_current_dir(i8* %0, i32 %1) {
%3 = tail call i32 @getcwd(i8* %0, i32 %1)
ret i8* null
}
unsigned long get_user_quad(const long *addr) { return *addr; }


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

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

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

LLVM IR (-O2):
define i64 @get_user_quad(i64* nocapture %0) {
%2 = load i64, i64* %0
ret i64 %2
}
/* Variables and functions */
char const *vp_file_write(char *);
const char *vp_socket_write(char *args) { return vp_file_write(args); }


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

x86 assembly (clang, -O2):
<vp_socket_write>:
jmp    1030 <vp_file_write@plt>

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

LLVM IR (-O2):
define i8* @vp_socket_write(i8* %0) {
%2 = tail call i8* @vp_file_write(i8* %0)
ret i8* %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void CANEnable(uint32_t ui32Base) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) &= ~0x00000001;
}


x86 assembly (clang, -O0):
<CANEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CANEnable>:
movslq %edi,%rax
andl   $0xfffffffe,(%rax)
ret

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

LLVM IR (-O2):
define void @CANEnable(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = and i32 %4, -2
store volatile i32 %5, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putsbase_fd(int, int, int, int /*<<< orphan*/);
void ft_putnbr_fd(int n, int fd) { ft_putsbase_fd(n, 10, fd, 0); }


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

x86 assembly (clang, -O2):
<ft_putnbr_fd>:
mov    %esi,%edx
mov    $0xa,%esi
xor    %ecx,%ecx
jmp    1030 <ft_putsbase_fd@plt>

LLVM IR (-O0):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @ft_putsbase_fd(i32 %5, i32 10, i32 %6, i32 0)
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = tail call i32 @ft_putsbase_fd(i32 %0, i32 10, i32 %1, i32 0)
ret void
}
long long clampll(long long u, long long llimit, long long rlimit) {
  if (__builtin_expect(!!(u < llimit), 0)) {
    return llimit;
  } else if (__builtin_expect(!!(u > rlimit), 0)) {
    return rlimit;
  }
  return u;
}


x86 assembly (clang, -O0):
<clampll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
setl   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     113d <clampll+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <clampll+0x77>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
setg   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     116a <clampll+0x6a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <clampll+0x77>
jmp    116f <clampll+0x6f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampll>:
mov    %rsi,%rax
cmp    %rdx,%rdi
cmovle %rdi,%rdx
cmp    %rsi,%rdi
jl     1112 <clampll+0x12>
mov    %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @clampll(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp sgt i64 %0, %2
%6 = select i1 %5, i64 %2, i64 %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
/* Type definitions */
struct state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ randomizeAllAngularOrientations(struct state *);
int /*<<< orphan*/ randomizeAllZoomularOrientations(struct state *);
void randomizeAllOrientations(struct state *st) {
  randomizeAllAngularOrientations(st);
  randomizeAllZoomularOrientations(st);
}


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

x86 assembly (clang, -O2):
<randomizeAllOrientations>:
push   %rbx
mov    %rdi,%rbx
call   1030 <randomizeAllAngularOrientations@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <randomizeAllZoomularOrientations@plt>

LLVM IR (-O0):
%struct.state = type { i32 }
define void @randomizeAllOrientations(%struct.state* %0) {
%2 = alloca %struct.state*
store %struct.state* %0, %struct.state** %2
%3 = load %struct.state*, %struct.state** %2
%4 = call i32 @randomizeAllAngularOrientations(%struct.state* %3)
%5 = load %struct.state*, %struct.state** %2
%6 = call i32 @randomizeAllZoomularOrientations(%struct.state* %5)
ret void
}

LLVM IR (-O2):
%struct.state = type { i32 }
define void @randomizeAllOrientations(%struct.state* %0) {
%2 = tail call i32 @randomizeAllAngularOrientations(%struct.state* %0)
%3 = tail call i32 @randomizeAllZoomularOrientations(%struct.state* %0)
ret void
}
/* Variables and functions */
int ceil(double);
int floor(double);
int ceil_away0(double d) { return (d > 0.0) ? ceil(d) : floor(d); }


x86 assembly (clang, -O0):
<ceil_away0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1151 <ceil_away0+0x31>
movsd  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,-0xc(%rbp)
jmp    115e <ceil_away0+0x3e>
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_away0>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112f <ceil_away0+0xf>
jmp    1030 <ceil@plt>
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i32 @ceil_away0(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = call i32 @ceil(double %6)
br label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = call i32 @floor(double %9)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ %7, %5 ], [ %10, %8 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @ceil_away0(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @ceil(double %0)
br label %7
5: ; preds = %1
%6 = tail call i32 @floor(double %0)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %4, %3 ], [ %6, %5 ]
ret i32 %8
}
/* Variables and functions */
int GCD(int, int);
int /*<<< orphan*/ printf(char *, int);
void main(void) { printf("%d\n", GCD(6, 12)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0xc,%esi
call   1040 <GCD@plt>
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
mov    $0xc,%esi
call   1040 <GCD@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32 @GCD(i32 6, i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct stat {
  scalar_t__ st_size;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int _DC_file_empty(char *fn) {
  struct stat s;
  if (stat(fn, &s))
    return (1);
  return (s.st_size == 0);
}


x86 assembly (clang, -O0):
<_DC_file_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <_DC_file_empty+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    114f <_DC_file_empty+0x3f>
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_DC_file_empty>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
setne  %al
cmpq   $0x0,(%rsp)
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @_DC_file_empty(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %14
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @_DC_file_empty(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp ne i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
%9 = select i1 %5, i1 true, i1 %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int ntlibc_isdigit(int c) {
  if (('0' <= c) && (c <= '9')) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ntlibc_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x30,%eax
cmp    -0x8(%rbp),%eax
jg     112b <ntlibc_isdigit+0x2b>
cmpl   $0x39,-0x8(%rbp)
jg     112b <ntlibc_isdigit+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1132 <ntlibc_isdigit+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntlibc_isdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @ntlibc_isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ CleanExit(int);
int /*<<< orphan*/ exit(int);
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int, int, int);
void sigHand(int sig) {
  printf("Parent PID [%u] Process PID [%u], received signal [%d], cleaning up "
         "and exiting \n",
         getppid(), getpid(), sig);
  if (sig != 11) {
    CleanExit(sig);
  } else {
    exit(sig);
  }
}


x86 assembly (clang, -O0):
<sigHand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <getppid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
mov    -0x4(%rbp),%ecx
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0xb,-0x4(%rbp)
je     1197 <sigHand+0x47>
mov    -0x4(%rbp),%edi
call   1050 <CleanExit@plt>
jmp    119f <sigHand+0x4f>
mov    -0x4(%rbp),%edi
call   1070 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigHand>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xe94(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
cmp    $0xb,%ebx
je     1189 <sigHand+0x39>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <CleanExit@plt>
mov    $0xb,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [82 x i8] c"Parent PID [%u] Process PID [%u], received signal [%d], cleaning up and exiting \0A\00"
define void @sigHand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getppid()
%4 = call i32 (...) @getpid()
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %5)
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 11
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @CleanExit(i32 %10)
br label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [82 x i8] c"Parent PID [%u] Process PID [%u], received signal [%d], cleaning up and exiting \0A\00"
define void @sigHand(i32 %0) {
%2 = tail call i32 (...) @getppid()
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %0)
%5 = icmp eq i32 %0, 11
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @CleanExit(i32 %0)
ret void
8: ; preds = %1
%9 = tail call i32 @exit(i32 11)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ reset_common(int /*<<< orphan*/);
void softresetx86(void) { reset_common(0); }


x86 assembly (clang, -O0):
<softresetx86>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <reset_common@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<softresetx86>:
xor    %edi,%edi
jmp    1030 <reset_common@plt>

LLVM IR (-O0):
define void @softresetx86() {
%1 = call i32 @reset_common(i32 0)
ret void
}

LLVM IR (-O2):
define void @softresetx86() {
%1 = tail call i32 @reset_common(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
scalar_t__ getgroups(int, short *);
int setgroups(int, short *);
void main() {
  short x[4];
  x[0] = x[1] = 0;
  if (getgroups(1, x) == 0)
    if (setgroups(1, x) == -1)
      _exit(1);
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1050 <getgroups@plt>
cmp    $0x0,%rax
jne    1182 <main+0x52>
lea    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1040 <setgroups@plt>
cmp    $0xffffffff,%eax
jne    117d <main+0x4d>
mov    $0x1,%edi
call   1030 <_exit@plt>
jmp    1182 <main+0x52>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,(%rsp)
mov    %rsp,%rsi
mov    $0x1,%edi
call   1050 <getgroups@plt>
test   %rax,%rax
jne    1166 <main+0x36>
mov    %rsp,%rsi
mov    $0x1,%edi
call   1040 <setgroups@plt>
cmp    $0xffffffff,%eax
jne    1166 <main+0x36>
mov    $0x1,%edi
call   1030 <_exit@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca [4 x i16]
%2 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 1
store i16 0, i16* %2
%3 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 0
store i16 0, i16* %3
%4 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 0
%5 = call i64 @getgroups(i32 1, i16* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 0
%9 = call i32 @setgroups(i32 1, i16* %8)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @_exit(i32 1)
unreachable
13: ; preds = %7
br label %14
14: ; preds = %13, %0
%15 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [4 x i16]
%2 = bitcast [4 x i16]* %1 to i8*
%3 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 1
store i16 0, i16* %3
%4 = getelementptr inbounds [4 x i16], [4 x i16]* %1, i64 0, i64 0
store i16 0, i16* %4
%5 = call i64 @getgroups(i32 1, i16* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = call i32 @setgroups(i32 1, i16* %4)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @_exit(i32 1)
unreachable
12: ; preds = %7, %0
%13 = call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void init_signal(void (*func)(int)) { signal(SIGINT, func); }


x86 assembly (clang, -O0):
<init_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_signal>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <signal@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
define void @init_signal(void (i32)* %0) {
%2 = alloca void (i32)*
store void (i32)* %0, void (i32)** %2
%3 = load i32, i32* @SIGINT
%4 = load void (i32)*, void (i32)** %2
%5 = call i32 @signal(i32 %3, void (i32)* %4)
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @init_signal(void (i32)* %0) {
%2 = load i32, i32* @SIGINT
%3 = tail call i32 @signal(i32 %2, void (i32)* %0)
ret void
}
/* Type definitions */
typedef float const int16_t;

/* Variables and functions */
float float_from_i16(int16_t ival) {
  static const float scale = 1. / (float)(1UL << 15);
  return ival * scale;
}


x86 assembly (clang, -O0):
<float_from_i16>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
@float_from_i16.scale = internal constant float 0x3F00000000000000
define float @float_from_i16(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x3F00000000000000
ret float %4
}

LLVM IR (-O2):
define float @float_from_i16(float %0) {
%2 = fmul float %0, 0x3F00000000000000
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ euclidean_distance_square(float const *, float const *, int);
float sqrt(int /*<<< orphan*/);
float euclidean_distance(const float *x, const float *y, int length) {
  return sqrt(euclidean_distance_square(x, y, length));
}


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

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

LLVM IR (-O0):
define float @euclidean_distance(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 i32, i32* %6
%10 = call i32 @euclidean_distance_square(float* %7, float* %8, i32 %9)
%11 = call float @sqrt(i32 %10)
ret float %11
}

LLVM IR (-O2):
define float @euclidean_distance(float* %0, float* %1, i32 %2) {
%4 = tail call i32 @euclidean_distance_square(float* %0, float* %1, i32 %2)
%5 = tail call float @sqrt(i32 %4)
ret float %5
}
/* Variables and functions */
int read(int, char *, int);
int __getchar(int fd) {
  static char ch;
  return (read(fd, &ch, 1) == 1) ? ch : (-1);
}


x86 assembly (clang, -O0):
<__getchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0x2f04(%rip),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jne    1147 <__getchar+0x37>
movsbl 0x2eea(%rip),%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <__getchar+0x44>
mov    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <__getchar+0x44>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getchar>:
push   %rax
lea    0x2f11(%rip),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
movsbl 0x2efd(%rip),%ecx
mov    $0xffffffff,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__getchar.ch = internal global i8 0
define i32 @__getchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @read(i32 %3, i8* @__getchar.ch, i32 1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8, i8* @__getchar.ch
%8 = sext i8 %7 to i32
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %6
%11 = phi i32 [ %8, %6 ], [ -1, %9 ]
ret i32 %11
}

LLVM IR (-O2):
@__getchar.ch = internal global i8 0
define i32 @__getchar(i32 %0) {
%2 = tail call i32 @read(i32 %0, i8* @__getchar.ch, i32 1)
%3 = icmp eq i32 %2, 1
%4 = load i8, i8* @__getchar.ch
%5 = sext i8 %4 to i32
%6 = select i1 %3, i32 %5, i32 -1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ mystrncpy(char *, char *, int);
void f(char *z) {
  char x[3];
  char y[3];
  mystrncpy(x, z, 3);
  mystrncpy(y, z, 3);
  x[(sizeof x)] = 'i';
  y[((sizeof y) - 1)] = '0';
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xb(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
call   1030 <mystrncpy@plt>
lea    -0xe(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
call   1030 <mystrncpy@plt>
movb   $0x69,-0x8(%rbp)
movb   $0x30,-0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xd(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <mystrncpy@plt>
lea    0xa(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <mystrncpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @f(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @mystrncpy(i8* %5, i8* %6, i32 3)
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** %2
%10 = call i32 @mystrncpy(i8* %8, i8* %9, i32 3)
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 3
store i8 105, i8* %11
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 48, i8* %12
ret void
}

LLVM IR (-O2):
define void @f(i8* %0) {
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%6 = call i32 @mystrncpy(i8* %4, i8* %0, i32 3)
%7 = call i32 @mystrncpy(i8* %5, i8* %0, i32 3)
ret void
}
/* Variables and functions */
double slc_distance(double const *, double const *, double);
double geo_distance_mi(const double *a, const double *b, int k) {
  return slc_distance(a, b, 3958.760);
}


x86 assembly (clang, -O0):
<geo_distance_mi>:
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
movsd  0xecd(%rip),%xmm0
call   1030 <slc_distance@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define double @geo_distance_mi(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 = call double @slc_distance(double* %7, double* %8, double 3.958760e+03)
ret double %9
}

LLVM IR (-O2):
define double @geo_distance_mi(double* %0, double* %1, i32 %2) {
%4 = tail call double @slc_distance(double* %0, double* %1, double 3.958760e+03)
ret double %4
}
int test_imm_94int16_reg(short val) {
  return ((val) & (0x94 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_94int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 148
%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_94int16_reg(i16 signext %0) {
%2 = and i16 %0, 148
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 1; i <= 1000; ++i)
    printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     1150 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 1001
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
int execute_fcntl64() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_fcntl64() {
ret i32 0
}
/* Variables and functions */
int split(int *, int, int);
void quicksort(int *nums, int p, int r) {
  if (p < r) {
    int q = split(nums, p, r);
    quicksort(nums, p, q - 1);
    quicksort(nums, q + 1, r);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quicksort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <split@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <split@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @split(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage:\n");
  printf("  bench_csr -f <matrix_file> [-t] [-c]\n");
  printf("  -p  matrix file is in preprocessed format\n");
  printf("  -t  transpose matrix\n");
  printf("  -c  run conjugate gradient\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf29(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [40 x i8] c" bench_csr -f <matrix_file> [-t] [-c]\0A\00"
@.str.2 = [45 x i8] c" -p matrix file is in preprocessed format\0A\00"
@.str.3 = [24 x i8] c" -t transpose matrix\0A\00"
@.str.4 = [30 x i8] c" -c run conjugate gradient\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.5 = [39 x i8] c" bench_csr -f <matrix_file> [-t] [-c]\00"
@str.6 = [44 x i8] c" -p matrix file is in preprocessed format\00"
@str.7 = [23 x i8] c" -t transpose matrix\00"
@str.8 = [29 x i8] c" -c run conjugate gradient\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.8, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef char u_int8_t;
typedef char u_int16_t;

/* Variables and functions */
void ASCIIToUNICODE(u_int16_t *out_buf, u_int8_t *in_buf) {
  u_int8_t *pchTempPtr = in_buf;
  u_int16_t *pwTempPtr = out_buf;
  while (*pchTempPtr != '\0') {
    *pwTempPtr = (u_int16_t)*pchTempPtr;
    pchTempPtr++;
    pwTempPtr++;
  }
  *pwTempPtr = '\0';
  return;
}


x86 assembly (clang, -O0):
<ASCIIToUNICODE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1155 <ASCIIToUNICODE+0x55>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111c <ASCIIToUNICODE+0x1c>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASCIIToUNICODE>:
mov    (%rsi),%al
test   %al,%al
je     1121 <ASCIIToUNICODE+0x21>
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1110 <ASCIIToUNICODE+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @ASCIIToUNICODE(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
store i8 %6, i8* %7
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
/* Variables and functions */
int atoi(char *);
scalar_t__ strcmp(char *, char *);
char *strtok(char *, char *);
int parse(char *str) {
  char *word;
  word = strtok(str, " #");
  if (strcmp(word, "@") == 0) {
    word = strtok(NULL, " #");
    return (atoi(word));
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118f <parse+0x5f>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8b(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1196 <parse+0x66>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rax
lea    0xec8(%rip),%rsi
call   1040 <strtok@plt>
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1158 <parse+0x28>
mov    $0xffffffff,%eax
pop    %rcx
ret
lea    0xea1(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
mov    %rax,%rdi
pop    %rax
jmp    1050 <atoi@plt>

LLVM IR (-O0):
@.str = [3 x i8] c" #\00"
@.str.1 = [2 x i8] c"@\00"
define i32 @parse(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %2
br label %15
14: ; preds = %1
store i32 -1, i32* %2
br label %15
15: ; preds = %14, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c" #\00"
@.str.1 = [2 x i8] c"@\00"
define i32 @parse(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ %7, %5 ], [ -1, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
char *corta_string(char *apuntador) {
  int l;
  l = strlen(apuntador);
  if (l > 0) {
    apuntador = apuntador + 1;
    return apuntador;
  } else {
    printf("Longitud %d\n", l);
    return "ERROR";
  }
}


x86 assembly (clang, -O0):
<corta_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    115b <corta_string+0x3b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <corta_string+0x55>
mov    -0x14(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<corta_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1133 <corta_string+0x13>
add    $0x1,%rbx
jmp    1148 <corta_string+0x28>
lea    0xec6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xec5(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Longitud %d\0A\00"
@.str.1 = [6 x i8] c"ERROR\00"
define i8* @corta_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %3
%12 = load i8*, i8** %3
store i8* %12, i8** %2
br label %16
13: ; preds = %1
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %14)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %13, %9
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [13 x i8] c"Longitud %d\0A\00"
@.str.1 = [6 x i8] c"ERROR\00"
define i8* @corta_string(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 = getelementptr inbounds i8, i8* %0, i64 1
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %6 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void long_func(void) {
  int k = 0;
  sleep(5);
  k = 1;
  k = 2;
}


x86 assembly (clang, -O0):
<long_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <sleep@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_func>:
mov    $0x5,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @long_func() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sleep(i32 5)
store i32 1, i32* %1
store i32 2, i32* %1
ret void
}

LLVM IR (-O2):
define void @long_func() {
%1 = tail call i32 @sleep(i32 5)
ret void
}
/* Type definitions */
struct sm_seg_hdl {
  int dummy;
};
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int O_CREAT;
int O_TRUNC;
struct sm_seg_hdl *sm_seg_instance_get(int /*<<< orphan*/, int, int);
struct sm_seg_hdl *sm_seg_instance_create(key_t key, int size) {
  return (sm_seg_instance_get(key, size, O_CREAT | O_TRUNC));
}


x86 assembly (clang, -O0):
<sm_seg_instance_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2ecd(%rip),%rax
mov    (%rax),%edx
mov    0x2ebc(%rip),%rax
or     (%rax),%edx
call   1030 <sm_seg_instance_get@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sm_seg_instance_create>:
mov    0x2ee1(%rip),%rax
mov    0x2ed2(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
jmp    1030 <sm_seg_instance_get@plt>

LLVM IR (-O0):
%struct.sm_seg_hdl = type { i32 }
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define %struct.sm_seg_hdl* @sm_seg_instance_create(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 = load i32, i32* @O_CREAT
%8 = load i32, i32* @O_TRUNC
%9 = or i32 %7, %8
%10 = call %struct.sm_seg_hdl* @sm_seg_instance_get(i32 %5, i32 %6, i32 %9)
ret %struct.sm_seg_hdl* %10
}

LLVM IR (-O2):
%struct.sm_seg_hdl = type { i32 }
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define %struct.sm_seg_hdl* @sm_seg_instance_create(i32 %0, i32 %1) {
%3 = load i32, i32* @O_CREAT
%4 = load i32, i32* @O_TRUNC
%5 = or i32 %4, %3
%6 = tail call %struct.sm_seg_hdl* @sm_seg_instance_get(i32 %0, i32 %1, i32 %5)
ret %struct.sm_seg_hdl* %6
}