xunge/DecIR huggingface dataset:
/* Variables and functions */
float pow(float, double);
float exponential_out(float step, float max_steps, float max_val) {
  return (step == max_steps)
             ? max_val
             : max_val - pow(max_val, 1.0 - (float)step / max_steps);
}


x86 assembly (clang, -O0):
<exponential_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    114b <exponential_out+0x3b>
jp     114b <exponential_out+0x3b>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    118a <exponential_out+0x7a>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
divss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe90(%rip),%xmm1
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponential_out>:
ucomiss %xmm1,%xmm0
jne    111b <exponential_out+0xb>
jp     111b <exponential_out+0xb>
movaps %xmm2,%xmm0
ret
push   %rax
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed4(%rip),%xmm1
subsd  %xmm0,%xmm1
movaps %xmm2,%xmm0
movss  %xmm2,0x4(%rsp)
call   1030 <pow@plt>
movss  0x4(%rsp),%xmm2
subss  %xmm0,%xmm2
add    $0x8,%rsp
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @exponential_out(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fcmp oeq float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %6
br label %22
12: ; preds = %3
%13 = load float, float* %6
%14 = load float, float* %6
%15 = load float, float* %4
%16 = load float, float* %5
%17 = fdiv float %15, %16
%18 = fpext float %17 to double
%19 = fsub double 1.000000e+00, %18
%20 = call float @pow(float %14, double %19)
%21 = fsub float %13, %20
br label %22
22: ; preds = %12, %10
%23 = phi float [ %11, %10 ], [ %21, %12 ]
ret float %23
}

