xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ atoi(char *);
int main(int argc, char const *argv[]) {
  char str[] = "-a12";
  if (atoi(str) != 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x15(%rbp),%rdi
call   1030 <atoi@plt>
cmp    $0x0,%rax
je     1157 <main+0x47>
movl   $0x1,-0x4(%rbp)
jmp    115e <main+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <atoi@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.str = [5 x i8] c"-a12\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @atoi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__const.main.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bzero(void *, size_t);
void *xmalloc(size_t);
void *xcalloc(size_t num, size_t size) {
  void *new = xmalloc(num * size);
  bzero(new, num * size);
  return new;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1030 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
imul   -0x10(%rbp),%rsi
call   1040 <bzero@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
imul   %rdi,%rbx
mov    %rbx,%rdi
call   1030 <xmalloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <bzero@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = mul i64 %6, %7
%9 = call i8* @xmalloc(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = mul i64 %11, %12
%14 = call i32 @bzero(i8* %10, i64 %13)
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @bzero(i8* %4, i64 %3)
ret i8* %4
}
void pq_reverse(char *codon) {
  char one = codon[0];
  char three = codon[2];
  codon[0] = three;
  codon[2] = one;
}


x86 assembly (clang, -O0):
<pq_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pq_reverse>:
mov    (%rdi),%al
mov    0x2(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x2(%rdi)
ret

LLVM IR (-O0):
define void @pq_reverse(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
store i8 %7, i8* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8, i8* %9
store i8 %10, i8* %4
%11 = load i8, i8* %4
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i8, i8* %3
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @pq_reverse(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 2
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WSACleanup();
__attribute__((always_)) void eal_wsa_finit(void) { WSACleanup(); }


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

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

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

LLVM IR (-O2):
define void @eal_wsa_finit() {
%1 = tail call i32 (...) @WSACleanup()
ret void
}
void shadername_convert(char *shaderName) {
  char *s = shaderName;
  for (; *s != '\0'; ++s) {
    if (*s == '\\') {
      *s = '/';
    }
  }
}


x86 assembly (clang, -O0):
<shadername_convert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114d <shadername_convert+0x4d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1137 <shadername_convert+0x37>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
jmp    113c <shadername_convert+0x3c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <shadername_convert+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<shadername_convert>:
jmp    1117 <shadername_convert+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x5c,%al
je     1110 <shadername_convert+0x10>
test   %al,%al
jne    1113 <shadername_convert+0x13>
ret

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

LLVM IR (-O2):
define void @shadername_convert(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 92, label %5
]
5: ; preds = %2
store i8 47, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
void BN_GF2m_mod_arr(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_GF2m_mod_arr() {
ret void
}
int ld_ge_rm1(long double a1, long double *a2) { return (((a1) >= (*a2))); }


x86 assembly (clang, -O0):
<ld_ge_rm1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ge_rm1>:
fldt   0x8(%rsp)
fldt   (%rdi)
xor    %eax,%eax
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
ret

LLVM IR (-O0):
define i32 @ld_ge_rm1(x86_fp80 %0, x86_fp80* %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80*
store x86_fp80 %0, x86_fp80* %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80*, x86_fp80** %4
%7 = load x86_fp80, x86_fp80* %6
%8 = fcmp oge x86_fp80 %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ld_ge_rm1(x86_fp80 %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %1
%4 = fcmp ole x86_fp80 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned char mask(unsigned char startBit, unsigned char nBits) {
  return ((1 << nBits) - 1) << (8 - startBit - nBits);
}


x86 assembly (clang, -O0):
<mask>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
movzbl -0x1(%rbp),%edx
mov    $0x8,%ecx
sub    %edx,%ecx
movzbl -0x2(%rbp),%edx
sub    %edx,%ecx
shl    %cl,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
add    %esi,%edi
mov    $0x8,%cl
sub    %dil,%cl
shl    %cl,%eax
ret

LLVM IR (-O0):
define zeroext i8 @mask(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 1, %6
%8 = sub nsw i32 %7, 1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = sub nsw i32 8, %10
%12 = load i8, i8* %4
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %11, %13
%15 = shl i32 %8, %14
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @mask(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = shl nsw i32 -1, %3
%5 = xor i32 %4, -1
%6 = zext i8 %0 to i32
%7 = add nuw nsw i32 %6, %3
%8 = sub nsw i32 8, %7
%9 = shl i32 %5, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}
unsigned long SoundGetBytesBuffered(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @SoundGetBytesBuffered() {
ret i64 0
}

LLVM IR (-O2):
define i64 @SoundGetBytesBuffered() {
ret i64 0
}
/* Variables and functions */
int M_PI;
int acos(int /*<<< orphan*/);
int /*<<< orphan*/ cos(int);
double _hue(int n) {
  if (n == 0) {
    return 0;
  } else {
    return (256 / M_PI) * acos(cos((M_PI / 38) * n));
  };
}


x86 assembly (clang, -O0):
<_hue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1142 <_hue+0x22>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1188 <_hue+0x68>
mov    $0x100,%eax
mov    0x2e9a(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    $0x26,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
imul   -0xc(%rbp),%edi
call   1040 <cos@plt>
mov    %eax,%edi
call   1030 <acos@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hue>:
test   %edi,%edi
je     1168 <_hue+0x48>
push   %rbx
mov    0x2ebc(%rip),%rax
movslq (%rax),%rcx
mov    $0x100,%eax
xor    %edx,%edx
idiv   %ecx
mov    %eax,%ebx
imul   $0x6bca1af3,%rcx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   %edi,%eax
mov    %eax,%edi
call   1040 <cos@plt>
mov    %eax,%edi
call   1030 <acos@plt>
imul   %ebx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbx
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @_hue(i32 %0) {
%2 = alloca double
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store double 0.000000e+00, double* %2
br label %18
7: ; preds = %1
%8 = load i32, i32* @M_PI
%9 = sdiv i32 256, %8
%10 = load i32, i32* @M_PI
%11 = sdiv i32 %10, 38
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
%14 = call i32 @cos(i32 %13)
%15 = call i32 @acos(i32 %14)
%16 = mul nsw i32 %9, %15
%17 = sitofp i32 %16 to double
store double %17, double* %2
br label %18
18: ; preds = %7, %6
%19 = load double, double* %2
ret double %19
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @_hue(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = load i32, i32* @M_PI
%5 = sdiv i32 256, %4
%6 = sdiv i32 %4, 38
%7 = mul nsw i32 %6, %0
%8 = tail call i32 @cos(i32 %7)
%9 = tail call i32 @acos(i32 %8)
%10 = mul nsw i32 %9, %5
%11 = sitofp i32 %10 to double
br label %12
12: ; preds = %1, %3
%13 = phi double [ %11, %3 ], [ 0.000000e+00, %1 ]
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
void OUTHX(unsigned char c) { printf("%02x", c); }


x86 assembly (clang, -O0):
<OUTHX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movzbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @OUTHX(i8 zeroext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
ret void
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int printargs(struct tcb *);
int sys_capget(struct tcb *tcp) { return printargs(tcp); }


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

x86 assembly (clang, -O2):
<sys_capget>:
jmp    1030 <printargs@plt>

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

LLVM IR (-O2):
%struct.tcb = type { i32 }
define i32 @sys_capget(%struct.tcb* %0) {
%2 = tail call i32 @printargs(%struct.tcb* %0)
ret i32 %2
}
void RTAvlroIOPortRemove(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlroIOPortRemove() {
ret void
}
void outsl(int port, const void *addr, unsigned long count) {
  asm volatile("rep; outs"
               "l"
               : "+S"(addr), "+c"(count)
               : "d"(port));
}


x86 assembly (clang, -O0):
<outsl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edx
rep outsl %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsl>:
mov    %rdx,%rcx
mov    %edi,%edx
rep outsl %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsl(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = call { i8*, i64 } asm sideeffect "rep; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %9, i8* %7, i64 %8)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @outsl(i32 %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
char const *strerror(int /*<<< orphan*/);
const char *tun_last_error() { return strerror(errno); }


x86 assembly (clang, -O0):
<tun_last_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tun_last_error>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@errno = global i32 0
define i8* @tun_last_error() {
%1 = load i32, i32* @errno
%2 = call i8* @strerror(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@errno = global i32 0
define i8* @tun_last_error() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
ret i8* %2
}
int ls2h_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld,
                          int index) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.hda_codec = type opaque
%struct.hdmi_eld = type opaque
define i32 @ls2h_hda_eld_proc_new(%struct.hda_codec* %0, %struct.hdmi_eld* %1, i32 %2) {
%4 = alloca %struct.hda_codec*
%5 = alloca %struct.hdmi_eld*
%6 = alloca i32
store %struct.hda_codec* %0, %struct.hda_codec** %4
store %struct.hdmi_eld* %1, %struct.hdmi_eld** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.hda_codec = type opaque
%struct.hdmi_eld = type opaque
define i32 @ls2h_hda_eld_proc_new(%struct.hda_codec* nocapture readnone %0, %struct.hdmi_eld* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) int is_dt_extra(uint32_t op) {
  return !((op & 0x0E0000F0) ^ 0x000000B0) || !((op & 0x0E0000D0) ^ 0x000000D0);
}


x86 assembly (clang, -O0):
<is_dt_extra>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xe0000f0,%ecx
xor    $0xb0,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
je     113c <is_dt_extra+0x3c>
mov    -0x4(%rbp),%eax
and    $0xe0000d0,%eax
xor    $0xd0,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dt_extra>:
mov    %edi,%eax
and    $0xe0000f0,%eax
cmp    $0xb0,%eax
sete   %al
and    $0xe0000d0,%edi
cmp    $0xd0,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_dt_extra(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 234881264
%5 = xor i32 %4, 176
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i32, i32* %2
%9 = and i32 %8, 234881232
%10 = xor i32 %9, 208
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br label %13
13: ; preds = %7, %1
%14 = phi i1 [ true, %1 ], [ %12, %7 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @is_dt_extra(i32 %0) {
%2 = and i32 %0, 234881264
%3 = icmp eq i32 %2, 176
%4 = and i32 %0, 234881232
%5 = icmp eq i32 %4, 208
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ UART0_RX_TX_DriverIRQHandler();
__attribute__((weak)) void UART0_RX_TX_IRQHandler(void) {
  UART0_RX_TX_DriverIRQHandler();
}


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

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

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

LLVM IR (-O2):
define weak void @UART0_RX_TX_IRQHandler() {
%1 = tail call i32 (...) @UART0_RX_TX_DriverIRQHandler()
ret void
}
char mapdn(c)
char c;
{
  if (c >= 'A' && c <= 'Z')
    return (c + 040);
  return (c);
}


x86 assembly (clang, -O0):
<mapdn>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <mapdn+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <mapdn+0x33>
movsbl -0x2(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1139 <mapdn+0x39>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapdn>:
mov    %edi,%eax
shl    $0x18,%eax
add    $0xbfffffff,%eax
lea    0x20(%rdi),%ecx
cmp    $0x1affffff,%eax
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @mapdn(i32 %0) {
%2 = alloca i8
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 65
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 90
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = add nsw i32 %14, 32
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %19
17: ; preds = %8, %1
%18 = load i8, i8* %3
store i8 %18, i8* %2
br label %19
19: ; preds = %17, %12
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @mapdn(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -1073741825
%4 = icmp ult i32 %3, 452984831
%5 = add i32 %0, 32
%6 = select i1 %4, i32 %5, i32 %0
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ blc_write_iface_file_int(char const *, char *, int, int *);
void blc_set_brightness(const char *iface, int val, int *err) {
  blc_write_iface_file_int(iface, "brightness", val, err);
}


x86 assembly (clang, -O0):
<blc_set_brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rsi
call   1030 <blc_write_iface_file_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blc_set_brightness>:
mov    %rdx,%rcx
mov    %esi,%edx
lea    0xee4(%rip),%rsi
jmp    1030 <blc_write_iface_file_int@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"brightness\00"
define void @blc_set_brightness(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @blc_write_iface_file_int(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32* %9)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"brightness\00"
define void @blc_set_brightness(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 @blc_write_iface_file_int(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int ptys_open(char *pts_name) {
  int fds;
  if ((fds = open(pts_name, O_RDWR)) < 0)
    return (-1);
  return (fds);
}


x86 assembly (clang, -O0):
<ptys_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1146 <ptys_open+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <ptys_open+0x3c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptys_open>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @ptys_open(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
int fi1(int j, signed char *b, int i) { return j + b[i]; }


x86 assembly (clang, -O0):
<fi1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fi1>:
movslq %edx,%rax
movsbl (%rsi,%rax,1),%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @fi1(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 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = add nsw i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @fi1(i32 %0, i8* nocapture %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, %0
ret i32 %8
}
int logicalShift(int x, int n) {
  int a = (x >> 31 & 1) << 32 + ~n;
  return (x ^ a << n) >> n ^ a;
}


x86 assembly (clang, -O0):
<logicalShift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
add    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
xor    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<logicalShift>:
mov    %edi,%eax
shr    $0x1f,%eax
mov    $0x1f,%cl
sub    %sil,%cl
shl    %cl,%eax
and    $0x7fffffff,%edi
mov    %esi,%ecx
shr    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @logicalShift(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = ashr i32 %6, 31
%8 = and i32 %7, 1
%9 = load i32, i32* %4
%10 = xor i32 %9, -1
%11 = add nsw i32 32, %10
%12 = shl i32 %8, %11
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = shl i32 %14, %15
%17 = xor i32 %13, %16
%18 = load i32, i32* %4
%19 = ashr i32 %17, %18
%20 = load i32, i32* %5
%21 = xor i32 %19, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @logicalShift(i32 %0, i32 %1) {
%3 = lshr i32 %0, 31
%4 = sub i32 31, %1
%5 = shl nuw i32 %3, %4
%6 = and i32 %0, 2147483647
%7 = lshr i32 %6, %1
%8 = xor i32 %5, %7
ret i32 %8
}
char *cstrupr(char *s) {
  char *p;
  for (p = s; *p; p++)
    *p = ((((*p) >= 'a') && ((*p) <= 'z')) ? ((*p) - ' ') : (*p));
  return s;
}


x86 assembly (clang, -O0):
<cstrupr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <cstrupr+0x75>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     114f <cstrupr+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     114f <cstrupr+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <cstrupr+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <cstrupr+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstrupr>:
mov    %rdi,%rax
mov    (%rdi),%dl
test   %dl,%dl
je     1133 <cstrupr+0x33>
lea    0x1(%rax),%rcx
nopl   (%rax)
lea    -0x61(%rdx),%esi
lea    -0x20(%rdx),%edi
cmp    $0x1a,%sil
movzbl %dl,%edx
movzbl %dil,%esi
cmovae %edx,%esi
mov    %sil,-0x1(%rcx)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <cstrupr+0x10>
ret

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

LLVM IR (-O2):
define i8* @cstrupr(i8* returned %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* [ %11, %4 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
%9 = add nsw i8 %5, -32
%10 = select i1 %8, i8 %9, i8 %5
store i8 %10, i8* %6
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  scalar_t__ tm_hour;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ timegm(struct tm *);
time_t getNextDayForTs(time_t ts) {
  struct tm *t = gmtime(&ts);
  t->tm_sec = 0;
  t->tm_min = 0;
  t->tm_hour = 0;
  t->tm_mday += 1;
  return timegm(t);
}


x86 assembly (clang, -O0):
<getNextDayForTs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <timegm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextDayForTs>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <gmtime@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rax)
movq   $0x0,0x18(%rax)
addl   $0x1,(%rax)
mov    %rax,%rdi
call   1030 <timegm@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i64, i64, i64 }
define i32 @getNextDayForTs(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
store i64 0, i64* %6
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 2
store i64 0, i64* %8
%9 = load %struct.tm*, %struct.tm** %3
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
store i64 0, i64* %10
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
%15 = load %struct.tm*, %struct.tm** %3
%16 = call i32 @timegm(%struct.tm* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.tm = type { i32, i64, i64, i64 }
define i32 @getNextDayForTs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @gmtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%5 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%6 = bitcast i64* %4 to i8*
%7 = load i32, i32* %5
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = call i32 @timegm(%struct.tm* %3)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void term_highlight() { printf("\033[1m"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[1m\00"
define void @term_highlight() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
int sub1(int a, int b) { return a + b; }


x86 assembly (clang, -O0):
<sub1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub1>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @sub1(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @sub1(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(char *);
main() {
  char c;
  char c2;
  int i = 0;
  char *pc = &c;
  char *pc2 = &c2;
  int *pi = &i;
  *pc2 = 1;
  *pi = 1;
  *pc2 &= *pi;
  f(pc2);
  *pc2 = 1;
  *pc2 &= *pi;
  if (*pc2 != 1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x6(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
and    %edx,%ecx
mov    %cl,(%rax)
mov    -0x20(%rbp),%rdi
call   1040 <f@plt>
mov    -0x20(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
and    %edx,%ecx
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
je     11b8 <main+0x88>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x1,0x7(%rsp)
lea    0x7(%rsp),%rdi
call   1030 <f@plt>
movb   $0x1,0x7(%rsp)
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %4
store i8* %2, i8** %5
store i8* %3, i8** %6
store i32* %4, i32** %7
%8 = load i8*, i8** %6
store i8 1, i8* %8
%9 = load i32*, i32** %7
store i32 1, i32* %9
%10 = load i32*, i32** %7
%11 = load i32, i32* %10
%12 = load i8*, i8** %6
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = and i32 %14, %11
%16 = trunc i32 %15 to i8
store i8 %16, i8* %12
%17 = load i8*, i8** %6
%18 = call i32 @f(i8* %17)
%19 = load i8*, i8** %6
store i8 1, i8* %19
%20 = load i32*, i32** %7
%21 = load i32, i32* %20
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = and i32 %24, %21
%26 = trunc i32 %25 to i8
store i8 %26, i8* %22
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %0
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8
store i8 1, i8* %1
%2 = call i32 @f(i8* %1)
store i8 1, i8* %1
%3 = call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct eventlist {
  int dummy;
};

/* Variables and functions */
int setup_events_cpumask(struct eventlist *, int, int /*<<< orphan*/ *, int);
int setup_events(struct eventlist *el, bool measure_all, int measure_pid) {
  return setup_events_cpumask(el, measure_pid, NULL,
                              measure_all ? (1 << 1) : (1 << 0));
}


x86 assembly (clang, -O0):
<setup_events>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x1,%ecx
mov    $0x2,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <setup_events_cpumask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_events>:
cmp    $0x1,%esi
mov    $0x2,%ecx
sbb    $0x0,%ecx
mov    %edx,%esi
xor    %edx,%edx
jmp    1030 <setup_events_cpumask@plt>

LLVM IR (-O0):
%struct.eventlist = type { i32 }
define i32 @setup_events(%struct.eventlist* %0, i32 %1, i32 %2) {
%4 = alloca %struct.eventlist*
%5 = alloca i32
%6 = alloca i32
store %struct.eventlist* %0, %struct.eventlist** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.eventlist*, %struct.eventlist** %4
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 2, i32 1
%13 = call i32 @setup_events_cpumask(%struct.eventlist* %7, i32 %8, i32* null, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.eventlist = type { i32 }
define i32 @setup_events(%struct.eventlist* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 1, i32 2
%6 = tail call i32 @setup_events_cpumask(%struct.eventlist* %0, i32 %2, i32* null, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MC_put4_8(int, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ const *, int,
                             int /*<<< orphan*/);
void MC_put_xy_8_mmxext(uint8_t *dest, const uint8_t *ref, int stride,
                        int height) {
  MC_put4_8(height, dest, ref, stride, 0);
}


x86 assembly (clang, -O0):
<MC_put_xy_8_mmxext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %r8d,%r8d
call   1030 <MC_put4_8@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC_put_xy_8_mmxext>:
mov    %edx,%eax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %ecx,%edi
mov    %eax,%ecx
xor    %r8d,%r8d
jmp    1030 <MC_put4_8@plt>

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

LLVM IR (-O2):
define void @MC_put_xy_8_mmxext(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @MC_put4_8(i32 %3, i32* %0, i32* %1, i32 %2, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
int setsockopt(int, int, int, int *, int);
int sock_setsockopt(int s, int level, int optname, int val) {
  if (setsockopt(s, level, optname, &val, sizeof(val)) == -1)
    return -1;
  else
    return val;
}


x86 assembly (clang, -O0):
<sock_setsockopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x14(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1151 <sock_setsockopt+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <sock_setsockopt+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_setsockopt>:
push   %rax
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     112e <sock_setsockopt+0x1e>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @sock_setsockopt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
store i32 %3, i32* %5
%6 = call i32 @setsockopt(i32 %0, i32 %1, i32 %2, i32* %5, i32 4)
%7 = icmp eq i32 %6, -1
%8 = load i32, i32* %5
%9 = select i1 %7, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
scalar_t__ strncmp(char *, char const *, int);
int isURL(const char *in) { return strncmp("http://", in, 7) == 0; }


x86 assembly (clang, -O0):
<isURL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isURL>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
define i32 @isURL(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3, i32 7)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
define i32 @isURL(i8* %0) {
%2 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 7)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() {
  int x, y, z;
  int a;
  x = 0;
  while (x < 5) {
    x++;
    x++;
    if (y > 10) {
      z++;
    }
    z = z + x + y;
  }
  a = x + y + z;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1152 <main+0x52>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    1141 <main+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <main+0x12>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%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 i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 10
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %19
19: ; preds = %16, %9
%20 = load i32, i32* %4
%21 = load i32, i32* %2
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
store i32 %24, i32* %4
br label %6
25: ; preds = %6
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = add nsw i32 %26, %27
%29 = load i32, i32* %4
%30 = add nsw i32 %28, %29
store i32 %30, i32* %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
float ATH_dB(float, int /*<<< orphan*/);
float pow(double, float);
float ATH_energy(float freq, float value) {
  float db;
  db = ATH_dB(freq, 0) + value;
  return (pow(10.0, (db + 41.837375) * 0.1));
}


x86 assembly (clang, -O0):
<ATH_energy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
xor    %edi,%edi
call   1030 <ATH_dB@plt>
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm1
movsd  0xe8b(%rip),%xmm0
call   1040 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ATH_energy>:
push   %rax
movss  %xmm1,0x4(%rsp)
xor    %edi,%edi
call   1030 <ATH_dB@plt>
addss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xec0(%rip),%xmm0
mulsd  0xec0(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm0
pop    %rax
jmp    1040 <pow@plt>

LLVM IR (-O0):
define float @ATH_energy(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = call float @ATH_dB(float %6, i32 0)
%8 = load float, float* %4
%9 = fadd float %7, %8
store float %9, float* %5
%10 = load float, float* %5
%11 = fpext float %10 to double
%12 = fadd double %11, 0x4044EB2F1A9FBE77
%13 = fmul double %12, 1.000000e-01
%14 = fptrunc double %13 to float
%15 = call float @pow(double 1.000000e+01, float %14)
ret float %15
}

LLVM IR (-O2):
define float @ATH_energy(float %0, float %1) {
%3 = tail call float @ATH_dB(float %0, i32 0)
%4 = fadd float %3, %1
%5 = fpext float %4 to double
%6 = fadd double %5, 0x4044EB2F1A9FBE77
%7 = fmul double %6, 1.000000e-01
%8 = fptrunc double %7 to float
%9 = tail call float @pow(double 1.000000e+01, float %8)
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void Idle(void) { usleep(1000); }


x86 assembly (clang, -O0):
<Idle>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3e8,%edi
call   1030 <usleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Idle>:
mov    $0x3e8,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @Idle() {
%1 = call i32 @usleep(i32 1000)
ret void
}

LLVM IR (-O2):
define void @Idle() {
%1 = tail call i32 @usleep(i32 1000)
ret void
}
int log_info(char *msg, char *sensor) {}


x86 assembly (clang, -O0):
<log_info>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @log_info(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 i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @log_info(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}