xunge/DecIR huggingface dataset:
adrx0adr1_set(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ (((int *)10000000)[x0]) = (*((int *)11111111)); }


x86 assembly (clang, -O0):
<adrx0adr1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    $0xa98ac7,%eax
mov    (%rax),%edx
movslq -0x10(%rbp),%rcx
mov    $0x989680,%eax
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrx0adr1_set>:
mov    0xa98ac7,%eax
movslq %edx,%rcx
mov    %eax,0x989680(,%rcx,4)
ret

LLVM IR (-O0):
define i32 @adrx0adr1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* inttoptr (i64 11111111 to i32*)
%15 = load i32, i32* %10
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* inttoptr (i64 10000000 to i32*), i64 %16
store i32 %14, i32* %17
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @adrx0adr1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
%7 = load i32, i32* inttoptr (i64 11111111 to i32*)
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i32, i32* inttoptr (i64 10000000 to i32*), i64 %8
store i32 %7, i32* %9
ret i32 undef
}
void test_ip_multicast_if(int sock, const char *socktypename) {}


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

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

LLVM IR (-O0):
define void @test_ip_multicast_if(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @test_ip_multicast_if(i32 %0, i8* nocapture %1) {
ret void
}
R0AX1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ r0 = (((short *)11111111)[x1]); }