LLVM IR (-O2):
define float @exponential_out(float %0, float %1, float %2) {
%4 = fcmp oeq float %0, %1
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fdiv float %0, %1
%7 = fpext float %6 to double
%8 = fsub double 1.000000e+00, %7
%9 = tail call float @pow(float %2, double %8)
%10 = fsub float %2, %9
br label %11
11: ; preds = %3, %5
%12 = phi float [ %10, %5 ], [ %2, %3 ]
ret float %12
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
unsigned long long currentTimeMillis() {
  struct timespec t;
  clock_gettime(CLOCK_MONOTONIC, &t);
  return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}


x86 assembly (clang, -O0):
<currentTimeMillis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<currentTimeMillis>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @currentTimeMillis() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000000
%10 = add nsw i32 %6, %9
%11 = sext i32 %10 to i64
ret i64 %11
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @currentTimeMillis() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000000
%11 = add nsw i32 %10, %7
%12 = sext i32 %11 to i64
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void mergeSort(int *arr, int low, int high) {
  if (low < high) {
    int mid = (low + high) / 2;
    mergeSort(arr, low, mid);
    mergeSort(arr, mid + 1, high);
    merge(arr, low, mid, high);
  }
}


x86 assembly (clang, -O0):
<mergeSort>:
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    1182 <mergeSort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
cmp    %edx,%esi
jge    1172 <mergeSort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1030 <mergeSort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <mergeSort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <merge@plt>
ret

LLVM IR (-O0):
define void @mergeSort(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 %28
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %14, 2
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %6
%23 = load i32*, i32** %4
%24 = load i32, i32* %5
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = call i32 @merge(i32* %23, i32 %24, i32 %25, i32 %26)
br label %28
28: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @mergeSort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @mergeSort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ drv_LT_send(int, char const);
void drv_LT_command(const char cmd) { drv_LT_send(0x12, cmd); }


x86 assembly (clang, -O0):
<drv_LT_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x12,%edi
movsbl -0x1(%rbp),%esi
call   1030 <drv_LT_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_LT_command>:
mov    %edi,%esi
mov    $0x12,%edi
jmp    1030 <drv_LT_send@plt>

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

LLVM IR (-O2):
define void @drv_LT_command(i8 signext %0) {
%2 = tail call i32 @drv_LT_send(i32 18, i8 signext %0)
ret void
}
/* Variables and functions */
int SIGALRM;
int /*<<< orphan*/ _exit(int);
void event_sig_handler(int signum) {
  if (signum == SIGALRM)
    _exit(1);
}


x86 assembly (clang, -O0):
<event_sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%eax
jne    1137 <event_sig_handler+0x27>
mov    $0x1,%edi
call   1030 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_sig_handler>:
push   %rax
mov    0x2ed0(%rip),%rax
cmp    %edi,(%rax)
je     111e <event_sig_handler+0xe>
pop    %rax
ret
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@SIGALRM = global i32 0
define void @event_sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGALRM
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @_exit(i32 1)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGALRM = global i32 0
define void @event_sig_handler(i32 %0) {
%2 = load i32, i32* @SIGALRM
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @_exit(i32 1)
unreachable
6: ; preds = %1
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int compare_geom(struct device *, struct device *);
int init_geom(int fd, struct device *dev, struct device *orig_dev,
              struct stat *stat) {
  return compare_geom(dev, orig_dev);
}


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

x86 assembly (clang, -O2):
<init_geom>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <compare_geom@plt>

LLVM IR (-O0):
%struct.device = type { i32 }
%struct.stat = type { i32 }
define i32 @init_geom(i32 %0, %struct.device* %1, %struct.device* %2, %struct.stat* %3) {
%5 = alloca i32
%6 = alloca %struct.device*
%7 = alloca %struct.device*
%8 = alloca %struct.stat*
store i32 %0, i32* %5
store %struct.device* %1, %struct.device** %6
store %struct.device* %2, %struct.device** %7
store %struct.stat* %3, %struct.stat** %8
%9 = load %struct.device*, %struct.device** %6
%10 = load %struct.device*, %struct.device** %7
%11 = call i32 @compare_geom(%struct.device* %9, %struct.device* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.device = type { i32 }
%struct.stat = type { i32 }
define i32 @init_geom(i32 %0, %struct.device* %1, %struct.device* %2, %struct.stat* nocapture readnone %3) {
%5 = tail call i32 @compare_geom(%struct.device* %1, %struct.device* %2)
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *get_hex_digit_from_base4(char *base4str) {
  char *ret = (char *)malloc(3);
  int num = 0;
  num = (base4str[0] - 48) * 4 + (base4str[1] - 48) * 1;
  sprintf(ret, "%01x", num);
  return ret;
}


x86 assembly (clang, -O0):
<get_hex_digit_from_base4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
sub    $0x30,%ecx
shl    $0x0,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe91(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hex_digit_from_base4>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
movsbl (%rbx),%eax
movsbl 0x1(%rbx),%ecx
lea    (%rcx,%rax,4),%edx
add    $0xffffff10,%edx
lea    0xeb5(%rip),%rsi
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%01x\00"
define i8* @get_hex_digit_from_base4(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i64 @malloc(i32 3)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
store i32 0, i32* %4
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 48
%12 = mul nsw i32 %11, 4
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = mul nsw i32 %17, 1
%19 = add nsw i32 %12, %18
store i32 %19, i32* %4
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"%01x\00"
define i8* @get_hex_digit_from_base4(i8* nocapture %0) {
%2 = tail call i64 @malloc(i32 3)
%3 = inttoptr i64 %2 to i8*
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
%6 = shl nsw i32 %5, 2
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -240
%11 = add nsw i32 %10, %6
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i8* %3
}
/* Variables and functions */
size_t errno;
char const **sys_errlist;
size_t sys_nerr;
const char *stringErrorReport(void) {
  if (errno > 0 && errno < sys_nerr)
    return sys_errlist[errno];
  else
    return "Unknown error.\n";
}


x86 assembly (clang, -O0):
<stringErrorReport>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
cmpq   $0x0,(%rax)
jbe    1150 <stringErrorReport+0x50>
mov    0x2eb4(%rip),%rax
mov    (%rax),%rax
mov    0x2ec2(%rip),%rcx
cmp    (%rcx),%rax
jae    1150 <stringErrorReport+0x50>
mov    0x2ec2(%rip),%rax
mov    (%rax),%rax
mov    0x2e90(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <stringErrorReport+0x5b>
lea    0xea9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringErrorReport>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%rcx
lea    0xeef(%rip),%rax
test   %rcx,%rcx
je     1130 <stringErrorReport+0x30>
mov    0x2ecb(%rip),%rdx
cmp    (%rdx),%rcx
jae    1130 <stringErrorReport+0x30>
mov    0x2ecf(%rip),%rax
mov    (%rax),%rax
mov    (%rax,%rcx,8),%rax
ret

LLVM IR (-O0):
@errno = global i64 0
@sys_nerr = global i64 0
@sys_errlist = global i8** null
@.str = [16 x i8] c"Unknown error.\0A\00"
define i8* @stringErrorReport() {
%1 = alloca i8*
%2 = load i64, i64* @errno
%3 = icmp ugt i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @sys_nerr
%7 = icmp ult i64 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i8**, i8*** @sys_errlist
%10 = load i64, i64* @errno
%11 = getelementptr inbounds i8*, i8** %9, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %1
br label %14
13: ; preds = %4, %0
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %1
br label %14
14: ; preds = %13, %8
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
@errno = global i64 0
@sys_nerr = global i64 0
@sys_errlist = global i8** null
@.str = [16 x i8] c"Unknown error.\0A\00"
define i8* @stringErrorReport() {
%1 = load i64, i64* @errno
%2 = icmp ne i64 %1, 0
%3 = load i64, i64* @sys_nerr
%4 = icmp ult i64 %1, %3
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i8**, i8*** @sys_errlist
%8 = getelementptr inbounds i8*, i8** %7, i64 %1
%9 = load i8*, i8** %8
br label %10
10: ; preds = %0, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %0 ]
ret i8* %11
}
__attribute__((always_)) void wake_up_idle_cpu(int cpu) {}


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

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

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

LLVM IR (-O2):
define void @wake_up_idle_cpu(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t set_bit(uint32_t value, int bit) {
  return value | (uint32_t)(1 << (31 - bit));
}


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

x86 assembly (clang, -O2):
<set_bit>:
mov    %esi,%ecx
mov    $0x80000000,%eax
shr    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @set_bit(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 = sub nsw i32 31, %6
%8 = shl i32 1, %7
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @set_bit(i32 %0, i32 %1) {
%3 = lshr i32 -2147483648, %1
%4 = or i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SPI_1_SpiInit();
void SPI_1_Init(void) { SPI_1_SpiInit(); }


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

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

LLVM IR (-O0):
define void @SPI_1_Init() {
%1 = call i32 (...) @SPI_1_SpiInit()
ret void
}

LLVM IR (-O2):
define void @SPI_1_Init() {
%1 = tail call i32 (...) @SPI_1_SpiInit()
ret void
}
void rt_hw_interrupt_enable(int level) { return; }


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

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

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

LLVM IR (-O2):
define void @rt_hw_interrupt_enable(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sendExceptionFromCurrentThread(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ test_agent_recovery();
void __missing_function(const char *fname) {
  char buff[1024];
  sprintf(buff, "Function not found in any library: %s", fname);
  sendExceptionFromCurrentThread(buff);
  test_agent_recovery();
}


x86 assembly (clang, -O0):
<__missing_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <sendExceptionFromCurrentThread@plt>
mov    $0x0,%al
call   1030 <test_agent_recovery@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__missing_function>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rdx
lea    0xebe(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <sendExceptionFromCurrentThread@plt>
xor    %eax,%eax
call   1030 <test_agent_recovery@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Function not found in any library: %s\00"
define void @__missing_function(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 @sendExceptionFromCurrentThread(i8* %7)
%9 = call i32 (...) @test_agent_recovery()
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Function not found in any library: %s\00"
define void @__missing_function(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @sendExceptionFromCurrentThread(i8* %3)
%6 = call i32 (...) @test_agent_recovery()
ret void
}
void *mime_read_open(struct soap *soap, void *handle, const char *id,
                     const char *type, const char *description) {
  return handle;
}


x86 assembly (clang, -O0):
<mime_read_open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mime_read_open>:
mov    %rsi,%rax
ret

LLVM IR (-O0):
%struct.soap = type opaque
define i8* @mime_read_open(%struct.soap* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca %struct.soap*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store %struct.soap* %0, %struct.soap** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %7
ret i8* %11
}

LLVM IR (-O2):
%struct.soap = type opaque
define i8* @mime_read_open(%struct.soap* nocapture readnone %0, i8* readnone returned %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4) {
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ lcd_putc(char);
int /*<<< orphan*/ putData(char);
int /*<<< orphan*/ uart_tx_int_enable();
void putc(char c) {
  putData(c);
  uart_tx_int_enable();
  lcd_putc(c);
}


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <putData@plt>
mov    $0x0,%al
call   1030 <uart_tx_int_enable@plt>
movsbl -0x1(%rbp),%edi
call   1050 <lcd_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
push   %rbx
mov    %edi,%ebx
call   1040 <putData@plt>
xor    %eax,%eax
call   1030 <uart_tx_int_enable@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <lcd_putc@plt>

LLVM IR (-O0):
define void @putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @putData(i8 signext %3)
%5 = call i32 (...) @uart_tx_int_enable()
%6 = load i8, i8* %2
%7 = call i32 @lcd_putc(i8 signext %6)
ret void
}

LLVM IR (-O2):
define void @putc(i8 signext %0) {
%2 = tail call i32 @putData(i8 signext %0)
%3 = tail call i32 (...) @uart_tx_int_enable()
%4 = tail call i32 @lcd_putc(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UpnpResponse_MediaRenderer_AVTransport_Pause(void *);
int /*<<< orphan*/ printf(char *, unsigned int);
void UpnpMediaRenderer_AVTransport_Pause(void *upnptoken,
                                         unsigned int InstanceID) {
  printf("Invoke: UpnpMediaRenderer_AVTransport_Pause(%u);\r\n", InstanceID);
  UpnpResponse_MediaRenderer_AVTransport_Pause(upnptoken);
}


x86 assembly (clang, -O0):
<UpnpMediaRenderer_AVTransport_Pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <UpnpResponse_MediaRenderer_AVTransport_Pause@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [51 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Pause(%u);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Pause(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @UpnpResponse_MediaRenderer_AVTransport_Pause(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Pause(%u);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Pause(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @UpnpResponse_MediaRenderer_AVTransport_Pause(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void nomem(void) {
  fprintf(stderr, "%s: can't get memory!\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"%s: can't get memory!\0A\00"
define void @nomem() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"%s: can't get memory!\0A\00"
define void @nomem() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
reverse(char *s, int lo, int hi) {
  while (lo < hi) {
    char c = s[lo];
    s[lo] = s[hi];
    s[hi] = c;
    lo++;
    hi--;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1163 <reverse+0x63>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x19(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    110e <reverse+0xe>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
cmp    %edx,%esi
jge    1131 <reverse+0x31>
movslq %esi,%rax
movslq %edx,%rcx
add    $0x1,%rax
xchg   %ax,%ax
movzbl -0x1(%rdi,%rax,1),%esi
movzbl (%rdi,%rcx,1),%edx
mov    %dl,-0x1(%rdi,%rax,1)
mov    %sil,(%rdi,%rcx,1)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jl     1110 <reverse+0x10>
ret

LLVM IR (-O0):
define i32 @reverse(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
br label %9
9: ; preds = %13, %3
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
store i8 %18, i8* %8
%19 = load i8*, i8** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = load i8*, i8** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 %23, i8* %27
%28 = load i8, i8* %8
%29 = load i8*, i8** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 %28, i8* %32
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
%35 = load i32, i32* %7
%36 = add nsw i32 %35, -1
store i32 %36, i32* %7
br label %9
37: ; preds = %9
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @reverse(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %16, %8 ]
%10 = phi i64 [ %6, %5 ], [ %15, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %9
%14 = load i8, i8* %13
store i8 %14, i8* %11
store i8 %12, i8* %13
%15 = add nsw i64 %10, 1
%16 = add nsw i64 %9, -1
%17 = icmp slt i64 %15, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %3
ret i32 undef
}
void reverse(char *v, int i, int j) {
  char tmp;
  for (; i < j; i++, j--) {
    tmp = v[i];
    v[i] = v[j];
    v[j] = tmp;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1163 <reverse+0x63>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    110e <reverse+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
cmp    %edx,%esi
jge    1131 <reverse+0x31>
movslq %esi,%rax
movslq %edx,%rcx
add    $0x1,%rax
xchg   %ax,%ax
movzbl -0x1(%rdi,%rax,1),%esi
movzbl (%rdi,%rcx,1),%edx
mov    %dl,-0x1(%rdi,%rax,1)
mov    %sil,(%rdi,%rcx,1)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jl     1110 <reverse+0x10>
ret

LLVM IR (-O0):
define void @reverse(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
br label %8
8: ; preds = %32, %3
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %37
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %7
%18 = load i8*, i8** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
%27 = load i8, i8* %7
%28 = load i8*, i8** %4
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
br label %32
32: ; preds = %12
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
%35 = load i32, i32* %6
%36 = add nsw i32 %35, -1
store i32 %36, i32* %6
br label %8
37: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @reverse(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %16, %8 ]
%10 = phi i64 [ %6, %5 ], [ %15, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %9
%14 = load i8, i8* %13
store i8 %14, i8* %11
store i8 %12, i8* %13
%15 = add nsw i64 %10, 1
%16 = add nsw i64 %9, -1
%17 = icmp slt i64 %15, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %3
ret void
}
void putb(char *a, int index, char val) {
  int k = index / 8;
  int R = 7 - index % 8;
  a[k] = val << R | a[k];
}


x86 assembly (clang, -O0):
<putb>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x7,%eax
sub    %edx,%eax
mov    %eax,-0x18(%rbp)
movsbl -0xd(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putb>:
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
mov    %eax,%r8d
sar    $0x3,%r8d
and    $0xfffffff8,%eax
sub    %eax,%esi
movzbl %dl,%eax
mov    $0x7,%cl
sub    %sil,%cl
shl    %cl,%eax
movslq %r8d,%rcx
or     %al,(%rdi,%rcx,1)
ret

LLVM IR (-O0):
define void @putb(i8* %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 8
store i32 %10, i32* %7
%11 = load i32, i32* %5
%12 = srem i32 %11, 8
%13 = sub nsw i32 7, %12
store i32 %13, i32* %8
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = load i32, i32* %8
%17 = shl i32 %15, %16
%18 = load i8*, i8** %4
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = or i32 %17, %23
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %4
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 %25, i8* %29
ret void
}

LLVM IR (-O2):
define void @putb(i8* nocapture %0, i32 %1, i8 signext %2) {
%4 = sdiv i32 %1, 8
%5 = srem i32 %1, 8
%6 = sub nsw i32 7, %5
%7 = zext i8 %2 to i32
%8 = shl nuw nsw i32 %7, %6
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = trunc i32 %8 to i8
%13 = or i8 %11, %12
store i8 %13, i8* %10
ret void
}
unsigned long djb2(char *str) {
  unsigned long hash = 5381;
  char c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<djb2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1149 <djb2+0x49>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movsbq -0x11(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <djb2+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @djb2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = sext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
int compare_elements(const void *p1, const void *p2) {
  if ((*(unsigned short *)p1) < (*(unsigned short *)p2))
    return -1;
  else
    return (*(unsigned short *)p1) > (*(unsigned short *)p2);
}


x86 assembly (clang, -O0):
<compare_elements>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jge    112e <compare_elements+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <compare_elements+0x49>
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_elements>:
movzwl (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%ax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_elements(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i16*
%4 = load i16, i16* %3
%5 = bitcast i8* %1 to i16*
%6 = load i16, i16* %5
%7 = icmp ult i16 %4, %6
%8 = icmp ugt i16 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ helloworld();
int main(void) {
  helloworld();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <helloworld@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <helloworld@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @helloworld()
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @helloworld()
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
int main(int argc, const char *argv[]) {
  char i = 1;
  while (i) {
    ++i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x1,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     112d <main+0x2d>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    1116 <main+0x16>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int is_valid_note_str(char *);
int main(int argc, char **argv) {
  if (argc != 2)
    return 1;
  return is_valid_note_str(argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     113c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    114c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <is_valid_note_str@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jne    111e <main+0xe>
mov    0x8(%rsi),%rdi
jmp    1030 <is_valid_note_str@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @is_valid_note_str(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 1, %2 ]
ret i32 %9
}
/* Variables and functions */
double avg(int, int, int, int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double d = avg(3, 89, 191, 120);
  printf("%lf\n", d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
mov    $0x59,%esi
mov    $0xbf,%edx
mov    $0x78,%ecx
call   1040 <avg@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x59,%esi
mov    $0xbf,%edx
mov    $0x78,%ecx
call   1040 <avg@plt>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call double @avg(i32 3, i32 89, i32 191, i32 120)
store double %3, double* %2
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = tail call double @avg(i32 3, i32 89, i32 191, i32 120)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
int main(void) {
  float x, y, z;
  x = y + z;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void gtk_menu_shell_deselect() {}


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

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

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

LLVM IR (-O2):
define void @gtk_menu_shell_deselect() {
ret void
}
void UARTTxDMAThresholdValConfig(unsigned int baseAdd, unsigned int thrsValue) {
  (*((volatile unsigned int *)(baseAdd + (0x84)))) &= ~((0x0000003Fu));
  (*((volatile unsigned int *)(baseAdd + (0x84)))) |=
      (thrsValue & (0x0000003Fu));
}


x86 assembly (clang, -O0):
<UARTTxDMAThresholdValConfig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x84,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffffffc0,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
and    $0x3f,%edx
mov    -0x4(%rbp),%eax
add    $0x84,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTTxDMAThresholdValConfig>:
add    $0x84,%edi
andl   $0xffffffc0,(%rdi)
and    $0x3f,%esi
or     %esi,(%rdi)
ret

LLVM IR (-O0):
define void @UARTTxDMAThresholdValConfig(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 = add i32 %5, 132
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -64
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = and i32 %11, 63
%13 = load i32, i32* %3
%14 = add i32 %13, 132
%15 = zext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = or i32 %17, %12
store volatile i32 %18, i32* %16
ret void
}

LLVM IR (-O2):
define void @UARTTxDMAThresholdValConfig(i32 %0, i32 %1) {
%3 = add i32 %0, 132
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -64
store volatile i32 %7, i32* %5
%8 = and i32 %1, 63
%9 = load volatile i32, i32* %5
%10 = or i32 %9, %8
store volatile i32 %10, i32* %5
ret void
}
/* Variables and functions */
bool nrf52_errata_9(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_9() {
ret i32 0
}
int _start(void) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @_start() {
ret i32 0
}
int test_imm_47int64_lowword_mem(long long *val) {
  return ((*val) & (0x47 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_47int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 71
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ OveroSyncStatsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void OveroSyncStatsUpdated() { UAVObjUpdated(OveroSyncStatsHandle()); }


x86 assembly (clang, -O0):
<OveroSyncStatsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <OveroSyncStatsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OveroSyncStatsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <OveroSyncStatsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @OveroSyncStatsUpdated() {
%1 = call i32 (...) @OveroSyncStatsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @OveroSyncStatsUpdated() {
%1 = tail call i32 (...) @OveroSyncStatsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}