xunge/DecIR huggingface dataset:
/* Variables and functions */
int getline(char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main() {
  int len;
  char line[1000];
  while ((len = getline(line, 1000)) > 0)
    printf("line length:%d %s", len, line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    116a <main+0x4a>
mov    -0x8(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
test   %eax,%eax
jle    116e <main+0x4e>
lea    0xebe(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
test   %eax,%eax
jg     1150 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"line length:%d %s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %3, %0 ]
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %2)
%8 = call i32 @getline(i8* %2, i32 1000)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
unsigned short SwapUShort(unsigned short in) {
  char sin[2];
  char sout[2];
  memcpy((char *)sin, (char *)&in, 2);
  sout[0] = sin[1];
  sout[1] = sin[0];
  return *((unsigned short *)sout);
}


x86 assembly (clang, -O0):
<SwapUShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x2(%rbp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    -0x3(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x5(%rbp)
movzwl -0x6(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SwapUShort>:
push   %rax
mov    %di,0x4(%rsp)
lea    0x6(%rsp),%rdi
lea    0x4(%rsp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
movzwl 0x6(%rsp),%eax
rol    $0x8,%ax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i16 @SwapUShort(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
store i16 %0, i16* %2
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = bitcast i16* %2 to i8*
%7 = call i32 @memcpy(i8* %5, i8* %6, i32 2)
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8 %9, i8* %10
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%12 = load i8, i8* %11
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %12, i8* %13
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%15 = bitcast i8* %14 to i16*
%16 = load i16, i16* %15
ret i16 %16
}

LLVM IR (-O2):
define zeroext i16 @SwapUShort(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [2 x i8]
store i16 %0, i16* %2
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = bitcast i16* %2 to i8*
%6 = call i32 @memcpy(i8* %4, i8* %5, i32 2)
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%8 = load i8, i8* %7
%9 = load i8, i8* %4
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
%12 = zext i8 %8 to i16
%13 = or i16 %11, %12
ret i16 %13
}
int check_bool() { return sizeof(_Bool); }


x86 assembly (clang, -O0):
<check_bool>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @check_bool() {
ret i32 1
}

LLVM IR (-O2):
define i32 @check_bool() {
ret i32 1
}
/* Variables and functions */
long lrint(double);
long int lrintl(long double x) { return lrint((double)x); }


x86 assembly (clang, -O0):
<lrintl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <lrint@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrintl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <lrint@plt>

LLVM IR (-O0):
define i64 @lrintl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call i64 @lrint(double %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @lrintl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @lrint(double %2)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void die(char *e) {
  perror(e);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(void const *);
unsigned int _p11_hash_intptr_hash(const void *to_int) {
  assert(to_int);
  return (unsigned int)*((int *)to_int);
}


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

x86 assembly (clang, -O2):
<_p11_hash_intptr_hash>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_p11_hash_intptr_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @_p11_hash_intptr_hash(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Type definitions */
typedef int u_int;

/* Variables and functions */
u_int usec2ntp(u_int usec) {
  u_int t = (usec * 1825) >> 5;
  return ((usec << 12) + (usec << 8) - t);
}


x86 assembly (clang, -O0):
<usec2ntp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x721,-0x4(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xc,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<usec2ntp>:
imul   $0x721,%edi,%ecx
sar    $0x5,%ecx
imul   $0x1100,%edi,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @usec2ntp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 1825
%6 = ashr i32 %5, 5
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = shl i32 %7, 12
%9 = load i32, i32* %2
%10 = shl i32 %9, 8
%11 = add nsw i32 %8, %10
%12 = load i32, i32* %3
%13 = sub nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @usec2ntp(i32 %0) {
%2 = mul nsw i32 %0, 1825
%3 = ashr i32 %2, 5
%4 = mul i32 %0, 4352
%5 = sub nsw i32 %4, %3
ret i32 %5
}
void mt_reg_sync_writel(v, a) {
  *(volatile unsigned int *)(a) = (v);
  dsb();
  reg_dummy_read();
}


x86 assembly (clang, -O0):
<mt_reg_sync_writel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <dsb@plt>
mov    $0x0,%al
call   1030 <reg_dummy_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt_reg_sync_writel>:
push   %rax
movslq %esi,%rax
mov    %edi,(%rax)
xor    %eax,%eax
call   1040 <dsb@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <reg_dummy_read@plt>

LLVM IR (-O0):
define void @mt_reg_sync_writel(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 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store volatile i32 %5, i32* %8
%9 = call i32 (...) @dsb()
%10 = call i32 (...) @reg_dummy_read()
ret void
}

LLVM IR (-O2):
define void @mt_reg_sync_writel(i32 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i32*
store volatile i32 %0, i32* %4
%5 = tail call i32 (...) @dsb()
%6 = tail call i32 (...) @reg_dummy_read()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void parser_Halt(void) { exit(1); }


x86 assembly (clang, -O0):
<parser_Halt>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<parser_Halt>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @parser_Halt() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @parser_Halt() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
double fmod(double x, double y) { return 0; }


x86 assembly (clang, -O0):
<fmod>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmod>:
xorps  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @fmod(double %0, double %1) {
ret double 0.000000e+00
}
/* Variables and functions */
char tolower(char);
void strtolower2(char *c, int len) {
  for (; len >= 0; c++, len--)
    *c = tolower(*c);
}


x86 assembly (clang, -O0):
<strtolower2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1157 <strtolower2+0x47>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <strtolower2+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtolower2>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
js     1147 <strtolower2+0x37>
mov    %esi,%r14d
mov    %rdi,%r15
add    $0x1,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %ebx,%r14d
jne    1130 <strtolower2+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @strtolower2(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ %1, %2 ]
%6 = phi i8* [ %9, %4 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = tail call signext i8 @tolower(i8 signext %7)
store i8 %8, i8* %6
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = add nsw i32 %5, -1
%11 = icmp eq i32 %5, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
/* Type definitions */
struct flow {
  int dummy;
};

/* Variables and functions */
int O_CREAT;
int O_NOFOLLOW;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ file_new(char const *, int, struct flow *, void *);
void file_write_new(const char *path, struct flow *flow, void *passthrough) {
  file_new(path, O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC, flow, passthrough);
}


x86 assembly (clang, -O0):
<file_write_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
mov    0x2ec0(%rip),%rax
or     (%rax),%esi
mov    0x2eaf(%rip),%rax
or     (%rax),%esi
mov    0x2e9e(%rip),%rax
or     (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <file_new@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_write_new>:
mov    0x2ea9(%rip),%rcx
mov    0x2eda(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2ec7(%rip),%rcx
or     (%rcx),%eax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    0x2eb0(%rip),%rsi
or     (%rsi),%eax
mov    %eax,%esi
jmp    1030 <file_new@plt>

LLVM IR (-O0):
%struct.flow = type { i32 }
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_NOFOLLOW = global i32 0
@O_TRUNC = global i32 0
define void @file_write_new(i8* %0, %struct.flow* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.flow*
%6 = alloca i8*
store i8* %0, i8** %4
store %struct.flow* %1, %struct.flow** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* @O_WRONLY
%9 = load i32, i32* @O_CREAT
%10 = or i32 %8, %9
%11 = load i32, i32* @O_NOFOLLOW
%12 = or i32 %10, %11
%13 = load i32, i32* @O_TRUNC
%14 = or i32 %12, %13
%15 = load %struct.flow*, %struct.flow** %5
%16 = load i8*, i8** %6
%17 = call i32 @file_new(i8* %7, i32 %14, %struct.flow* %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.flow = type { i32 }
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_NOFOLLOW = global i32 0
@O_TRUNC = global i32 0
define void @file_write_new(i8* %0, %struct.flow* %1, i8* %2) {
%4 = load i32, i32* @O_WRONLY
%5 = load i32, i32* @O_CREAT
%6 = or i32 %5, %4
%7 = load i32, i32* @O_NOFOLLOW
%8 = or i32 %6, %7
%9 = load i32, i32* @O_TRUNC
%10 = or i32 %8, %9
%11 = tail call i32 @file_new(i8* %0, i32 %10, %struct.flow* %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430InterruptP__Port15__enable();
void Msp430InterruptC__2__HplInterrupt__enable(void) {
  HplMsp430InterruptP__Port15__enable();
}


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

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

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

LLVM IR (-O2):
define void @Msp430InterruptC__2__HplInterrupt__enable() {
%1 = tail call i32 (...) @HplMsp430InterruptP__Port15__enable()
ret void
}
/* Variables and functions */
double asin(double);
double hl_math_asin(double a) { return asin(a); }


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

x86 assembly (clang, -O2):
<hl_math_asin>:
jmp    1030 <asin@plt>

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

LLVM IR (-O2):
define double @hl_math_asin(double %0) {
%2 = tail call double @asin(double %0)
ret double %2
}
/* Variables and functions */
float pow(int /*<<< orphan*/, int);
int /*<<< orphan*/ sin(float);
void *sen3(void *args) {
  float *x = (float *)args;
  x[1] = pow(sin(x[0]), 3);
}


x86 assembly (clang, -O0):
<sen3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sen3>:
push   %rbx
mov    %rdi,%rbx
movss  (%rdi),%xmm0
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
movss  %xmm0,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @sen3(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca float*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to float*
store float* %6, float** %4
%7 = load float*, float** %4
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = call i32 @sin(float %9)
%11 = call float @pow(i32 %10, i32 3)
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 1
store float %11, float* %13
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @sen3(i8* nocapture %0) {
%2 = bitcast i8* %0 to float*
%3 = load float, float* %2
%4 = tail call i32 @sin(float %3)
%5 = tail call float @pow(i32 %4, i32 3)
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = bitcast i8* %6 to float*
store float %5, float* %7
ret i8* undef
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t lp_read_u16_le(void *p) {
  uint8_t *s = (uint8_t *)p;
  uint16_t v = s[0] | s[1] << 8;
  return v;
}


x86 assembly (clang, -O0):
<lp_read_u16_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lp_read_u16_le>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @lp_read_u16_le(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = shl i32 %12, 8
%14 = or i32 %9, %13
store i32 %14, i32* %4
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
define i32 @lp_read_u16_le(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ non_leaf_function(int);
int test() {
  int i = 0;
  while (i < 0xff)
    i++;
  non_leaf_function(i);
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    113a <test+0x2a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test+0xf>
mov    -0x4(%rbp),%edi
call   1030 <non_leaf_function@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0xff,%edi
call   1030 <non_leaf_function@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 255
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
br label %2
8: ; preds = %2
%9 = load i32, i32* %1
%10 = call i32 @non_leaf_function(i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call i32 @non_leaf_function(i32 255)
ret i32 0
}
/* Variables and functions */
void *realloc(void *, size_t);
void *gssalloc_realloc(void *value, size_t size) {
  return realloc(value, size);
}


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

x86 assembly (clang, -O2):
<gssalloc_realloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @gssalloc_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void func() {
  printf("Hello World\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define void @func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define void @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ SafeRealloc(void *, int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *SafeStrcpy(char **target, const char *source) {
  *target =
      (char *)SafeRealloc((void *)*target, (strlen(source) + 1) * sizeof(char));
  if (*target)
    strcpy(*target, source);
  return (*target);
}


x86 assembly (clang, -O0):
<SafeStrcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%esi
call   1050 <SafeRealloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1190 <SafeStrcpy+0x60>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SafeStrcpy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%esi
mov    %r15,%rdi
call   1050 <SafeRealloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1167 <SafeStrcpy+0x37>
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @SafeStrcpy(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strlen(i8* %1)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @SafeRealloc(i8* %3, i32 %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %0
%8 = icmp eq i64 %6, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = tail call i32 @strcpy(i8* %7, i8* %1)
%11 = load i8*, i8** %0
br label %12
12: ; preds = %9, %2
%13 = phi i8* [ %11, %9 ], [ %7, %2 ]
ret i8* %13
}
void rop3_82_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = S & *D;
  stk2 = T | stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_82_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_82_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %sil,%cl
or     %cl,%dl
xor    %al,%dl
not    %sil
and    %dl,%sil
or     %cl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_82_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = and i32 %11, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %9
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = load i8, i8* %8
%27 = zext i8 %26 to i32
%28 = xor i32 %25, %27
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = xor i32 %33, -1
%35 = and i32 %31, %34
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8, i8* %5
%40 = zext i8 %39 to i32
%41 = and i32 %38, %40
%42 = or i32 %35, %41
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
store i8 %43, i8* %44
ret void
}

LLVM IR (-O2):
define void @rop3_82_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = or i8 %5, %2
%7 = xor i8 %6, %4
%8 = xor i8 %1, -1
%9 = and i8 %7, %8
%10 = or i8 %9, %5
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int fmod(double, int);
double mostly_constant_function(double x) {
  x = 4 / 3.14159265358979323846 * fmod(x, 2 * 3.14159265358979323846);
  if (x < 0.283)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<mostly_constant_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x6,%edi
call   1030 <fmod@plt>
cvtsi2sd %eax,%xmm1
movsd  0xed0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1166 <mostly_constant_function+0x56>
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    116e <mostly_constant_function+0x5e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostly_constant_function>:
push   %rax
mov    $0x6,%edi
call   1030 <fmod@plt>
cvtsi2sd %eax,%xmm1
mulsd  0xed9(%rip),%xmm1
cmpltsd 0xed8(%rip),%xmm1
movsd  0xed8(%rip),%xmm0
andpd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mostly_constant_function(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i32 @fmod(double %4, i32 6)
%6 = sitofp i32 %5 to double
%7 = fmul double 0x3FF45F306DC9C883, %6
store double %7, double* %3
%8 = load double, double* %3
%9 = fcmp olt double %8, 2.830000e-01
br i1 %9, label %10, label %11
10: ; preds = %1
store double 1.000000e+00, double* %2
br label %12
11: ; preds = %1
store double 0.000000e+00, double* %2
br label %12
12: ; preds = %11, %10
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @mostly_constant_function(double %0) {
%2 = tail call i32 @fmod(double %0, i32 6)
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 0x3FF45F306DC9C883
%5 = fcmp olt double %4, 2.830000e-01
%6 = select i1 %5, double 1.000000e+00, double 0.000000e+00
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getMacKeyboard();
int /*<<< orphan*/ stderr;
int main() {
  fprintf(stderr, "%s\n", getMacKeyboard());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getMacKeyboard@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rdx
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getMacKeyboard@plt>
lea    0xec8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i8* (...) @getMacKeyboard()
%4 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getMacKeyboard()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int mkdirat(int, char const *, int /*<<< orphan*/);
__attribute__((__weak__, __always___)) int
softboundcets_mkdirat(int dirfd, const char *pathname, mode_t mode) {
  return mkdirat(dirfd, pathname, mode);
}


x86 assembly (clang, -O0):
<softboundcets_mkdirat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <mkdirat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundcets_mkdirat>:
jmp    1030 <mkdirat@plt>

LLVM IR (-O0):
define weak i32 @softboundcets_mkdirat(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @mkdirat(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define weak i32 @softboundcets_mkdirat(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @mkdirat(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
int dlz_version(unsigned int *flags) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @dlz_version(i32* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ cpu_reset(int /*<<< orphan*/);
void arch_reset(char mode) { cpu_reset(0); }


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %edi,%edi
call   1030 <cpu_reset@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @arch_reset(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @cpu_reset(i32 0)
ret void
}

LLVM IR (-O2):
define void @arch_reset(i8 signext %0) {
%2 = tail call i32 @cpu_reset(i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _io_err(int /*<<< orphan*/, size_t, int,
                           int /*<<< orphan*/ *);
char *fgets(char *, size_t, int /*<<< orphan*/ *);
char *check_fgets(char *ptr, size_t size, FILE *stream) {
  char *res = fgets(ptr, size, stream);
  if (!res)
    _io_err(0, size, 1, stream);
  return res;
}


x86 assembly (clang, -O0):
<check_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1168 <check_fgets+0x48>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <_io_err@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fgets>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1030 <fgets@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <check_fgets+0x2a>
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <_io_err@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @check_fgets(i8* %0, i64 %1, i32* %2) {
%4 = tail call i8* @fgets(i8* %0, i64 %1, i32* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @_io_err(i32 0, i64 %1, i32 1, i32* %2)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
void foo2function() {}


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

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

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

LLVM IR (-O2):
define void @foo2function() {
ret void
}
/* Variables and functions */
int AF_INET;
int /*<<< orphan*/ EAFNOSUPPORT;
int /*<<< orphan*/ errno;
const char *sa_inet_ntop(int family, const void *src, char *dst, size_t size) {
  if (family == AF_INET) {
  }
  errno = EAFNOSUPPORT;
  return NULL;
}


x86 assembly (clang, -O0):
<sa_inet_ntop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ecb(%rip),%rcx
cmp    (%rcx),%eax
jne    112a <sa_inet_ntop+0x2a>
jmp    112a <sa_inet_ntop+0x2a>
mov    0x2e9f(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9e(%rip),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sa_inet_ntop>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@EAFNOSUPPORT = global i32 0
@errno = global i32 0
define i8* @sa_inet_ntop(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32, i32* %5
%10 = load i32, i32* @AF_INET
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %4
br label %13
13: ; preds = %12, %4
%14 = load i32, i32* @EAFNOSUPPORT
store i32 %14, i32* @errno
ret i8* null
}

LLVM IR (-O2):
@AF_INET = global i32 0
@EAFNOSUPPORT = global i32 0
@errno = global i32 0
define noalias i8* @sa_inet_ntop(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i64 %3) {
%5 = load i32, i32* @EAFNOSUPPORT
store i32 %5, i32* @errno
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage: "
                  "sg_rmsn   [--help] [--raw] [--verbose] [--version] DEVICE\n"
                  "  where:\n"
                  "    --help|-h       print out usage message\n"
                  "    --raw|-r        output serial number to stdout "
                  "(potentially binary)\n"
                  "    --verbose|-v    increase verbosity\n"
                  "    --version|-V    print version string and exit\n\n"
                  "Performs a SCSI READ MEDIA SERIAL NUMBER command\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [330 x i8] c"Usage: sg_rmsn [--help] [--raw] [--verbose] [--version] DEVICE\0A where:\0A --help|-h print out usage message\0A --raw|-r output serial number to stdout (potentially binary)\0A --verbose|-v increase verbosity\0A --version|-V print version string and exit\0A\0APerforms a SCSI READ MEDIA SERIAL NUMBER command\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([330 x i8], [330 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [330 x i8] c"Usage: sg_rmsn [--help] [--raw] [--verbose] [--version] DEVICE\0A where:\0A --help|-h print out usage message\0A --raw|-r output serial number to stdout (potentially binary)\0A --verbose|-v increase verbosity\0A --version|-V print version string and exit\0A\0APerforms a SCSI READ MEDIA SERIAL NUMBER command\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([330 x i8], [330 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ saveconf(char *, char *, char *, char *);
void writeStringKey(char *section, char *key, char *keyValue,
                    char *configFile) {
  saveconf(configFile, key, keyValue, section);
}


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

x86 assembly (clang, -O2):
<writeStringKey>:
mov    %rdi,%rax
mov    %rcx,%rdi
mov    %rax,%rcx
jmp    1030 <saveconf@plt>

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

LLVM IR (-O2):
define void @writeStringKey(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @saveconf(i8* %3, i8* %1, i8* %2, i8* %0)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t bit_reverse16(uint16_t x) {
  x = (x >> 8) | (x << 8);
  x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);
  x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);
  return ((x & 0xAAAA) >> 1) | ((x & 0x5555) << 1);
}


x86 assembly (clang, -O0):
<bit_reverse16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0f0,%eax
sar    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0f,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xcccc,%eax
sar    $0x2,%eax
mov    -0x4(%rbp),%ecx
and    $0x3333,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaa,%eax
sar    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x5555,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_reverse16>:
mov    %edi,%eax
sar    $0x8,%eax
shl    $0x8,%edi
or     %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf0f,%eax
shl    $0x4,%edi
and    $0xf0f0,%edi
or     %eax,%edi
mov    %edi,%eax
shr    $0x2,%eax
and    $0x3333,%eax
and    $0x3333,%edi
lea    (%rax,%rdi,4),%eax
mov    %eax,%ecx
shr    %ecx
and    $0x5555,%ecx
and    $0x5555,%eax
lea    (%rcx,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @bit_reverse16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = or i32 %4, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 61680
%10 = ashr i32 %9, 4
%11 = load i32, i32* %2
%12 = and i32 %11, 3855
%13 = shl i32 %12, 4
%14 = or i32 %10, %13
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 52428
%17 = ashr i32 %16, 2
%18 = load i32, i32* %2
%19 = and i32 %18, 13107
%20 = shl i32 %19, 2
%21 = or i32 %17, %20
store i32 %21, i32* %2
%22 = load i32, i32* %2
%23 = and i32 %22, 43690
%24 = ashr i32 %23, 1
%25 = load i32, i32* %2
%26 = and i32 %25, 21845
%27 = shl i32 %26, 1
%28 = or i32 %24, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @bit_reverse16(i32 %0) {
%2 = ashr i32 %0, 8
%3 = shl i32 %0, 8
%4 = or i32 %2, %3
%5 = lshr i32 %4, 4
%6 = and i32 %5, 3855
%7 = shl i32 %4, 4
%8 = and i32 %7, 61680
%9 = or i32 %6, %8
%10 = lshr i32 %9, 2
%11 = and i32 %10, 13107
%12 = shl nuw nsw i32 %9, 2
%13 = and i32 %12, 52428
%14 = or i32 %11, %13
%15 = lshr i32 %14, 1
%16 = and i32 %15, 21845
%17 = shl nuw nsw i32 %14, 1
%18 = and i32 %17, 43690
%19 = or i32 %16, %18
ret i32 %19
}
void cpu_stall(void) { __asm__ __volatile__("pause" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @cpu_stall() {
tail call void asm sideeffect "pause", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int isAddOp(char c) { return ((c == '+') || (c == '-')); }


x86 assembly (clang, -O0):
<isAddOp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     1129 <isAddOp+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isAddOp>:
add    $0xd5,%dil
xor    %eax,%eax
test   $0xfd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isAddOp(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 43
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isAddOp(i8 signext %0) {
%2 = icmp eq i8 %0, 43
%3 = icmp eq i8 %0, 45
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct rlite {
  int dummy;
};

/* Variables and functions */
int rl_multi_string_delete(struct rlite *, long);
int rl_string_delete(struct rlite *db, long value_page) {
  return rl_multi_string_delete(db, value_page);
}


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

x86 assembly (clang, -O2):
<rl_string_delete>:
jmp    1030 <rl_multi_string_delete@plt>

LLVM IR (-O0):
%struct.rlite = type { i32 }
define i32 @rl_string_delete(%struct.rlite* %0, i64 %1) {
%3 = alloca %struct.rlite*
%4 = alloca i64
store %struct.rlite* %0, %struct.rlite** %3
store i64 %1, i64* %4
%5 = load %struct.rlite*, %struct.rlite** %3
%6 = load i64, i64* %4
%7 = call i32 @rl_multi_string_delete(%struct.rlite* %5, i64 %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.rlite = type { i32 }
define i32 @rl_string_delete(%struct.rlite* %0, i64 %1) {
%3 = tail call i32 @rl_multi_string_delete(%struct.rlite* %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sort_fst_sign(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char const *argv[]) {
  char string[256];
  printf("Input test string: ");
  fgets(string, 256, stdin);
  sort_fst_sign(string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x110(%rbp),%rdi
call   1050 <sort_fst_sign@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1050 <sort_fst_sign@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Input test string: \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 256, i32 %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = call i32 @sort_fst_sign(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Input test string: \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %4, i32 256, i32 %6)
%8 = call i32 @sort_fst_sign(i8* %4)
ret i32 0
}