x86 assembly (clang, -O0):
<R0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
mov    (%rax,%rcx,2),%ax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @R0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %17
%19 = load i16, i16* %18
store i16 %19, i16* %8
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @R0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void catcher(int signal) { printf("Signal: %d \n", signal); }


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"Signal: %d \0A\00"
define void @catcher(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void rotr(int *a, int *b, int *c) {
  int swap_help;
  swap_help = *a;
  *a = *c;
  *c = *b;
  *b = swap_help;
}


x86 assembly (clang, -O0):
<rotr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr>:
mov    (%rdi),%eax
mov    (%rdx),%ecx
mov    %ecx,(%rdi)
mov    (%rsi),%ecx
mov    %ecx,(%rdx)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @rotr(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
store i32 %9, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = load i32*, i32** %6
store i32 %14, i32* %15
%16 = load i32, i32* %7
%17 = load i32*, i32** %5
store i32 %16, i32* %17
ret void
}

LLVM IR (-O2):
define void @rotr(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %2
store i32 %5, i32* %0
%6 = load i32, i32* %1
store i32 %6, i32* %2
store i32 %4, i32* %1
ret void
}
int main() {
  unsigned long long int nu;
  unsigned long long int resultu;
  unsigned long long int iu;
  signed long long int ns;
  signed long long int results;
  signed long long int is;
  nu = 25;
  resultu = 1;
  iu = nu;
  while (iu > 1) {
    resultu = resultu * iu;
    iu--;
  }
  resultu = 0;
  ns = 25;
  results = 1;
  is = ns;
  while (is > 1) {
    results = results * is;
    is--;
  }
  results = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x19,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
jbe    114c <main+0x4c>
mov    -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1123 <main+0x23>
movq   $0x0,-0x18(%rbp)
movq   $0x19,-0x28(%rbp)
movq   $0x1,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x1,-0x38(%rbp)
jle    1195 <main+0x95>
mov    -0x30(%rbp),%rax
imul   -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x38(%rbp)
jmp    116c <main+0x6c>
movq   $0x0,-0x30(%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 i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
store i64 25, i64* %2
store i64 1, i64* %3
%8 = load i64, i64* %2
store i64 %8, i64* %4
br label %9
9: ; preds = %12, %0
%10 = load i64, i64* %4
%11 = icmp ugt i64 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = mul i64 %13, %14
store i64 %15, i64* %3
%16 = load i64, i64* %4
%17 = add i64 %16, -1
store i64 %17, i64* %4
br label %9
18: ; preds = %9
store i64 0, i64* %3
store i64 25, i64* %5
store i64 1, i64* %6
%19 = load i64, i64* %5
store i64 %19, i64* %7
br label %20
20: ; preds = %23, %18
%21 = load i64, i64* %7
%22 = icmp sgt i64 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i64, i64* %6
%25 = load i64, i64* %7
%26 = mul nsw i64 %24, %25
store i64 %26, i64* %6
%27 = load i64, i64* %7
%28 = add nsw i64 %27, -1
store i64 %28, i64* %7
br label %20
29: ; preds = %20
store i64 0, i64* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_EQUALS_int32_t(int32_t const k1, int32_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_MAP_KEY_EQUALS_int32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_EQUALS_int32_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_EQUALS_int32_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_EQUALS_int32_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
float __exp2(float);
float exp2f(float x) { return __exp2(x); }


x86 assembly (clang, -O0):
<exp2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <__exp2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp2f>:
jmp    1030 <__exp2@plt>

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

LLVM IR (-O2):
define float @exp2f(float %0) {
%2 = tail call float @__exp2(float %0)
ret float %2
}
unsigned int gcd(unsigned int a, unsigned int b) {
  unsigned int tmp;
  tmp = a % b;
  while (tmp != 0) {
    a = b;
    b = tmp;
    tmp = a % b;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113b <gcd+0x3b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1115 <gcd+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     1121 <gcd+0x21>
nopw   0x0(%rax,%rax,1)
mov    %edx,%ecx
mov    %esi,%eax
xor    %edx,%edx
div    %ecx
mov    %ecx,%esi
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gcd(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 = load i32, i32* %4
%8 = urem i32 %6, %7
store i32 %8, i32* %5
br label %9
9: ; preds = %12, %2
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %4
store i32 %13, i32* %3
%14 = load i32, i32* %5
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = urem i32 %15, %16
store i32 %17, i32* %5
br label %9
18: ; preds = %9
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ %3, %2 ]
%7 = phi i32 [ %6, %5 ], [ %1, %2 ]
%8 = urem i32 %7, %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %2
%11 = phi i32 [ %1, %2 ], [ %6, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ClearONOFF();
int /*<<< orphan*/ DeinitFields();
void SwitchFrom_29K(void) {
  DeinitFields();
  ClearONOFF();
}


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

x86 assembly (clang, -O2):
<SwitchFrom_29K>:
push   %rax
xor    %eax,%eax
call   1030 <DeinitFields@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ClearONOFF@plt>

LLVM IR (-O0):
define void @SwitchFrom_29K() {
%1 = call i32 (...) @DeinitFields()
%2 = call i32 (...) @ClearONOFF()
ret void
}

LLVM IR (-O2):
define void @SwitchFrom_29K() {
%1 = tail call i32 (...) @DeinitFields()
%2 = tail call i32 (...) @ClearONOFF()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char *msg = argv[1];
  printf("%s\n", msg);
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rsi
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int inrange(int v, int min, int max) {
  if (min != -1 && v < min)
    return 0;
  if (max != -1 && v > max)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<inrange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     112f <inrange+0x2f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    112f <inrange+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1158 <inrange+0x58>
cmpl   $0xffffffff,-0x10(%rbp)
je     1151 <inrange+0x51>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1151 <inrange+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1158 <inrange+0x58>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inrange>:
cmp    $0xffffffff,%esi
sete   %r8b
cmp    %esi,%edi
setge  %cl
cmp    $0xffffffff,%edx
sete   %al
cmp    %edx,%edi
setle  %dl
or     %al,%dl
or     %r8b,%cl
and    %dl,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @inrange(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, -1
%5 = icmp sge i32 %0, %1
%6 = icmp eq i32 %2, -1
%7 = icmp sle i32 %0, %2
%8 = or i1 %6, %7
%9 = or i1 %4, %5
%10 = and i1 %9, %8
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
void uninitvar_fflush(void) {
  FILE *stream;
  (void)fflush(stream);
}


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

x86 assembly (clang, -O2):
<uninitvar_fflush>:
jmp    1030 <fflush@plt>

LLVM IR (-O0):
define void @uninitvar_fflush() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @fflush(i32* %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_fflush() {
%1 = tail call i32 @fflush(i32* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ command_identify();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void detect() {
  if (!command_identify()) {
    fprintf(stderr, "No flash device detected on COM port\n");
    exit(1);
    ;
  }
}


x86 assembly (clang, -O0):
<detect>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <command_identify@plt>
cmp    $0x0,%eax
jne    1163 <detect+0x33>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect>:
push   %rax
xor    %eax,%eax
call   1040 <command_identify@plt>
test   %eax,%eax
je     113e <detect+0xe>
pop    %rax
ret
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"No flash device detected on COM port\0A\00"
define void @detect() {
%1 = call i32 (...) @command_identify()
%2 = icmp ne i32 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"No flash device detected on COM port\0A\00"
define void @detect() {
%1 = tail call i32 (...) @command_identify()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
ret void
}
execle(name, args) char *name;
char *args;
{
  char **p = &args;
  while (*p++)
    ;
  execve(name, &args, *p);
}


x86 assembly (clang, -O0):
<execle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,(%rax)
je     1146 <execle+0x36>
jmp    1128 <execle+0x18>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <execve@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execle>:
push   %rax
mov    %rsi,(%rsp)
lea    0x10(%rsp),%rax
xor    %ecx,%ecx
test   %cl,%cl
je     1130 <execle+0x20>
mov    %rax,%rcx
jmp    113d <execle+0x2d>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x8(%rax),%rcx
cmpq   $0x0,(%rax)
mov    %rcx,%rax
jne    1130 <execle+0x20>
mov    (%rcx),%rdx
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <execve@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @execle(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = icmp ne i8* %1, null
%5 = getelementptr inbounds i8*, i8** %3, i64 2
br i1 undef, label %11, label %6
6: ; preds = %2, %6
%7 = phi i8** [ %9, %6 ], [ %5, %2 ]
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %7, i64 1
%10 = icmp eq i8* %8, null
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = phi i8** [ %5, %2 ], [ %9, %6 ]
%13 = load i8*, i8** %12
%14 = call i32 (i8*, i8**, i8*, ...) bitcast (i32 (...)* @execve to i32 (i8*, i8**, i8*, ...)*)(i8* %0, i8** %3, i8* %13)
ret i32 undef
}
unsigned char f40(unsigned char x, long int y) {
  return (x >> y) | (x << ((-y) & (8 - 1)));
}


x86 assembly (clang, -O0):
<f40>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
sar    %cl,%eax
movzbl -0x1(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0x7,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f40>:
mov    %rsi,%rcx
mov    %edi,%eax
shr    %cl,%eax
neg    %cl
and    $0x7,%cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f40(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = ashr i32 %6, %8
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = load i64, i64* %4
%13 = sub nsw i64 0, %12
%14 = and i64 %13, 7
%15 = trunc i64 %14 to i32
%16 = shl i32 %11, %15
%17 = or i32 %9, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f40(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = lshr i32 %3, %4
%6 = sub i32 0, %4
%7 = and i32 %6, 7
%8 = shl nuw nsw i32 %3, %7
%9 = or i32 %8, %5
%10 = trunc i32 %9 to i8
ret i8 %10
}
/* Variables and functions */
char *strrchr(char *, char);
char *util_strip_nl(char *s) {
  char *c = strrchr(s, '\n');
  if (c) {
    *c = 0;
  }
  return s;
}


x86 assembly (clang, -O0):
<util_strip_nl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1140 <util_strip_nl+0x30>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_strip_nl>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1126 <util_strip_nl+0x16>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @util_strip_nl(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 10)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8 0, i8* %9
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define i8* @util_strip_nl(i8* returned %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ itob(int const, char *, int);
int /*<<< orphan*/ printf(char *, int const, int, char *);
main() {
  const int n = 1024;
  char s[1000];
  int b;
  for (b = 2; b <= 36; ++b) {
    itob(n, s, b);
    printf("n=%d, b=%d, s=%s\n", n, b, s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x400,-0x8(%rbp)
movl   $0x2,-0x3f4(%rbp)
cmpl   $0x24,-0x3f4(%rbp)
jg     1199 <main+0x79>
lea    -0x3f0(%rbp),%rsi
mov    -0x3f4(%rbp),%edx
mov    $0x400,%edi
call   1040 <itob@plt>
mov    -0x3f4(%rbp),%edx
lea    -0x3f0(%rbp),%rcx
lea    0xe85(%rip),%rdi
mov    $0x400,%esi
call   1030 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    1143 <main+0x23>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    $0x2,%ebx
mov    %rsp,%r14
lea    0xec5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    $0x400,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <itob@plt>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x25,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"n=%d, b=%d, s=%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 2, %0 ], [ %7, %3 ]
%5 = call i32 @itob(i32 1024, i8* %2, i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1024, i32 %4, i8* %2)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 37
br i1 %8, label %9, label %3
9: ; preds = %3
ret i32 0
}
unsigned short BSP_WifiCalDataLen(unsigned short usLen) { return 0; }


x86 assembly (clang, -O0):
<BSP_WifiCalDataLen>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
xor    %eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @BSP_WifiCalDataLen(i16 zeroext %0) {
ret i16 0
}
int bar(const int argument) { return argument * 4; }


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

x86 assembly (clang, -O2):
<bar>:
lea    0x0(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
ret i32 %4
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = shl nsw i32 %0, 2
ret i32 %2
}
inc(int i) { return i + 1; }


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

x86 assembly (clang, -O2):
<inc>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @inc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @inc(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
int test_imm_84int8_mem(signed char *val) {
  return ((*val) & (-0x84 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_84int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff7c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_84int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -132
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
char *convert(unsigned int num, int base) {
  static char Representation[] = "0123456789ABCDEF";
  static char buffer[50];
  char *ptr;
  ptr = &buffer[49];
  *ptr = '\0';
  do {
    *--ptr = Representation[num % base];
    num /= base;
  } while (num != 0);
  return (ptr);
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0x2f4f(%rip),%rax
add    $0x31,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,%eax
mov    %eax,%ecx
lea    0x2efd(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1120 <convert+0x20>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
movb   $0x0,0x2f5a(%rip)
lea    0x2f53(%rip),%rcx
lea    0xeeb(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,%eax
xor    %edx,%edx
div    %esi
movzbl (%rdx,%r8,1),%edx
mov    %dl,-0x1(%rcx)
add    $0xffffffffffffffff,%rcx
cmp    %esi,%edi
mov    %eax,%edi
jae    1120 <convert+0x20>
mov    %rcx,%rax
ret

LLVM IR (-O0):
@convert.Representation = internal global [17 x i8] c"0123456789ABCDEF\00"
@convert.buffer = internal global [50 x i8] zeroinitializer
define i8* @convert(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @convert.buffer, i64 0, i64 49), i8** %5
%6 = load i8*, i8** %5
store i8 0, i8* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = urem i32 %8, %9
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [17 x i8], [17 x i8]* @convert.Representation, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i32 -1
store i8* %15, i8** %5
store i8 %13, i8* %15
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = udiv i32 %17, %16
store i32 %18, i32* %3
br label %19
19: ; preds = %7
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %7, label %22
22: ; preds = %19
%23 = load i8*, i8** %5
ret i8* %23
}

LLVM IR (-O2):
@convert.Representation = internal unnamed_addr constant [17 x i8] c"0123456789ABCDEF\00"
@convert.buffer = internal global [50 x i8] zeroinitializer
define i8* @convert(i32 %0, i32 %1) {
store i8 0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @convert.buffer, i64 0, i64 49)
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %11, %3 ]
%5 = phi i8* [ getelementptr inbounds ([50 x i8], [50 x i8]* @convert.buffer, i64 0, i64 49), %2 ], [ %10, %3 ]
%6 = urem i32 %4, %1
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds [17 x i8], [17 x i8]* @convert.Representation, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 %9, i8* %10
%11 = udiv i32 %4, %1
%12 = icmp ult i32 %4, %1
br i1 %12, label %13, label %3
13: ; preds = %3
ret i8* %10
}
int isChar(char c) {
  if (c > 'z')
    return 0;
  if (c < 'a')
    return (c == '_');
  return -1;
}


x86 assembly (clang, -O0):
<isChar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    1123 <isChar+0x23>
movl   $0x0,-0x4(%rbp)
jmp    114e <isChar+0x4e>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jge    1147 <isChar+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    114e <isChar+0x4e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isChar>:
xor    %eax,%eax
cmp    $0x7a,%dil
jg     111c <isChar+0x1c>
mov    $0xffffffff,%eax
cmp    $0x60,%dil
jg     111c <isChar+0x1c>
xor    %eax,%eax
cmp    $0x5f,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isChar(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 %5, 122
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %18
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 97
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 95
%16 = zext i1 %15 to i32
store i32 %16, i32* %2
br label %18
17: ; preds = %8
store i32 -1, i32* %2
br label %18
18: ; preds = %17, %12, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @isChar(i8 signext %0) {
%2 = icmp sgt i8 %0, 122
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp slt i8 %0, 97
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = icmp eq i8 %0, 95
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %3, %1, %5
%9 = phi i32 [ %7, %5 ], [ 0, %1 ], [ -1, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  int x = 100;
  int *ptr = &x;
  *ptr = 3;
  printf("x value: %i address: %p\n", x, &x);
  printf("ptr value: %p address: %p\n", ptr, &ptr);
  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)
movl   $0x64,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x14(%rbp),%esi
lea    0xeb7(%rip),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xeba(%rip),%rdi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x4(%rsp),%rbx
mov    %rbx,0x8(%rsp)
movl   $0x3,0x4(%rsp)
lea    0xed2(%rip),%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"x value: %i address: %p\0A\00"
@.str.1 = [27 x i8] c"ptr value: %p address: %p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
store i32* %6, i32** %7
%8 = load i32*, i32** %7
store i32 3, i32* %8
%9 = load i32, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9, i32* %6)
%11 = load i32*, i32** %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32* %11, i32** %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"x value: %i address: %p\0A\00"
@.str.1 = [27 x i8] c"ptr value: %p address: %p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32** %4 to i8*
store i32* %3, i32** %4
store i32 3, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 3, i32* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32** %4)
ret i32 0
}
/* Variables and functions */
int pigpio_command(int, int, unsigned int, int /*<<< orphan*/, int);
int get_PWM_frequency(int pi, unsigned user_gpio) {
  return pigpio_command(pi, 23, user_gpio, 0, 1);
}


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

x86 assembly (clang, -O2):
<get_PWM_frequency>:
mov    %esi,%edx
mov    $0x17,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <pigpio_command@plt>

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

LLVM IR (-O2):
define i32 @get_PWM_frequency(i32 %0, i32 %1) {
%3 = tail call i32 @pigpio_command(i32 %0, i32 23, i32 %1, i32 0, i32 1)
ret i32 %3
}
/* Variables and functions */
int inportb(int);
int /*<<< orphan*/ outportb(int, int);
void reboot() {
  int temp;
  do {
    temp = inportb(0x64);
    if (temp & 1)
      inportb(0x60);
  } while (temp & 2);
  outportb(0x64, 0xFE);
}


x86 assembly (clang, -O0):
<reboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1030 <inportb@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     114e <reboot+0x2e>
mov    $0x60,%edi
call   1030 <inportb@plt>
jmp    1153 <reboot+0x33>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1128 <reboot+0x8>
mov    $0x64,%edi
mov    $0xfe,%esi
call   1040 <outportb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reboot>:
push   %rbx
jmp    1135 <reboot+0x15>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   $0x2,%bl
je     1152 <reboot+0x32>
mov    $0x64,%edi
call   1030 <inportb@plt>
mov    %eax,%ebx
test   $0x1,%bl
je     1130 <reboot+0x10>
mov    $0x60,%edi
call   1030 <inportb@plt>
jmp    1130 <reboot+0x10>
mov    $0x64,%edi
mov    $0xfe,%esi
pop    %rbx
jmp    1040 <outportb@plt>

LLVM IR (-O0):
define void @reboot() {
%1 = alloca i32
br label %2
2: ; preds = %10, %0
%3 = call i32 @inportb(i32 100)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @inportb(i32 96)
br label %9
9: ; preds = %7, %2
br label %10
10: ; preds = %9
%11 = load i32, i32* %1
%12 = and i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %2, label %14
14: ; preds = %10
%15 = call i32 @outportb(i32 100, i32 254)
ret void
}

LLVM IR (-O2):
define void @reboot() {
br label %1
1: ; preds = %7, %0
%2 = tail call i32 @inportb(i32 100)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @inportb(i32 96)
br label %7
7: ; preds = %1, %5
%8 = and i32 %2, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %1
10: ; preds = %7
%11 = tail call i32 @outportb(i32 100, i32 254)
ret void
}
/* Variables and functions */
int get_pck__foo__bar__minsym();
int pck__foo__bar__minsym__2(void) { return get_pck__foo__bar__minsym(); }


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

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

LLVM IR (-O0):
define i32 @pck__foo__bar__minsym__2() {
%1 = call i32 (...) @get_pck__foo__bar__minsym()
ret i32 %1
}

LLVM IR (-O2):
define i32 @pck__foo__bar__minsym__2() {
%1 = tail call i32 (...) @get_pck__foo__bar__minsym()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ es7000_sw_apic();
void enable_apic_mode(void) {
  es7000_sw_apic();
  return;
}


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

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

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

LLVM IR (-O2):
define void @enable_apic_mode() {
%1 = tail call i32 (...) @es7000_sw_apic()
ret void
}
/* Variables and functions */
int any_decrqss(char const *, char *);
int rpt_DECDLDA(const char *the_title) { return any_decrqss(the_title, ",z"); }


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

x86 assembly (clang, -O2):
<rpt_DECDLDA>:
lea    0xee9(%rip),%rsi
jmp    1030 <any_decrqss@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c",z\00"
define i32 @rpt_DECDLDA(i8* %0) {
%2 = tail call i32 @any_decrqss(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int val = 0xFFFF00FF;
  printf("decimal:     %u\n", val);
  printf("hexadecimal: %x\n", val);
  printf("octal:       %o\n", val);
  printf("binary:      %032b\n", val);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffff00ff,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0xffff00ff,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0xffff00ff,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0xffff00ff,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0xffff00ff,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"decimal: %u\0A\00"
@.str.1 = [17 x i8] c"hexadecimal: %x\0A\00"
@.str.2 = [17 x i8] c"octal: %o\0A\00"
@.str.3 = [20 x i8] c"binary: %032b\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -65281, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"decimal: %u\0A\00"
@.str.1 = [17 x i8] c"hexadecimal: %x\0A\00"
@.str.2 = [17 x i8] c"octal: %o\0A\00"
@.str.3 = [20 x i8] c"binary: %032b\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -65281)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 -65281)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 -65281)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 -65281)
%5 = tail call i32 @exit(i32 0)
unreachable
}
long long mbr_size_bytes(void) { return 512 * (62 + 4); }


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

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

LLVM IR (-O0):
define i64 @mbr_size_bytes() {
ret i64 33792
}

LLVM IR (-O2):
define i64 @mbr_size_bytes() {
ret i64 33792
}
unsigned long long get_interval(unsigned long long prev_uptime,
                                unsigned long long curr_uptime) {
  unsigned long long itv;
  if (!prev_uptime) {
    itv = curr_uptime;
  } else {
    itv = (curr_uptime - prev_uptime) & 0xffffffff;
  }
  if (!itv) {
    itv = 1;
  }
  return itv;
}


x86 assembly (clang, -O0):
<get_interval>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1124 <get_interval+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    113d <get_interval+0x3d>
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <get_interval+0x50>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_interval>:
mov    %esi,%ecx
sub    %edi,%ecx
test   %rdi,%rdi
cmove  %rsi,%rcx
test   %rcx,%rcx
mov    $0x1,%eax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
define i64 @get_interval(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = load i64, i64* %4
store i64 %9, i64* %5
br label %15
10: ; preds = %2
%11 = load i64, i64* %4
%12 = load i64, i64* %3
%13 = sub i64 %11, %12
%14 = and i64 %13, 4294967295
store i64 %14, i64* %5
br label %15
15: ; preds = %10, %8
%16 = load i64, i64* %5
%17 = icmp ne i64 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %15
store i64 1, i64* %5
br label %19
19: ; preds = %18, %15
%20 = load i64, i64* %5
ret i64 %20
}

LLVM IR (-O2):
define i64 @get_interval(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = sub i64 %1, %0
%5 = and i64 %4, 4294967295
%6 = select i1 %3, i64 %1, i64 %5
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i64 1, i64 %6
ret i64 %8
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_creds_get_tid_comm(void *c, const char **ret) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_creds_get_tid_comm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_creds_get_tid_comm>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_creds_get_tid_comm(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_creds_get_tid_comm(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
int main() {
  int foo[10][10][10];
  foo[9][9][0] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x38(%rbp)
xor    %eax,%eax
add    $0xf30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x [10 x i32]]]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* %2, i64 0, i64 9
%4 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %3, i64 0, i64 9
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
store i32 0, i32* %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
double cel2fahr(double temp) { return 1.8 * temp + 32.0; }


x86 assembly (clang, -O0):
<cel2fahr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cel2fahr>:
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @cel2fahr(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %3, double 3.200000e+01)
ret double %4
}

LLVM IR (-O2):
define double @cel2fahr(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 1.800000e+00, double 3.200000e+01)
ret double %2
}