xunge/DecIR huggingface dataset:
int isPipedCommand(char *input) {
  int i = 0;
  for (i = 0; input[i] != '\0'; i++) {
    if (input[i] == '|')
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isPipedCommand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115f <isPipedCommand+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
jne    114c <isPipedCommand+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1166 <isPipedCommand+0x66>
jmp    1151 <isPipedCommand+0x51>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1116 <isPipedCommand+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPipedCommand>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <isPipedCommand+0x11>
cmp    $0x7c,%al
je     1114 <isPipedCommand+0x14>
add    $0x1,%rdi
jmp    1100 <isPipedCommand>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isPipedCommand(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 124
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 1, i32* %2
br label %27
22: ; preds = %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %5
store i32 0, i32* %2
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @isPipedCommand(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i64 [ %7, %6 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %9
i8 124, label %8
]
6: ; preds = %2
%7 = add nuw i64 %3, 1
br label %2
8: ; preds = %2
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ 1, %8 ], [ 0, %2 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
__m64 vecret(__m64 vect) { return vect; }


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

x86 assembly (clang, -O2):
<vecret>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @vecret(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ capture_event(void *, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
uint8_t capture_read_sb(uint16_t port, void *p) {
  capture_event(p, (2 << 8), 0, port);
  return 0xff;
}


x86 assembly (clang, -O0):
<capture_read_sb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x200,%esi
xor    %edx,%edx
call   1030 <capture_event@plt>
mov    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<capture_read_sb>:
push   %rax
mov    %edi,%ecx
mov    %rsi,%rdi
mov    $0x200,%esi
xor    %edx,%edx
call   1030 <capture_event@plt>
mov    $0xff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @capture_read_sb(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @capture_event(i8* %5, i32 512, i32 0, i32 %6)
ret i32 255
}

LLVM IR (-O2):
define i32 @capture_read_sb(i32 %0, i8* %1) {
%3 = tail call i32 @capture_event(i8* %1, i32 512, i32 0, i32 %0)
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ lwc__dolower(int /*<<< orphan*/);
void lwc__lcase_memcpy(char *target, const char *source, size_t n) {
  while (n--) {
    *target++ = lwc__dolower(*source++);
  }
}


x86 assembly (clang, -O0):
<lwc__lcase_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     116c <lwc__lcase_memcpy+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <lwc__dolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1124 <lwc__lcase_memcpy+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lwc__lcase_memcpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1147 <lwc__lcase_memcpy+0x37>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <lwc__dolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <lwc__lcase_memcpy+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @lwc__lcase_memcpy(i8* nocapture writeonly %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %9, %5 ], [ %2, %3 ]
%7 = phi i8* [ %10, %5 ], [ %1, %3 ]
%8 = phi i8* [ %15, %5 ], [ %0, %3 ]
%9 = add i64 %6, -1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %7
%12 = sext i8 %11 to i32
%13 = tail call i32 @lwc__dolower(i32 %12)
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %14, i8* %8
%16 = icmp eq i64 %9, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %3
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x1;
  int x2;
  x1 = __VERIFIER_nondet_int();
  x2 = __VERIFIER_nondet_int();
  while (x1 <= 10) {
    x2 = 10;
    while (x2 > 1) {
      x2 = x2 - 1;
    }
    x1 = x1 + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     116a <main+0x5a>
movl   $0xa,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    115c <main+0x4c>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
wchar_t *f(wchar_t *x) { return x; }


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

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @f(i32* readnone returned %0) {
ret i32* %0
}
int bwb_Warning_Pending(void) {
  bwx_DEBUG(__FUNCTION__);
  return HasEvent(0x01);
}


x86 assembly (clang, -O0):
<bwb_Warning_Pending>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <bwx_DEBUG@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1040 <HasEvent@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwb_Warning_Pending>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <bwx_DEBUG@plt>
mov    $0x1,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <HasEvent@plt>

LLVM IR (-O0):
@__FUNCTION__.bwb_Warning_Pending = [20 x i8] c"bwb_Warning_Pending\00"
define i32 @bwb_Warning_Pending() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.bwb_Warning_Pending, i64 0, i64 0))
%2 = call i32 (i32, ...) bitcast (i32 (...)* @HasEvent to i32 (i32, ...)*)(i32 1)
ret i32 %2
}

LLVM IR (-O2):
@__FUNCTION__.bwb_Warning_Pending = [20 x i8] c"bwb_Warning_Pending\00"
define i32 @bwb_Warning_Pending() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.bwb_Warning_Pending, i64 0, i64 0))
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @HasEvent to i32 (i32, ...)*)(i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void closefiddle() {
  int i;
  for (i = 3; i < 8; i++)
    close(i);
}


x86 assembly (clang, -O0):
<closefiddle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    113f <closefiddle+0x2f>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <closefiddle+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closefiddle>:
push   %rax
mov    $0x3,%edi
call   1030 <close@plt>
mov    $0x4,%edi
call   1030 <close@plt>
mov    $0x5,%edi
call   1030 <close@plt>
mov    $0x6,%edi
call   1030 <close@plt>
mov    $0x7,%edi
pop    %rax
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @closefiddle() {
%1 = tail call i32 @close(i32 3)
%2 = tail call i32 @close(i32 4)
%3 = tail call i32 @close(i32 5)
%4 = tail call i32 @close(i32 6)
%5 = tail call i32 @close(i32 7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strrchr(char *, char);
void usage(char *name) {
  char *this;
  if ((this = strrchr(name, '/')) != NULL)
    name = this + 1;
  fprintf(stderr, ("usage: %s [ -n ] device\n"), name);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1164 <usage+0x34>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rdx
test   %rax,%rax
cmove  %rbx,%rdx
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s [ -n ] device\0A\00"
define void @usage(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 47)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %2
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s [ -n ] device\0A\00"
define void @usage(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int sqrt(int);
bool ispent(long i) {
  double ispent = (sqrt(1 + 24 * i) + 1) / 6;
  return ispent == (int)ispent;
}


x86 assembly (clang, -O0):
<ispent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
imul   $0x18,-0x8(%rbp),%rax
add    $0x1,%rax
mov    %eax,%edi
call   1030 <sqrt@plt>
add    $0x1,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispent>:
push   %rax
shl    $0x3,%edi
lea    (%rdi,%rdi,2),%edi
or     $0x1,%edi
call   1030 <sqrt@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ispent(i64 %0) {
%2 = alloca i64
%3 = alloca double
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul nsw i64 24, %4
%6 = add nsw i64 1, %5
%7 = trunc i64 %6 to i32
%8 = call i32 @sqrt(i32 %7)
%9 = add nsw i32 %8, 1
%10 = sdiv i32 %9, 6
%11 = sitofp i32 %10 to double
store double %11, double* %3
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fptosi double %13 to i32
%15 = sitofp i32 %14 to double
%16 = fcmp oeq double %12, %15
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @ispent(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = mul i32 %2, 24
%4 = or i32 %3, 1
%5 = tail call i32 @sqrt(i32 %4)
ret i32 1
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int EINTR;
int __syscall_ret(int);
int do_sigtimedwait(int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                    struct timespec const *);
int sigtimedwait(const sigset_t *restrict mask, siginfo_t *restrict si,
                 const struct timespec *restrict timeout) {
  int ret;
  do
    ret = do_sigtimedwait(mask, si, timeout);
  while (ret == -EINTR);
  return __syscall_ret(ret);
}


x86 assembly (clang, -O0):
<sigtimedwait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <do_sigtimedwait@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
xor    %ecx,%ecx
mov    0x2e8c(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
je     1134 <sigtimedwait+0x14>
mov    -0x1c(%rbp),%edi
call   1040 <__syscall_ret@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigtimedwait>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    0x2ea8(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <do_sigtimedwait@plt>
mov    (%r12),%ecx
add    %eax,%ecx
je     1140 <sigtimedwait+0x20>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <__syscall_ret@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@EINTR = global i32 0
define i32 @sigtimedwait(i32* noalias %0, i32* noalias %1, %struct.timespec* noalias %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca %struct.timespec*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store %struct.timespec* %2, %struct.timespec** %6
br label %8
8: ; preds = %13, %3
%9 = load i32*, i32** %4
%10 = load i32*, i32** %5
%11 = load %struct.timespec*, %struct.timespec** %6
%12 = call i32 @do_sigtimedwait(i32* %9, i32* %10, %struct.timespec* %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = load i32, i32* @EINTR
%16 = sub nsw i32 0, %15
%17 = icmp eq i32 %14, %16
br i1 %17, label %8, label %18
18: ; preds = %13
%19 = load i32, i32* %7
%20 = call i32 @__syscall_ret(i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@EINTR = global i32 0
define i32 @sigtimedwait(i32* noalias %0, i32* noalias %1, %struct.timespec* noalias %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @do_sigtimedwait(i32* %0, i32* %1, %struct.timespec* %2)
%6 = load i32, i32* @EINTR
%7 = sub nsw i32 0, %6
%8 = icmp eq i32 %5, %7
br i1 %8, label %4, label %9
9: ; preds = %4
%10 = tail call i32 @__syscall_ret(i32 %5)
ret i32 %10
}
int host_get_command() {
  int command;
  __asm__ __volatile__(".byte 0x0f, 0x3f\n"
                       ".byte 0x00, "
                       "0x00"
                       "\n"
                       ".byte "
                       "0x02"
                       ", 0x00\n"
                       ".byte 0x00, 0x00, 0x00\n"
                       ".byte 0x00\n"
                       : "=a"(command));
  return command;
}


x86 assembly (clang, -O0):
<host_get_command>:
push   %rbp
mov    %rsp,%rbp
(bad)
add    %al,(%rax)
add    (%rax),%al
add    %al,(%rax)
add    %al,(%rax)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_get_command>:
(bad)
add    %al,(%rax)
add    (%rax),%al
add    %al,(%rax)
add    %al,(%rax)
ret

LLVM IR (-O0):
define i32 @host_get_command() {
%1 = alloca i32
%2 = call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0x00\0A.byte 0x02, 0x00\0A.byte 0x00, 0x00, 0x00\0A.byte 0x00\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @host_get_command() {
%1 = tail call i32 asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0x00\0A.byte 0x02, 0x00\0A.byte 0x00, 0x00, 0x00\0A.byte 0x00\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i32 %1
}
int test_imm_58uint16_reg(unsigned short val) {
  return ((val) & (-0x58 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_58uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -88
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ a();
int main(void) { a(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <a@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @a()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @a()
ret i32 0
}
void f13() {
  int *x = 0;
  if (((((int)x) << 2) + 1) >> 1)
    *x = 1;
}


x86 assembly (clang, -O0):
<f13>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x2,%eax
add    $0x1,%eax
sar    $0x1,%eax
cmp    $0x0,%eax
je     112c <f13+0x2c>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f13() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
%3 = ptrtoint i32* %2 to i32
%4 = shl i32 %3, 2
%5 = add nsw i32 %4, 1
%6 = ashr i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = load i32*, i32** %1
store i32 1, i32* %9
br label %10
10: ; preds = %8, %0
ret void
}

LLVM IR (-O2):
define void @f13() {
ret void
}
void prctl(c) char c;
{
  if (c < ' ')
    printf("^%c", 'A' + c - 1);
  else if (c == 0177)
    printf("^?");
  else
    printf("%c", c);
}


x86 assembly (clang, -O0):
<prctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jge    1148 <prctl+0x38>
movsbl -0x1(%rbp),%esi
add    $0x41,%esi
sub    $0x1,%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117f <prctl+0x6f>
movsbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jne    1168 <prctl+0x58>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117a <prctl+0x6a>
movsbl -0x1(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117f <prctl+0x6f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prctl>:
movsbl %dil,%esi
shl    $0x18,%edi
cmp    $0x1fffffff,%edi
jg     1140 <prctl+0x20>
add    $0x40,%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
cmp    $0x7f000000,%edi
jne    1156 <prctl+0x36>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
mov    %esi,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"^?\00"
@.str.2 = [3 x i8] c"%c\00"
define void @prctl(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 32
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = add nsw i32 65, %9
%11 = sub nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %24
13: ; preds = %1
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 127
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %23
19: ; preds = %13
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %17
br label %24
24: ; preds = %23, %7
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"^?\00"
define void @prctl(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = icmp slt i32 %2, 536870912
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = add nsw i32 %3, 64
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %14
8: ; preds = %1
%9 = icmp eq i32 %2, 2130706432
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %8
%13 = tail call i32 @putchar(i32 %3)
br label %14
14: ; preds = %10, %12, %5
ret void
}
/* Type definitions */
struct virtio_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ virtio_reset_device(struct virtio_device *);
int /*<<< orphan*/ virtio_set_status(struct virtio_device *, int);
void virtioblk_shutdown(struct virtio_device *dev) {
  virtio_set_status(dev, 128);
  virtio_reset_device(dev);
}


x86 assembly (clang, -O0):
<virtioblk_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
call   1040 <virtio_set_status@plt>
mov    -0x8(%rbp),%rdi
call   1030 <virtio_reset_device@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<virtioblk_shutdown>:
push   %rbx
mov    %rdi,%rbx
mov    $0x80,%esi
call   1040 <virtio_set_status@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <virtio_reset_device@plt>

LLVM IR (-O0):
%struct.virtio_device = type { i32 }
define void @virtioblk_shutdown(%struct.virtio_device* %0) {
%2 = alloca %struct.virtio_device*
store %struct.virtio_device* %0, %struct.virtio_device** %2
%3 = load %struct.virtio_device*, %struct.virtio_device** %2
%4 = call i32 @virtio_set_status(%struct.virtio_device* %3, i32 128)
%5 = load %struct.virtio_device*, %struct.virtio_device** %2
%6 = call i32 @virtio_reset_device(%struct.virtio_device* %5)
ret void
}

LLVM IR (-O2):
%struct.virtio_device = type { i32 }
define void @virtioblk_shutdown(%struct.virtio_device* %0) {
%2 = tail call i32 @virtio_set_status(%struct.virtio_device* %0, i32 128)
%3 = tail call i32 @virtio_reset_device(%struct.virtio_device* %0)
ret void
}
/* Variables and functions */
void *serd_malloc_aligned(int, size_t const);
void *serd_allocate_buffer(const size_t size) {
  return serd_malloc_aligned(4096, size);
}


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

x86 assembly (clang, -O2):
<serd_allocate_buffer>:
mov    %rdi,%rsi
mov    $0x1000,%edi
jmp    1030 <serd_malloc_aligned@plt>

LLVM IR (-O0):
define i8* @serd_allocate_buffer(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @serd_malloc_aligned(i32 4096, i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @serd_allocate_buffer(i64 %0) {
%2 = tail call i8* @serd_malloc_aligned(i32 4096, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ destroy(void *);
int /*<<< orphan*/ free(void *);
void delete (void *obj) {
  if (obj)
    destroy(obj);
  free(obj);
}


x86 assembly (clang, -O0):
<delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1140 <delete+0x20>
mov    -0x8(%rbp),%rdi
call   1040 <destroy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1131 <delete+0x11>
mov    %rbx,%rdi
call   1040 <destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @delete(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @destroy(i8* %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @free(i8* %0)
ret void
}
float cosapprox(float val) {
  float val2 = val * val;
  return 0.999959766864776611328125f +
         val2 *
             (-0.4997930824756622314453125f +
              val2 *
                  (4.1496001183986663818359375e-2f +
                   val2 * (-1.33926304988563060760498046875e-3f +
                           val2 * 1.8791708498611114919185638427734375e-5f)));
}


x86 assembly (clang, -O0):
<cosapprox>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
movss  0xed8(%rip),%xmm4
mulss  %xmm4,%xmm3
movss  0xed0(%rip),%xmm4
addss  %xmm4,%xmm3
mulss  %xmm3,%xmm2
movss  0xeb8(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xea4(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xe90(%rip),%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosapprox>:
mulss  %xmm0,%xmm0
movss  0xef4(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xeec(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xee4(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xedc(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  0xed4(%rip),%xmm0
ret

LLVM IR (-O0):
define float @cosapprox(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float %4, %5
store float %6, float* %3
%7 = load float, float* %3
%8 = load float, float* %3
%9 = load float, float* %3
%10 = load float, float* %3
%11 = call float @llvm.fmuladd.f32(float %10, float 0x3EF3B45C60000000, float 0xBF55F146C0000000)
%12 = call float @llvm.fmuladd.f32(float %9, float %11, float 0x3FA53EF6C0000000)
%13 = call float @llvm.fmuladd.f32(float %8, float %12, float 0xBFDFFC9C20000000)
%14 = call float @llvm.fmuladd.f32(float %7, float %13, float 0x3FEFFFABA0000000)
ret float %14
}

LLVM IR (-O2):
define float @cosapprox(float %0) {
%2 = fmul float %0, %0
%3 = tail call float @llvm.fmuladd.f32(float %2, float 0x3EF3B45C60000000, float 0xBF55F146C0000000)
%4 = tail call float @llvm.fmuladd.f32(float %2, float %3, float 0x3FA53EF6C0000000)
%5 = tail call float @llvm.fmuladd.f32(float %2, float %4, float 0xBFDFFC9C20000000)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %5, float 0x3FEFFFABA0000000)
ret float %6
}
void ventana_emc_init(void) { return; }


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

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

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

LLVM IR (-O2):
define void @ventana_emc_init() {
ret void
}
void dsd_555_vco1_step(struct node_description *node) {}


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

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

LLVM IR (-O0):
%struct.node_description = type opaque
define void @dsd_555_vco1_step(%struct.node_description* %0) {
%2 = alloca %struct.node_description*
store %struct.node_description* %0, %struct.node_description** %2
ret void
}

LLVM IR (-O2):
%struct.node_description = type opaque
define void @dsd_555_vco1_step(%struct.node_description* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int n, int m) {
  unsigned i;
  for (i = 0; i < n; ++i) {
    int x;
    if (m < 0)
      x = 1 + n;
    else
      x = m - n;
    bar(x);
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1168 <foo+0x58>
cmpl   $0x0,-0x8(%rbp)
jge    1149 <foo+0x39>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <foo+0x42>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <bar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <foo+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     113c <foo+0x2c>
mov    %edi,%ebx
lea    0x1(%rbx),%eax
mov    %esi,%ebp
sub    %edi,%ebp
test   %esi,%esi
cmovs  %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <bar@plt>
add    $0xffffffff,%ebx
jne    1130 <foo+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = icmp slt i32 %1, 0
%6 = add nsw i32 %0, 1
%7 = sub nsw i32 %1, %0
%8 = select i1 %5, i32 %6, i32 %7
br label %9
9: ; preds = %4, %9
%10 = phi i32 [ 0, %4 ], [ %12, %9 ]
%11 = tail call i32 @bar(i32 %8)
%12 = add nuw i32 %10, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %9
14: ; preds = %9, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help_(char *node, char *def, int nodelen, int deflen) {
  printf("Help presently unavailable on unix.\n");
}


x86 assembly (clang, -O0):
<help_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [37 x i8] c"Help presently unavailable on unix.\0A\00"
define void @help_(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Help presently unavailable on unix.\00"
define void @help_(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct Buffer {
  int dummy;
};

/* Variables and functions */
size_t buffer_copy_logic(struct Buffer *, void *, size_t, int /*<<< orphan*/);
size_t buffer_copy(void *buf, void *data, size_t length) {
  struct Buffer *buffer = buf;
  return buffer_copy_logic(buffer, data, length, 0);
}


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

x86 assembly (clang, -O2):
<buffer_copy>:
xor    %ecx,%ecx
jmp    1030 <buffer_copy_logic@plt>

LLVM IR (-O0):
%struct.Buffer = type { i32 }
define i64 @buffer_copy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.Buffer*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to %struct.Buffer*
store %struct.Buffer* %9, %struct.Buffer** %7
%10 = load %struct.Buffer*, %struct.Buffer** %7
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = call i64 @buffer_copy_logic(%struct.Buffer* %10, i8* %11, i64 %12, i32 0)
ret i64 %13
}

LLVM IR (-O2):
%struct.Buffer = type { i32 }
define i64 @buffer_copy(i8* %0, i8* %1, i64 %2) {
%4 = bitcast i8* %0 to %struct.Buffer*
%5 = tail call i64 @buffer_copy_logic(%struct.Buffer* %4, i8* %1, i64 %2, i32 0)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ operation_sleep();
int /*<<< orphan*/ radio_power_off();
int /*<<< orphan*/ set_wakeup_timer(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
void operation_sleep_notimer(void) {
  radio_power_off();
  set_wakeup_timer(0, 0, 0);
  operation_sleep();
}


x86 assembly (clang, -O0):
<operation_sleep_notimer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <radio_power_off@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <set_wakeup_timer@plt>
mov    $0x0,%al
call   1040 <operation_sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_sleep_notimer>:
push   %rax
xor    %eax,%eax
call   1030 <radio_power_off@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <set_wakeup_timer@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <operation_sleep@plt>

LLVM IR (-O0):
define void @operation_sleep_notimer() {
%1 = call i32 (...) @radio_power_off()
%2 = call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = call i32 (...) @operation_sleep()
ret void
}

LLVM IR (-O2):
define void @operation_sleep_notimer() {
%1 = tail call i32 (...) @radio_power_off()
%2 = tail call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = tail call i32 (...) @operation_sleep()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct sha256_ctx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sha256_init(struct sha256_ctx *);
int /*<<< orphan*/ sha256_write_digest(struct sha256_ctx *, int,
                                       int /*<<< orphan*/ *);
void sha256_digest(void *ctx_, uint8_t *digest) {
  struct sha256_ctx *ctx = ctx_;
  sha256_write_digest(ctx, 32, digest);
  sha256_init(ctx);
}


x86 assembly (clang, -O0):
<sha256_digest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x20,%esi
call   1040 <sha256_write_digest@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sha256_init@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha256_digest>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    $0x20,%esi
call   1040 <sha256_write_digest@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <sha256_init@plt>

LLVM IR (-O0):
%struct.sha256_ctx = type { i32 }
define void @sha256_digest(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca %struct.sha256_ctx*
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.sha256_ctx*
store %struct.sha256_ctx* %7, %struct.sha256_ctx** %5
%8 = load %struct.sha256_ctx*, %struct.sha256_ctx** %5
%9 = load i32*, i32** %4
%10 = call i32 @sha256_write_digest(%struct.sha256_ctx* %8, i32 32, i32* %9)
%11 = load %struct.sha256_ctx*, %struct.sha256_ctx** %5
%12 = call i32 @sha256_init(%struct.sha256_ctx* %11)
ret void
}

LLVM IR (-O2):
%struct.sha256_ctx = type { i32 }
define void @sha256_digest(i8* %0, i32* %1) {
%3 = bitcast i8* %0 to %struct.sha256_ctx*
%4 = tail call i32 @sha256_write_digest(%struct.sha256_ctx* %3, i32 32, i32* %1)
%5 = tail call i32 @sha256_init(%struct.sha256_ctx* %3)
ret void
}
void V_bindtextureindex(unsigned int tex, unsigned int id) {}


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

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

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

LLVM IR (-O2):
define void @V_bindtextureindex(i32 %0, i32 %1) {
ret void
}
int main() {
  int r;
  __asm("movl $0x87654321, %%eax; movb $0x12, %%al; movb $0x34, %%ah"
        : "=a"(r));
  printf("%08X\n", r);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x87654321,%eax
mov    $0x12,%al
mov    $0x34,%ah
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x87654321,%eax
mov    $0x12,%al
mov    $0x34,%ah
lea    0xedf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%08X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 asm "movl $$0x87654321, %eax; movb $$0x12, %al; movb $$0x34, %ah", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%08X\0A\00"
define i32 @main() {
%1 = tail call i32 asm "movl $$0x87654321, %eax; movb $$0x12, %al; movb $$0x34, %ah", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ R0_RestoreConfig();
void R0_Wakeup(void) { R0_RestoreConfig(); }


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

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

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

LLVM IR (-O2):
define void @R0_Wakeup() {
%1 = tail call i32 (...) @R0_RestoreConfig()
ret void
}
/* Variables and functions */
int strlen(char *);
char *find(char *haystack, char needle) {
  int size;
  int answer;
  char row;
  char *base;
  int ct;
  size = strlen(haystack);
  for (ct = 0; ct < size; ct++) {
    if (haystack[ct] == needle) {
      answer = ct;
      break;
    } else {
      answer = -1;
    }
  }
  row = answer;
  base = &row;
  return base;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117e <find+0x6e>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1164 <find+0x54>
mov    -0x24(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    117e <find+0x6e>
movl   $0xffffffff,-0x14(%rbp)
jmp    1170 <find+0x60>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1135 <find+0x25>
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
lea    -0x15(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
push   %rax
call   1030 <strlen@plt>
lea    0x7(%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @find(i8* %0, i8 signext %1) {
%3 = alloca i8
%4 = tail call i32 @strlen(i8* %0)
ret i8* %3
}
/* Variables and functions */
double pow(double, double);
double calc_spacefactor(const unsigned char *aa0, int n0, int nm0, int nsq) {
  return pow(2.0, (double)nm0) - 1.0;
}


x86 assembly (clang, -O0):
<calc_spacefactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
call   1030 <pow@plt>
movsd  0xec1(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_spacefactor>:
push   %rax
mov    %edx,%edi
movsd  0xee5(%rip),%xmm0
call   1030 <ldexp@plt>
addsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @calc_spacefactor(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = sitofp i32 %9 to double
%11 = call double @pow(double 2.000000e+00, double %10)
%12 = fsub double %11, 1.000000e+00
ret double %12
}

LLVM IR (-O2):
define double @calc_spacefactor(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call double @ldexp(double 1.000000e+00, i32 %2)
%6 = fadd double %5, -1.000000e+00
ret double %6
}
int maximum1(int a) {
  int b = 0;
  int c = 0;
  return ((a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c));
}


x86 assembly (clang, -O0):
<maximum1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1149 <maximum1+0x49>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1138 <maximum1+0x38>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    113e <maximum1+0x3e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    116c <maximum1+0x6c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1160 <maximum1+0x60>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <maximum1+0x66>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maximum1>:
xor    %eax,%eax
test   %edi,%edi
cmovns %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @maximum1(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
ret i32 %3
}