xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ foo(char *, char *, char *, char *);
void f(void) {
  char buf[100] = "hello";
  foo(buf, "%s-%s", buf, "world");
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
movb   $0x68,-0x70(%rbp)
movb   $0x65,-0x6f(%rbp)
movb   $0x6c,-0x6e(%rbp)
movb   $0x6c,-0x6d(%rbp)
movb   $0x6f,-0x6c(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    0xea5(%rip),%rsi
lea    0xea4(%rip),%rcx
call   1040 <foo@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x6c6c6568,(%rsp)
movb   $0x6f,0x4(%rsp)
lea    0xeb1(%rip),%rsi
lea    0xeb0(%rip),%rcx
mov    %rsp,%rdi
mov    %rdi,%rdx
call   1030 <foo@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s-%s\00"
@.str.1 = [6 x i8] c"world\00"
define void @f() {
%1 = alloca [100 x i8]
%2 = bitcast [100 x i8]* %1 to i8*
%3 = bitcast i8* %2 to [100 x i8]*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i32 0, i32 0
store i8 104, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i32 0, i32 1
store i8 101, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i32 0, i32 2
store i8 108, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i32 0, i32 3
store i8 108, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i32 0, i32 4
store i8 111, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%11 = call i32 @foo(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s-%s\00"
@.str.1 = [6 x i8] c"world\00"
define void @f() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 104, i8* %2
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 101, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 2
store i8 108, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 4
store i8 111, i8* %6
%7 = call i32 @foo(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
bool clear_key_state(unsigned char *key_state, unsigned char keycode) {
  unsigned idx = keycode >> 3, bit = keycode & 7;
  bool prev = key_state[idx] & (1 << bit);
  key_state[idx] &= ~(1 << bit);
  return prev;
}


x86 assembly (clang, -O0):
<clear_key_state>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x10(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
xor    $0xffffffff,%esi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
and    %esi,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_key_state>:
mov    %esi,%ecx
mov    %esi,%edx
shr    $0x3,%rdx
movzbl (%rdi,%rdx,1),%r8d
and    $0x7,%cl
mov    $0x1,%esi
shl    %cl,%esi
mov    %r8d,%eax
and    %esi,%eax
not    %sil
and    %r8b,%sil
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define i32 @clear_key_state(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = ashr i32 %9, 3
store i32 %10, i32* %5
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = and i32 %12, 7
store i32 %13, i32* %6
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = load i32, i32* %6
%21 = shl i32 1, %20
%22 = and i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = shl i32 1, %23
%25 = xor i32 %24, -1
%26 = load i8*, i8** %3
%27 = load i32, i32* %5
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, %25
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
%34 = load i32, i32* %7
ret i32 %34
}

LLVM IR (-O2):
define i32 @clear_key_state(i8* nocapture %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = lshr i32 %3, 3
%5 = and i32 %3, 7
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl nuw nsw i32 1, %5
%11 = and i32 %10, %9
%12 = trunc i32 %10 to i8
%13 = xor i8 %12, -1
%14 = and i8 %8, %13
store i8 %14, i8* %7
ret i32 %11
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ ui32Base;

/* Variables and functions */
void PWMGenEnable(uint32_t ui32Base, uint32_t ui32Gen) {
  ;
  ;
  (*((volatile unsigned long *)(((ui32Base) + (ui32Gen)) + 0x00000000))) |=
      0x00000001;
}


x86 assembly (clang, -O0):
<PWMGenEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenEnable>:
orq    $0x1,(%rsi,%rdi,1)
ret

LLVM IR (-O0):
define void @PWMGenEnable(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 = add nsw i64 %5, %6
%8 = add nsw i64 %7, 0
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = or i64 %10, 1
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @PWMGenEnable(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = or i64 %5, 1
store volatile i64 %6, i64* %4
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main() {
  char ch;
  printf("Press a key and then press Enter: ");
  ch = getchar();
  printf("You pressed ");
  putchar(ch);
  putchar('\n');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Press a key and then press Enter: \00"
@.str.1 = [13 x i8] c"You pressed \00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8, i8* %1
%6 = call i32 @putchar(i8 signext %5)
%7 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Press a key and then press Enter: \00"
@.str.1 = [13 x i8] c"You pressed \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @putchar(i8 signext %2)
%5 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}
/* Variables and functions */
int __ffsll(long);
__attribute__((always_)) int __ffsl(long value) { return __ffsll(value); }


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

x86 assembly (clang, -O2):
<__ffsl>:
jmp    1030 <__ffsll@plt>

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

LLVM IR (-O2):
define i32 @__ffsl(i64 %0) {
%2 = tail call i32 @__ffsll(i64 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void timer(int value) {
  if (value != 23) {
    printf("FAIL: bad timer value\n");
    exit(1);
  }
  printf("FAIL: didn't get all expose and viewable calls in 45 seconds\n");
  exit(1);
}


x86 assembly (clang, -O0):
<timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x17,-0x4(%rbp)
je     114b <timer+0x2b>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<timer>:
push   %rax
cmp    $0x17,%edi
jne    112f <timer+0xf>
lea    0xed3(%rip),%rdi
jmp    1136 <timer+0x16>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"FAIL: bad timer value\0A\00"
@.str.1 = [62 x i8] c"FAIL: didn't get all expose and viewable calls in 45 seconds\0A\00"
define void @timer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 23
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [61 x i8] c"FAIL: didn't get all expose and viewable calls in 45 seconds\00"
@str.2 = [22 x i8] c"FAIL: bad timer value\00"
define void @timer(i32 %0) {
%2 = icmp eq i32 %0, 23
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int strcasecmp(char const *, char const *);
int isaac_strcasecmp(const char *s1, const char *s2) {
  if (!s1 || !s2)
    return 1;
  return strcasecmp(s1, s2);
}


x86 assembly (clang, -O0):
<isaac_strcasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <isaac_strcasecmp+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <isaac_strcasecmp+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1152 <isaac_strcasecmp+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isaac_strcasecmp>:
test   %rdi,%rdi
je     111f <isaac_strcasecmp+0xf>
test   %rsi,%rsi
je     111f <isaac_strcasecmp+0xf>
jmp    1030 <strcasecmp@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isaac_strcasecmp(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcasecmp(i8* %0, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ poe_isstartbrace(char);
int poe_isnotstartbrace(char c) { return !poe_isstartbrace(c); }


x86 assembly (clang, -O0):
<poe_isnotstartbrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <poe_isstartbrace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poe_isnotstartbrace>:
push   %rax
call   1030 <poe_isstartbrace@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @poe_isnotstartbrace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @poe_isstartbrace(i8 signext %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @poe_isnotstartbrace(i8 signext %0) {
%2 = tail call i32 @poe_isstartbrace(i8 signext %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ ascii_islower(int);
int ascii_toupper(int c) {
  if (ascii_islower(c))
    return c & ~32;
  return c;
}


x86 assembly (clang, -O0):
<ascii_toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ascii_islower@plt>
cmp    $0x0,%rax
je     113b <ascii_toupper+0x2b>
mov    -0x8(%rbp),%eax
and    $0xffffffdf,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <ascii_toupper+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <ascii_islower@plt>
mov    %ebx,%ecx
and    $0xffffffdf,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ascii_toupper(i32 %0) {
%2 = tail call i64 @ascii_islower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = and i32 %0, -33
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ *cl_device_id;
typedef int /*<<< orphan*/ cl_context;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int GetDevice(cl_device_id *dev, cl_context ctx) {
  assert(*dev != NULL);
  return 0;
}


x86 assembly (clang, -O0):
<GetDevice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetDevice>:
push   %rax
xor    %eax,%eax
cmpq   $0x0,(%rdi)
setne  %al
mov    %eax,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @GetDevice(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** %5
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @GetDevice(i32** nocapture %0, i32 %1) {
%3 = load i32*, i32** %0
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void h_defaults() {
  printf("\tDefault players are Amanda and Ben the computer team against Chris "
         "the human and Michelle.\n");
}


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

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

LLVM IR (-O0):
@.str = [93 x i8] c"\09Default players are Amanda and Ben the computer team against Chris the human and Michelle.\0A\00"
define void @h_defaults() {
%1 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [92 x i8] c"\09Default players are Amanda and Ben the computer team against Chris the human and Michelle.\00"
define void @h_defaults() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int alu_tge(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ op_pop();
int op_tge() { return alu_tge(op_pop(), op_pop()); }


x86 assembly (clang, -O0):
<op_tge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <op_pop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <op_pop@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1030 <alu_tge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_tge>:
push   %rbx
xor    %eax,%eax
call   1040 <op_pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <op_pop@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <alu_tge@plt>

LLVM IR (-O0):
define i32 @op_tge() {
%1 = call i32 (...) @op_pop()
%2 = call i32 (...) @op_pop()
%3 = call i32 @alu_tge(i32 %1, i32 %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @op_tge() {
%1 = tail call i32 (...) @op_pop()
%2 = tail call i32 (...) @op_pop()
%3 = tail call i32 @alu_tge(i32 %1, i32 %2)
ret i32 %3
}
void f(int sz) { int arr[sz]; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i32, i64 %6
store i64 %6, i64* %4
%9 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void error() {
  fprintf(stderr, "Usage: sampack -d|-k infile outfile\n");
  fprintf(stderr, "Sample packer by Georges.Kesseler@restena.lu\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: sampack -d|-k infile outfile\0A\00"
@.str.1 = [46 x i8] c"Sample packer by Georges.Kesseler@restena.lu\0A\00"
define void @error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: sampack -d|-k infile outfile\0A\00"
@.str.1 = [46 x i8] c"Sample packer by Georges.Kesseler@restena.lu\0A\00"
define void @error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
int check_ip(int n, const int *ip, int iq) {
  int i;
  for (i = 0; i < n; i++) {
    if (ip[i] == iq)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_ip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <check_ip+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1141 <check_ip+0x41>
movl   $0x1,-0x4(%rbp)
jmp    115b <check_ip+0x5b>
jmp    1146 <check_ip+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <check_ip+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_ip>:
test   %edi,%edi
jle    111e <check_ip+0x1e>
mov    %edi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %edx,(%rsi,%rcx,4)
je     1121 <check_ip+0x21>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <check_ip+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_ip(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %14, %6
br i1 %8, label %15, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %14, %7 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %2
%14 = add nuw nsw i64 %10, 1
br i1 %13, label %15, label %7
15: ; preds = %9, %7, %3
%16 = phi i32 [ 0, %3 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void write_lines(char *lines[], int num_lines) {
  for (int i = 0; i < num_lines; ++i) {
    puts(lines[i]);
  }
}


x86 assembly (clang, -O0):
<write_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <write_lines+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <write_lines+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_lines>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1142 <write_lines+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <write_lines+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @write_lines(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ NOP();
int /*<<< orphan*/ save_state();
int /*<<< orphan*/ test_PC_was_increased();
int /*<<< orphan*/ test_accumulator_was_untouched();
int /*<<< orphan*/ test_mem_was_untouched();
void test_NOP() {
  save_state();
  NOP();
  test_accumulator_was_untouched();
  test_mem_was_untouched();
  test_PC_was_increased();
}


x86 assembly (clang, -O0):
<test_NOP>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <save_state@plt>
mov    $0x0,%al
call   1030 <NOP@plt>
mov    $0x0,%al
call   1070 <test_accumulator_was_untouched@plt>
mov    $0x0,%al
call   1040 <test_mem_was_untouched@plt>
mov    $0x0,%al
call   1060 <test_PC_was_increased@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_NOP>:
push   %rax
xor    %eax,%eax
call   1050 <save_state@plt>
xor    %eax,%eax
call   1030 <NOP@plt>
xor    %eax,%eax
call   1070 <test_accumulator_was_untouched@plt>
xor    %eax,%eax
call   1040 <test_mem_was_untouched@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <test_PC_was_increased@plt>

LLVM IR (-O0):
define void @test_NOP() {
%1 = call i32 (...) @save_state()
%2 = call i32 (...) @NOP()
%3 = call i32 (...) @test_accumulator_was_untouched()
%4 = call i32 (...) @test_mem_was_untouched()
%5 = call i32 (...) @test_PC_was_increased()
ret void
}

LLVM IR (-O2):
define void @test_NOP() {
%1 = tail call i32 (...) @save_state()
%2 = tail call i32 (...) @NOP()
%3 = tail call i32 (...) @test_accumulator_was_untouched()
%4 = tail call i32 (...) @test_mem_was_untouched()
%5 = tail call i32 (...) @test_PC_was_increased()
ret void
}
int av_delay_video(int usec) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @av_delay_video(i32 %0) {
ret i32 0
}
void null_eject(void) {}


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

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

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

LLVM IR (-O2):
define void @null_eject() {
ret void
}
int math_crash(int x, int y) { return x / y; }


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

x86 assembly (clang, -O2):
<math_crash>:
mov    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @math_crash(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ write(int, int *, int);
void serial_send(int fd, uint32_t value) {
  uint8_t send[5];
  send[0] = 1;
  memcpy(&send[1], &value, 4);
  write(fd, send, 5);
}


x86 assembly (clang, -O0):
<serial_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
add    $0x4,%rdi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_send>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
mov    %esi,0xc(%rsp)
movl   $0x1,0x10(%rsp)
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x5,%edx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @serial_send(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%8 = call i32 @memcpy(i32* %7, i32* %4, i32 4)
%9 = load i32, i32* %3
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%11 = call i32 @write(i32 %9, i32* %10, i32 5)
ret void
}

LLVM IR (-O2):
define void @serial_send(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [5 x i32]
store i32 %1, i32* %3
%5 = bitcast [5 x i32]* %4 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 1
%8 = call i32 @memcpy(i32* %7, i32* %3, i32 4)
%9 = call i32 @write(i32 %0, i32* %6, i32 5)
ret void
}
/* Variables and functions */
int exemplo1();
int exemplo2(int);
int exemplo3();
int exemplo4(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%i\n", exemplo1());
  printf("%i\n", exemplo2(2));
  printf("%i\n", exemplo3());
  printf("%i\n", exemplo4(2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <exemplo1@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1070 <exemplo2@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <exemplo3@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1060 <exemplo4@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <exemplo1@plt>
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1070 <exemplo2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <exemplo3@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1060 <exemplo4@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = call i32 (...) @exemplo1()
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @exemplo2(i32 2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @exemplo3()
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @exemplo4(i32 2)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @exemplo1()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @exemplo2(i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @exemplo3()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exemplo4(i32 2)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void sc_cleanup_string(char **ptr) {
  if (ptr != NULL && *ptr != NULL) {
    free(*ptr);
    *ptr = NULL;
  }
}


x86 assembly (clang, -O0):
<sc_cleanup_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <sc_cleanup_string+0x3c>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114c <sc_cleanup_string+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_cleanup_string>:
push   %rbx
test   %rdi,%rdi
je     112d <sc_cleanup_string+0x1d>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112d <sc_cleanup_string+0x1d>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @sc_cleanup_string(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 %14
5: ; preds = %1
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = call i32 @free(i8* %11)
%13 = load i8**, i8*** %2
store i8* null, i8** %13
br label %14
14: ; preds = %9, %5, %1
ret void
}

LLVM IR (-O2):
define void @sc_cleanup_string(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @free(i8* %4)
store i8* null, i8** %0
br label %8
8: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
extern int TakeSizeT(size_t x) {
  if (x == 42)
    return 13;
  return 0;
}


x86 assembly (clang, -O0):
<TakeSizeT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x2a,-0x10(%rbp)
jne    111f <TakeSizeT+0x1f>
movl   $0xd,-0x4(%rbp)
jmp    1126 <TakeSizeT+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TakeSizeT>:
xor    %ecx,%ecx
cmp    $0x2a,%rdi
mov    $0xd,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @TakeSizeT(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 42
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 13, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @TakeSizeT(i64 %0) {
%2 = icmp eq i64 %0, 42
%3 = select i1 %2, i32 13, i32 0
ret i32 %3
}
/* Variables and functions */
scalar_t__ my_gettid();
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ sleep(int);
void *slow_action(void *arg) {
  printf("my pthread:%ld\n", (long)my_gettid());
  sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<slow_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <my_gettid@plt>
mov    %rax,%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slow_action>:
push   %rax
xor    %eax,%eax
call   1040 <my_gettid@plt>
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"my pthread:%ld\0A\00"
define i8* @slow_action(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @my_gettid()
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = call i32 @sleep(i32 1)
ret i8* null
}

LLVM IR (-O2):
@.str = [16 x i8] c"my pthread:%ld\0A\00"
define noalias i8* @slow_action(i8* nocapture readnone %0) {
%2 = tail call i64 (...) @my_gettid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @sleep(i32 1)
ret i8* null
}
/* Type definitions */
struct stack_st_OPENSSL_BLOCK {
  int dummy;
};
typedef int /*<<< orphan*/ OPENSSL_STACK;

/* Variables and functions */
scalar_t__ OPENSSL_sk_pop(int /*<<< orphan*/ *);
void *sk_OPENSSL_BLOCK_pop(struct stack_st_OPENSSL_BLOCK *sk) {
  return (void *)OPENSSL_sk_pop((OPENSSL_STACK *)sk);
}


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

x86 assembly (clang, -O2):
<sk_OPENSSL_BLOCK_pop>:
jmp    1030 <OPENSSL_sk_pop@plt>

LLVM IR (-O0):
%struct.stack_st_OPENSSL_BLOCK = type { i32 }
define i8* @sk_OPENSSL_BLOCK_pop(%struct.stack_st_OPENSSL_BLOCK* %0) {
%2 = alloca %struct.stack_st_OPENSSL_BLOCK*
store %struct.stack_st_OPENSSL_BLOCK* %0, %struct.stack_st_OPENSSL_BLOCK** %2
%3 = load %struct.stack_st_OPENSSL_BLOCK*, %struct.stack_st_OPENSSL_BLOCK** %2
%4 = bitcast %struct.stack_st_OPENSSL_BLOCK* %3 to i32*
%5 = call i64 @OPENSSL_sk_pop(i32* %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
%struct.stack_st_OPENSSL_BLOCK = type { i32 }
define i8* @sk_OPENSSL_BLOCK_pop(%struct.stack_st_OPENSSL_BLOCK* %0) {
%2 = getelementptr %struct.stack_st_OPENSSL_BLOCK, %struct.stack_st_OPENSSL_BLOCK* %0, i64 0, i32 0
%3 = tail call i64 @OPENSSL_sk_pop(i32* %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char, char, char *);
void settings_directory_name(char *directory) {
  sprintf(directory, "%s%c.config%c%s", getenv("HOME"), '/', '/',
          "packagemonkey");
}


x86 assembly (clang, -O0):
<settings_directory_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rdx
lea    0xeb2(%rip),%rsi
mov    $0x2f,%r8d
lea    0xeba(%rip),%r9
mov    %r8d,%ecx
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settings_directory_name>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <getenv@plt>
lea    0xec9(%rip),%rsi
lea    0xed7(%rip),%r9
mov    %rbx,%rdi
mov    %rax,%rdx
mov    $0x2f,%ecx
mov    $0x2f,%r8d
pop    %rbx
jmp    1040 <sprintf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%s%c.config%c%s\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [14 x i8] c"packagemonkey\00"
define void @settings_directory_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4, i8 signext 47, i8 signext 47, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s%c.config%c%s\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [14 x i8] c"packagemonkey\00"
define void @settings_directory_name(i8* nocapture writeonly %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %2, i8 signext 47, i8 signext 47, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct Var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pA(char *, char const *, char const *, char const *);
void __func_mod_sint(struct Var *avar, const char *areg, const char *lreg,
                     const char *rreg) {
  pA("%s = %s %% %s;", areg, lreg, rreg);
}


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

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

LLVM IR (-O0):
%struct.Var = type { i32 }
@.str = [15 x i8] c"%s = %s %% %s;\00"
define void @__func_mod_sint(%struct.Var* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.Var*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.Var* %0, %struct.Var** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = load i8*, i8** %8
%12 = call i32 @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
ret void
}

LLVM IR (-O2):
%struct.Var = type { i32 }
@.str = [15 x i8] c"%s = %s %% %s;\00"
define void @__func_mod_sint(%struct.Var* nocapture readnone %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int max31855_check_failures(uint32_t val) {
  int retval = 0;
  if ((val & 0x10000)) {
    if (val & 0x1) {
      retval = -1;
    }
    if (val & 0x2) {
      retval = -2;
    }
    if (val & 0x4) {
      retval = -3;
    }
  }
  return retval;
}


x86 assembly (clang, -O0):
<max31855_check_failures>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x10000,%eax
cmp    $0x0,%eax
je     1166 <max31855_check_failures+0x66>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1135 <max31855_check_failures+0x35>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     114b <max31855_check_failures+0x4b>
movl   $0xfffffffe,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1161 <max31855_check_failures+0x61>
movl   $0xfffffffd,-0x8(%rbp)
jmp    1166 <max31855_check_failures+0x66>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max31855_check_failures>:
xor    %eax,%eax
test   $0x10000,%edi
je     1129 <max31855_check_failures+0x29>
mov    %edi,%eax
and    $0x1,%eax
neg    %eax
test   $0x2,%dil
mov    $0xfffffffe,%ecx
cmove  %eax,%ecx
test   $0x4,%dil
mov    $0xfffffffd,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @max31855_check_failures(i32 %0) {
%2 = and i32 %0, 65536
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = and i32 %0, 1
%6 = sub nsw i32 0, %5
%7 = and i32 %0, 2
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 %6, i32 -2
%10 = and i32 %0, 4
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 %9, i32 -3
br label %13
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %12, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ called_in_loop();
int main(int argc, char **argv) {
  int i;
  for (i = 0; i < 3; i++) {
    called_in_loop();
  }
  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   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    114c <main+0x3c>
mov    $0x0,%al
call   1030 <called_in_loop@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @called_in_loop()
%4 = tail call i32 (...) @called_in_loop()
%5 = tail call i32 (...) @called_in_loop()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello, world!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world!\0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world!\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}