xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ daemon_shutdown_now(int /*<<< orphan*/);
int /*<<< orphan*/ log_print(char *, ...);
int strlen(char *);
void ui_shutdown_daemon(char *cmd) {
  if (strlen(cmd) == 1) {
    log_print("ui_shutdown_daemon: received shutdown command");
    daemon_shutdown_now(0);
  } else
    log_print("ui_shutdown_daemon: command \"%s\" malformed", cmd);
}


x86 assembly (clang, -O0):
<ui_shutdown_daemon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1168 <ui_shutdown_daemon+0x38>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <log_print@plt>
xor    %edi,%edi
call   1050 <daemon_shutdown_now@plt>
jmp    117a <ui_shutdown_daemon+0x4a>
mov    -0x8(%rbp),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <log_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_shutdown_daemon>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1154 <ui_shutdown_daemon+0x24>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <log_print@plt>
xor    %edi,%edi
pop    %rbx
jmp    1050 <daemon_shutdown_now@plt>
lea    0xed3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <log_print@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"ui_shutdown_daemon: received shutdown command\00"
@.str.1 = [43 x i8] c"ui_shutdown_daemon: command \22%s\22 malformed\00"
define void @ui_shutdown_daemon(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 (i8*, ...) @log_print(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @daemon_shutdown_now(i32 0)
br label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @log_print(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"ui_shutdown_daemon: received shutdown command\00"
@.str.1 = [43 x i8] c"ui_shutdown_daemon: command \22%s\22 malformed\00"
define void @ui_shutdown_daemon(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @log_print(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @daemon_shutdown_now(i32 0)
br label %9
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @log_print(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int num;
  printf("Enter an ASCII code value: ");
  scanf("%d", &num);
  printf("ASCII code value %d represents %c.\n", num, num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec5(%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
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
lea    0xed4(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Enter an ASCII code value: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"ASCII code value %d represents %c.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %5)
ret i32 0
}
int rtl838x_dma_if_rx_ring_size(int i) { return (0xB7E4) + ((i >> 3) << 2); }


x86 assembly (clang, -O0):
<rtl838x_dma_if_rx_ring_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
shl    $0x2,%eax
add    $0xb7e4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl838x_dma_if_rx_ring_size>:
sar    %edi
lea    0xb7e4(%rdi),%eax
and    $0xfffffffc,%eax
ret

LLVM IR (-O0):
define i32 @rtl838x_dma_if_rx_ring_size(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 3
%5 = shl i32 %4, 2
%6 = add nsw i32 47076, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @rtl838x_dma_if_rx_ring_size(i32 %0) {
%2 = ashr i32 %0, 1
%3 = add nsw i32 %2, 47076
%4 = and i32 %3, -4
ret i32 %4
}
/* Type definitions */
typedef enum v4l2_buf_type { ____Placeholder_v4l2_buf_type } v4l2_buf_type;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int V4L2_BUF_TYPE_VIDEO_CAPTURE;
int /*<<< orphan*/ VIDIOC_STREAMOFF;
int /*<<< orphan*/ errno;
int xioctl(int, int /*<<< orphan*/, int *);
int stop_streaming(int fd) {
  if (fd < 0) {
    errno = EINVAL;
    return -1;
  }
  enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  return xioctl(fd, VIDIOC_STREAMOFF, &type);
}


x86 assembly (clang, -O0):
<stop_streaming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1143 <stop_streaming+0x33>
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9b(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <stop_streaming+0x57>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <xioctl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stop_streaming>:
push   %rax
test   %edi,%edi
js     1137 <stop_streaming+0x27>
mov    0x2ecc(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    0x2ecf(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <xioctl@plt>
pop    %rcx
ret
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    0x2e89(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
@V4L2_BUF_TYPE_VIDEO_CAPTURE = global i32 0
@VIDIOC_STREAMOFF = global i32 0
define i32 @stop_streaming(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @EINVAL
store i32 %8, i32* @errno
store i32 -1, i32* %2
br label %14
9: ; preds = %1
%10 = load i32, i32* @V4L2_BUF_TYPE_VIDEO_CAPTURE
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* @VIDIOC_STREAMOFF
%13 = call i32 @xioctl(i32 %11, i32 %12, i32* %4)
store i32 %13, i32* %2
br label %14
14: ; preds = %9, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
@V4L2_BUF_TYPE_VIDEO_CAPTURE = global i32 0
@VIDIOC_STREAMOFF = global i32 0
define i32 @stop_streaming(i32 %0) {
%2 = alloca i32
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
br label %11
6: ; preds = %1
%7 = bitcast i32* %2 to i8*
%8 = load i32, i32* @V4L2_BUF_TYPE_VIDEO_CAPTURE
store i32 %8, i32* %2
%9 = load i32, i32* @VIDIOC_STREAMOFF
%10 = call i32 @xioctl(i32 %0, i32 %9, i32* %2)
br label %11
11: ; preds = %6, %4
%12 = phi i32 [ -1, %4 ], [ %10, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *);
void Jump_Ret(void) {
  Inst_Printf("move", "$25,$2");
  Inst_Printf("j", "$25");
}


x86 assembly (clang, -O0):
<Jump_Ret>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee3(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xede(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1030 <Inst_Printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Jump_Ret>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee6(%rip),%rsi
call   1030 <Inst_Printf@plt>
lea    0xee1(%rip),%rdi
lea    0xedc(%rip),%rsi
pop    %rax
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"move\00"
@.str.1 = [7 x i8] c"$25,$2\00"
@.str.2 = [2 x i8] c"j\00"
@.str.3 = [4 x i8] c"$25\00"
define void @Jump_Ret() {
%1 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @Inst_Printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"move\00"
@.str.1 = [7 x i8] c"$25,$2\00"
@.str.2 = [2 x i8] c"j\00"
@.str.3 = [4 x i8] c"$25\00"
define void @Jump_Ret() {
%1 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int vsnprintf_P(char *str, size_t size, const char *format, va_list ap) {
  return vsnprintf(str, size, format, ap);
}


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

x86 assembly (clang, -O2):
<vsnprintf_P>:
jmp    1030 <vsnprintf@plt>

LLVM IR (-O0):
define i32 @vsnprintf_P(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @vsnprintf(i8* %9, i64 %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @vsnprintf_P(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
extern void dummy(void) { printf("test", 1); }


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

x86 assembly (clang, -O2):
<dummy>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define void @dummy() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void read_input() { printf("reading input files \n"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"reading input files \0A\00"
define void @read_input() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"reading input files \00"
define void @read_input() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char f(char);
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void main(void) {
  int x;
  char y;
  y = 1;
  x = f(y);
  y = x + f(x);
  x = y + f('Q');
  print_int(x);
  print_string("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <f@plt>
movsbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <f@plt>
mov    %al,%cl
mov    -0x10(%rbp),%eax
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x51,%edi
call   1030 <f@plt>
mov    %al,%cl
mov    -0xc(%rbp),%eax
movsbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe6a(%rip),%rdi
call   1040 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <f@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <f@plt>
add    %al,%bl
movsbl %bl,%ebx
mov    $0x51,%edi
call   1030 <f@plt>
movsbl %al,%edi
add    %ebx,%edi
call   1050 <print_int@plt>
lea    0xe9b(%rip),%rdi
pop    %rbx
jmp    1040 <print_string@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @main() {
%1 = tail call signext i8 @f(i8 signext 1)
%2 = tail call signext i8 @f(i8 signext %1)
%3 = add i8 %2, %1
%4 = sext i8 %3 to i32
%5 = tail call signext i8 @f(i8 signext 81)
%6 = sext i8 %5 to i32
%7 = add nsw i32 %4, %6
%8 = tail call i32 @print_int(i32 %7)
%9 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

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


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

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

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

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define double @now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
/* Variables and functions */
int InitialiseValeur(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
void testInitialiseValeur() {
  char *nomFichier;
  char *parametre;
  char *valeur;
  int result = InitialiseValeur(nomFichier, parametre, valeur);
  if (1) {
    printf("%%TEST_FAILED%% time=0 testname=testInitialiseValeur "
           "(Test_gestionfichier) message=error message sample\n");
  }
}


x86 assembly (clang, -O0):
<testInitialiseValeur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <InitialiseValeur@plt>
mov    %eax,-0x1c(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testInitialiseValeur>:
push   %rax
call   1040 <InitialiseValeur@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [105 x i8] c"%%TEST_FAILED%% time=0 testname=testInitialiseValeur (Test_gestionfichier) message=error message sample\0A\00"
define void @testInitialiseValeur() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = load i8*, i8** %1
%6 = load i8*, i8** %2
%7 = load i8*, i8** %3
%8 = call i32 @InitialiseValeur(i8* %5, i8* %6, i8* %7)
store i32 %8, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [105 x i8] c"%%TEST_FAILED%% time=0 testname=testInitialiseValeur (Test_gestionfichier) message=error message sample\0A\00"
define void @testInitialiseValeur() {
%1 = tail call i32 @InitialiseValeur(i8* undef, i8* undef, i8* undef)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int f(int);
main() {
  int stash[] = {1, 2};
  return stash[0] + f(3) + stash[1];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x3,%edi
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1030 <f@plt>
add    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.stash = [2 x i32] [i32 1, i32 2]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = bitcast [2 x i32]* %2 to i8*
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = load i32, i32* %4
%6 = call i32 @f(i32 3)
%7 = add nsw i32 %5, %6
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = add nsw i32 %1, 3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void __on_cleanup(char *s[]) { fputs(*s, stderr); }


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

x86 assembly (clang, -O2):
<__on_cleanup>:
mov    (%rdi),%rdi
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @__on_cleanup(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* %4, i32 %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @__on_cleanup(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* %2, i32 %3)
ret void
}
int test_imm_33uint16_reg(unsigned short val) {
  return ((val) & (-0x33 << 0)) ? -20 : -40;
}


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

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

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

/* Variables and functions */
double timer_to_ms(struct timespec ts) {
  return ts.tv_sec * 1000.0 + ts.tv_nsec / 1000.0 / 1000.0;
}


x86 assembly (clang, -O0):
<timer_to_ms>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xed4(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xec8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_to_ms>:
movsd  0xef8(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
define double @timer_to_ms(double %0, double %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to { double, double }*
%5 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %1, double* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = fdiv double %10, 1.000000e+03
%12 = fdiv double %11, 1.000000e+03
%13 = call double @llvm.fmuladd.f64(double %8, double 1.000000e+03, double %12)
ret double %13
}

LLVM IR (-O2):
define double @timer_to_ms(double %0, double %1) {
%3 = fdiv double %1, 1.000000e+03
%4 = fdiv double %3, 1.000000e+03
%5 = tail call double @llvm.fmuladd.f64(double %0, double 1.000000e+03, double %4)
ret double %5
}
/* Type definitions */
struct csi_int_status {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ csi_int_get_status(unsigned int, unsigned int,
                                      struct csi_int_status *);
void bsp_csi_int_get_status(unsigned int sel, unsigned int ch,
                            struct csi_int_status *status) {
  csi_int_get_status(sel, ch, status);
}


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

x86 assembly (clang, -O2):
<bsp_csi_int_get_status>:
jmp    1030 <csi_int_get_status@plt>

LLVM IR (-O0):
%struct.csi_int_status = type { i32 }
define void @bsp_csi_int_get_status(i32 %0, i32 %1, %struct.csi_int_status* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.csi_int_status*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.csi_int_status* %2, %struct.csi_int_status** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load %struct.csi_int_status*, %struct.csi_int_status** %6
%10 = call i32 @csi_int_get_status(i32 %7, i32 %8, %struct.csi_int_status* %9)
ret void
}

LLVM IR (-O2):
%struct.csi_int_status = type { i32 }
define void @bsp_csi_int_get_status(i32 %0, i32 %1, %struct.csi_int_status* %2) {
%4 = tail call i32 @csi_int_get_status(i32 %0, i32 %1, %struct.csi_int_status* %2)
ret void
}
void bar(x) int x;
{
  printf("%d\n", x);
  long_line();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <long_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <long_line@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @bar(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @long_line()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ saa7114_write_reg(int, int);
int saa7114_decoder_software_reset(void) {
  saa7114_write_reg(0x88, 0xC0);
  saa7114_write_reg(0x88, 0xF0);
  return 0;
}


x86 assembly (clang, -O0):
<saa7114_decoder_software_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x88,%edi
mov    $0xc0,%esi
call   1030 <saa7114_write_reg@plt>
mov    $0x88,%edi
mov    $0xf0,%esi
call   1030 <saa7114_write_reg@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<saa7114_decoder_software_reset>:
push   %rax
mov    $0x88,%edi
mov    $0xc0,%esi
call   1030 <saa7114_write_reg@plt>
mov    $0x88,%edi
mov    $0xf0,%esi
call   1030 <saa7114_write_reg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @saa7114_decoder_software_reset() {
%1 = call i32 @saa7114_write_reg(i32 136, i32 192)
%2 = call i32 @saa7114_write_reg(i32 136, i32 240)
ret i32 0
}

LLVM IR (-O2):
define i32 @saa7114_decoder_software_reset() {
%1 = tail call i32 @saa7114_write_reg(i32 136, i32 192)
%2 = tail call i32 @saa7114_write_reg(i32 136, i32 240)
ret i32 0
}
void clearfifo(double *fifo, unsigned int lenlista) {
  unsigned int counter = 0;
  while (counter < lenlista) {
    counter++;
    *(fifo++) = 0;
  }
}


x86 assembly (clang, -O0):
<clearfifo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1142 <clearfifo+0x42>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1112 <clearfifo+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearfifo>:
test   %esi,%esi
je     1126 <clearfifo+0x16>
push   %rax
mov    %esi,%edx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @clearfifo(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %5
%12 = add i32 %11, 1
store i32 %12, i32* %5
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i32 1
store double* %14, double** %3
store double 0.000000e+00, double* %13
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @clearfifo(double* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ p(char *);
void callPrintfX() {
  p("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
    "2022-01-22/02-19-57/repos/bartoszbielawski/preload-example/refs/heads/"
    "master/preload.c");
}


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

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

LLVM IR (-O0):
@.str = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bartoszbielawski/preload-example/refs/heads/master/preload.c\00"
define void @callPrintfX() {
%1 = call i32 @p(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bartoszbielawski/preload-example/refs/heads/master/preload.c\00"
define void @callPrintfX() {
%1 = tail call i32 @p(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int INT_MAX;
int shift_overflow(int a, int shift) { return (INT_MAX >> shift) < a; }


x86 assembly (clang, -O0):
<shift_overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ed7(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
cmp    -0x4(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_overflow>:
mov    %esi,%ecx
mov    0x2edf(%rip),%rax
mov    (%rax),%edx
sar    %cl,%edx
xor    %eax,%eax
cmp    %edi,%edx
setl   %al
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @shift_overflow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @INT_MAX
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @shift_overflow(i32 %0, i32 %1) {
%3 = load i32, i32* @INT_MAX
%4 = ashr i32 %3, %1
%5 = icmp slt i32 %4, %0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
long EFAULT;
long __strncpy_from_user(char *, char const *, long);
int /*<<< orphan*/ might_sleep();
long strncpy_from_user(char *dst, const char *src, long count) {
  long res = -EFAULT;
  might_sleep();
  if ((1))
    res = __strncpy_from_user(dst, src, count);
  return res;
}


x86 assembly (clang, -O0):
<strncpy_from_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ebb(%rip),%rcx
sub    (%rcx),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <might_sleep@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <__strncpy_from_user@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy_from_user>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <might_sleep@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <__strncpy_from_user@plt>

LLVM IR (-O0):
@EFAULT = global i64 0
define i64 @strncpy_from_user(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* @EFAULT
%9 = sub nsw i64 0, %8
store i64 %9, i64* %7
%10 = call i32 (...) @might_sleep()
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call i64 @__strncpy_from_user(i8* %11, i8* %12, i64 %13)
store i64 %14, i64* %7
%15 = load i64, i64* %7
ret i64 %15
}

LLVM IR (-O2):
@EFAULT = global i64 0
define i64 @strncpy_from_user(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @might_sleep()
%5 = tail call i64 @__strncpy_from_user(i8* %0, i8* %1, i64 %2)
ret i64 %5
}
double urand(void) {
  static unsigned long int x = 1;
  x = (1103515245 * x + 12345) & 0x7fffffffUL;
  return x / 2147483648.0;
}


x86 assembly (clang, -O0):
<urand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
imul   $0x41c64e6d,%eax,%ecx
add    $0x3039,%ecx
mov    %ecx,%eax
and    $0x7fffffff,%eax
mov    %rax,0x2efc(%rip)
movaps 0xee5(%rip),%xmm1
movq   0x2eed(%rip),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xee1(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<urand>:
imul   $0x41c64e6d,0x2f16(%rip),%eax
4e c6 41
add    $0x3039,%eax
and    $0x7fffffff,%eax
mov    %rax,0x2f05(%rip)
cvtsi2sd %eax,%xmm0
mulsd  0xed9(%rip),%xmm0
ret

LLVM IR (-O0):
@urand.x = internal global i64 1
define double @urand() {
%1 = load i64, i64* @urand.x
%2 = mul i64 1103515245, %1
%3 = add i64 %2, 12345
%4 = and i64 %3, 2147483647
store i64 %4, i64* @urand.x
%5 = load i64, i64* @urand.x
%6 = uitofp i64 %5 to double
%7 = fdiv double %6, 0x41E0000000000000
ret double %7
}

LLVM IR (-O2):
@urand.x = internal unnamed_addr global i64 1
define double @urand() {
%1 = load i64, i64* @urand.x
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
%4 = and i64 %3, 2147483647
store i64 %4, i64* @urand.x
%5 = uitofp i64 %4 to double
%6 = fmul double %5, 0x3E00000000000000
ret double %6
}
void verify() {}


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

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

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

LLVM IR (-O2):
define void @verify() {
ret void
}
long XExtendedMaxRequestSize() {}


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

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

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

LLVM IR (-O2):
define i64 @XExtendedMaxRequestSize() {
ret i64 undef
}
/* Variables and functions */
int strlen(char *);
long hash(char *word) {
  int count;
  long hash = 42;
  for (count = 0; count < strlen(word); count++) {
    hash = hash + word[count] * (count + 1);
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x2a,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    1178 <hash+0x68>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <hash+0x1b>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    $0x2a,%r15d
test   %eax,%eax
jle    1150 <hash+0x40>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%eax
add    $0x1,%rbx
imul   %ebx,%eax
cltq
add    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1130 <hash+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
store i8* %0, i8** %2
store i64 42, i64* %4
store i32 0, i32* %3
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %26
10: ; preds = %5
%11 = load i64, i64* %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%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 = load i32, i32* %3
%19 = add nsw i32 %18, 1
%20 = mul nsw i32 %17, %19
%21 = sext i32 %20 to i64
%22 = add nsw i64 %11, %21
store i64 %22, i64* %4
br label %23
23: ; preds = %10
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
%27 = load i64, i64* %4
ret i64 %27
}

LLVM IR (-O2):
define i64 @hash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %18
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i64 [ %14, %4 ], [ 42, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = sext i8 %8 to i64
%10 = add nuw nsw i64 %5, 1
%11 = mul i64 %10, %9
%12 = shl i64 %11, 32
%13 = ashr exact i64 %12, 32
%14 = add nsw i64 %6, %13
%15 = tail call i32 @strlen(i8* %0)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %10, %16
br i1 %17, label %4, label %18
18: ; preds = %4, %1
%19 = phi i64 [ 42, %1 ], [ %14, %4 ]
ret i64 %19
}
/* Variables and functions */
int /*<<< orphan*/ factorial(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void main() { printf("12 %ld \n", factorial(12)); }


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"12 %ld \0A\00"
define void @main() {
%1 = tail call i32 @factorial(i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void ff_hevc_put_hevc_uni_w_qpel_h64_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_qpel_h64_12_sse4() {
ret void
}
int irbit1(unsigned long *iseed) {
  unsigned long newbit;
  newbit =
      (*iseed >> 17) & 1 ^ (*iseed >> 4) & 1 ^ (*iseed >> 1) & 1 ^ (*iseed & 1);
  *iseed = (*iseed << 1) | newbit;
  return (int)newbit;
}


x86 assembly (clang, -O0):
<irbit1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shr    $0x11,%rax
and    $0x1,%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shr    $0x4,%rcx
and    $0x1,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shr    $0x1,%rcx
and    $0x1,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
and    $0x1,%rcx
xor    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
shl    $0x1,%rcx
or     -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<irbit1>:
mov    (%rdi),%rcx
mov    %ecx,%edx
shr    $0x4,%edx
xor    %ecx,%edx
mov    %ecx,%esi
shr    $0x11,%esi
mov    %ecx,%eax
shr    %eax
xor    %esi,%eax
xor    %edx,%eax
and    $0x1,%eax
lea    (%rax,%rcx,2),%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @irbit1(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = lshr i64 %5, 17
%7 = and i64 %6, 1
%8 = load i64*, i64** %2
%9 = load i64, i64* %8
%10 = lshr i64 %9, 4
%11 = and i64 %10, 1
%12 = xor i64 %7, %11
%13 = load i64*, i64** %2
%14 = load i64, i64* %13
%15 = lshr i64 %14, 1
%16 = and i64 %15, 1
%17 = xor i64 %12, %16
%18 = load i64*, i64** %2
%19 = load i64, i64* %18
%20 = and i64 %19, 1
%21 = xor i64 %17, %20
store i64 %21, i64* %3
%22 = load i64*, i64** %2
%23 = load i64, i64* %22
%24 = shl i64 %23, 1
%25 = load i64, i64* %3
%26 = or i64 %24, %25
%27 = load i64*, i64** %2
store i64 %26, i64* %27
%28 = load i64, i64* %3
%29 = trunc i64 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
define i32 @irbit1(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = lshr i64 %2, 17
%4 = lshr i64 %2, 4
%5 = lshr i64 %2, 1
%6 = xor i64 %4, %2
%7 = xor i64 %6, %3
%8 = xor i64 %7, %5
%9 = and i64 %8, 1
%10 = shl i64 %2, 1
%11 = or i64 %9, %10
store i64 %11, i64* %0
%12 = trunc i64 %9 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ fenv_t;

/* Variables and functions */
int feupdateenv(const fenv_t *envp) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @feupdateenv(i32* nocapture readnone %0) {
ret i32 0
}
void swap(double *srcdata, int i, int j) {
  double temp;
  temp = srcdata[i];
  srcdata[i] = srcdata[j];
  srcdata[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm0
movslq %edx,%rcx
movsd  (%rdi,%rcx,8),%xmm1
movsd  %xmm1,(%rdi,%rax,8)
movsd  %xmm0,(%rdi,%rcx,8)
ret

LLVM IR (-O0):
define void @swap(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load double*, double** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = load double, double* %11
store double %12, double* %7
%13 = load double*, double** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
store double %17, double* %21
%22 = load double, double* %7
%23 = load double*, double** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
ret void
}

LLVM IR (-O2):
define void @swap(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = load double, double* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
store double %9, double* %5
store double %6, double* %8
ret void
}
/* Variables and functions */
unsigned long fibonacci(unsigned long);
unsigned long *malloc(unsigned long);
int /*<<< orphan*/ print_array(unsigned long *, unsigned long);
int main() {
  unsigned long c = 0;
  unsigned long elements = 94;
  unsigned long *numray = malloc(elements * sizeof(unsigned long));
  while (c < elements)
    numray[c++] = fibonacci(c + 1);
  print_array(numray, elements);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x5e,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    119a <main+0x6a>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <fibonacci@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x10(%rbp)
mov    %rdx,(%rax,%rcx,8)
jmp    1160 <main+0x30>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2f0,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <fibonacci@plt>
mov    %rax,-0x8(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x5f,%rbx
jne    1150 <main+0x20>
mov    $0x5e,%esi
mov    %r14,%rdi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64*
store i32 0, i32* %1
store i64 0, i64* %2
store i64 94, i64* %3
%5 = load i64, i64* %3
%6 = mul i64 %5, 8
%7 = call i64* @malloc(i64 %6)
store i64* %7, i64** %4
br label %8
8: ; preds = %12, %0
%9 = load i64, i64* %2
%10 = load i64, i64* %3
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i64, i64* %2
%14 = add i64 %13, 1
%15 = call i64 @fibonacci(i64 %14)
%16 = load i64*, i64** %4
%17 = load i64, i64* %2
%18 = add i64 %17, 1
store i64 %18, i64* %2
%19 = getelementptr inbounds i64, i64* %16, i64 %17
store i64 %15, i64* %19
br label %8
20: ; preds = %8
%21 = load i64*, i64** %4
%22 = load i64, i64* %3
%23 = call i32 @print_array(i64* %21, i64 %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64* @malloc(i64 752)
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %4, %2 ]
%4 = add nuw nsw i64 %3, 1
%5 = tail call i64 @fibonacci(i64 %4)
%6 = getelementptr inbounds i64, i64* %1, i64 %3
store i64 %5, i64* %6
%7 = icmp eq i64 %4, 94
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = tail call i32 @print_array(i64* %1, i64 94)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void failure_() { printf("There was an unexpected error.\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"There was an unexpected error.\0A\00"
define void @failure_() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"There was an unexpected error.\00"
define void @failure_() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}