xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sigchld_handler(int s) {
  while (waitpid(-1, NULL, WNOHANG) > 0) {
    printf("child process terminated (%d).\n", s);
  }
}


x86 assembly (clang, -O0):
<sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <waitpid@plt>
cmp    $0x0,%rax
jle    1160 <sigchld_handler+0x40>
mov    -0x4(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    112b <sigchld_handler+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2eba(%rip),%r15
mov    (%r15),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
test   %rax,%rax
jle    116e <sigchld_handler+0x4e>
lea    0xeb7(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
test   %rax,%rax
jg     1150 <sigchld_handler+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
@.str = [32 x i8] c"child process terminated (%d).\0A\00"
define void @sigchld_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %3
10: ; preds = %3
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [32 x i8] c"child process terminated (%d).\0A\00"
define void @sigchld_handler(i32 %0) {
%2 = load i32, i32* @WNOHANG
%3 = tail call i64 @waitpid(i32 -1, i32* null, i32 %2)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1, %5
%6 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = load i32, i32* @WNOHANG
%8 = tail call i64 @waitpid(i32 -1, i32* null, i32 %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %1
ret void
}
void rop3_156_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = T & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


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

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

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

LLVM IR (-O2):
define void @rop3_156_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = xor i8 %5, -1
%7 = and i8 %6, %2
%8 = and i8 %4, %1
%9 = or i8 %7, %8
store i8 %9, i8* %0
ret void
}
void GPMCTimeOutStartValSet(unsigned int baseAddr, unsigned int timeoutVal) {
  (*((volatile unsigned int *)(baseAddr + (0x40)))) &= ~(0x00001FF0u);
  (*((volatile unsigned int *)(baseAddr + (0x40)))) |=
      ((timeoutVal << (0x00000004u)) & (0x00001FF0u));
}


x86 assembly (clang, -O0):
<GPMCTimeOutStartValSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffffe00f,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
shl    $0x4,%edx
and    $0x1ff0,%edx
mov    -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCTimeOutStartValSet>:
add    $0x40,%edi
andl   $0xffffe00f,(%rdi)
shl    $0x4,%esi
and    $0x1ff0,%esi
or     %esi,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCTimeOutStartValSet(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 = add i32 %5, 64
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -8177
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = shl i32 %11, 4
%13 = and i32 %12, 8176
%14 = load i32, i32* %3
%15 = add i32 %14, 64
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = or i32 %18, %13
store volatile i32 %19, i32* %17
ret void
}

LLVM IR (-O2):
define void @GPMCTimeOutStartValSet(i32 %0, i32 %1) {
%3 = add i32 %0, 64
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -8177
store volatile i32 %7, i32* %5
%8 = shl i32 %1, 4
%9 = and i32 %8, 8176
%10 = load volatile i32, i32* %5
%11 = or i32 %10, %9
store volatile i32 %11, i32* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_getdetachstate(int /*<<< orphan*/ *, int *);
int my_pthread_attr_getdetachstate(pthread_attr_t const *__attr, int *state) {
  pthread_attr_t *realattr = (pthread_attr_t *)*(int *)__attr;
  return pthread_attr_getdetachstate(realattr, state);
}


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

x86 assembly (clang, -O2):
<my_pthread_attr_getdetachstate>:
movslq (%rdi),%rdi
jmp    1030 <pthread_attr_getdetachstate@plt>

LLVM IR (-O0):
define i32 @my_pthread_attr_getdetachstate(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load i32*, i32** %4
%12 = call i32 @pthread_attr_getdetachstate(i32* %10, i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @my_pthread_attr_getdetachstate(i32* nocapture %0, i32* %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @pthread_attr_getdetachstate(i32* %5, i32* %1)
ret i32 %6
}
int C$_Link(const char *input, const char *lnk) {
  int val = link(input, lnk);
  if (val == -1) {
    perror("ca$h: ERROR link");
  }
  return val;
}


x86 assembly (clang, -O0):
<C$_Link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <link@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    115a <C$_Link+0x3a>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C$_Link>:
push   %rbx
xor    %eax,%eax
call   1040 <link@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    113d <C$_Link+0x1d>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <perror@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"ca$h: ERROR link\00"
define i32 @"C$_Link"(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
@.str = [17 x i8] c"ca$h: ERROR link\00"
define i32 @"C$_Link"(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
uint32_t bitCount_fun_int8_t(int8_t x) {
  uint32_t r = x & 1;
  for (x = x >> 1 & 0x7f; x; x >>= 1)
    r += x & 1;
  return r;
}


x86 assembly (clang, -O0):
<bitCount_fun_int8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
and    $0x7f,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1140 <bitCount_fun_int8_t+0x40>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111c <bitCount_fun_int8_t+0x1c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitCount_fun_int8_t>:
mov    %edi,%eax
and    $0x1,%eax
shr    %edi
and    $0x7f,%edi
je     1120 <bitCount_fun_int8_t+0x20>
mov    %edi,%ecx
xchg   %ax,%ax
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <bitCount_fun_int8_t+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitCount_fun_int8_t(i32 %0) {
%2 = and i32 %0, 1
%3 = lshr i32 %0, 1
%4 = and i32 %3, 127
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %10, %6 ], [ %2, %1 ]
%8 = phi i32 [ %11, %6 ], [ %4, %1 ]
%9 = and i32 %8, 1
%10 = add nuw nsw i32 %7, %9
%11 = lshr i32 %8, 1
%12 = icmp ult i32 %8, 2
br i1 %12, label %13, label %6
13: ; preds = %6, %1
%14 = phi i32 [ %2, %1 ], [ %10, %6 ]
ret i32 %14
}
int *foo(int *x, int b) {
  *(x++) = 55;
  if (b)
    *(x++) = b;
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
movl   $0x37,(%rax)
cmpl   $0x0,-0xc(%rbp)
je     113e <foo+0x3e>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rax
movl   $0x37,(%rdi)
test   %esi,%esi
je     1115 <foo+0x15>
mov    %esi,0x4(%rax)
add    $0x8,%rax
ret
add    $0x4,%rax
ret

LLVM IR (-O0):
define i32* @foo(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 = getelementptr inbounds i32, i32* %5, i32 1
store i32* %6, i32** %3
store i32 55, i32* %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %3
store i32 %10, i32* %11
br label %13
13: ; preds = %9, %2
%14 = load i32*, i32** %3
ret i32* %14
}

LLVM IR (-O2):
define i32* @foo(i32* writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
store i32 55, i32* %0
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %1, i32* %3
br label %7
7: ; preds = %5, %2
%8 = phi i32* [ %6, %5 ], [ %3, %2 ]
ret i32* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ outTimeout;

/* Variables and functions */
int /*<<< orphan*/ FifoProtocol_memcpy(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ const *, int);
uint16_t inv_fifo_protocol_helper_encode_timeout(uint32_t timeout,
                                                 uint8_t *out) {
  const uint32_t outTimeout = timeout;
  FifoProtocol_memcpy((out), (&outTimeout), (sizeof(outTimeout)));
  return 4;
}


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

x86 assembly (clang, -O2):
<inv_fifo_protocol_helper_encode_timeout>:
push   %rax
mov    %rsi,%rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
mov    $0x4,%edx
call   1030 <FifoProtocol_memcpy@plt>
mov    $0x4,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @inv_fifo_protocol_helper_encode_timeout(i32 %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 %0, i32* %3
%5 = call i32 @FifoProtocol_memcpy(i32* %1, i32* %3, i32 4)
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ str_ltrim(char *, char const *);
int /*<<< orphan*/ str_rtrim(char *, char const *);
void str_lrtrim(char *str, const char *charlist) {
  str_rtrim(str, charlist);
  str_ltrim(str, charlist);
}


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

x86 assembly (clang, -O2):
<str_lrtrim>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <str_rtrim@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <str_ltrim@plt>

LLVM IR (-O0):
define void @str_lrtrim(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @str_rtrim(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @str_ltrim(i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
define void @str_lrtrim(i8* %0, i8* %1) {
%3 = tail call i32 @str_rtrim(i8* %0, i8* %1)
%4 = tail call i32 @str_ltrim(i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int get_reply(char const *, int, unsigned char *, size_t *);
int /*<<< orphan*/ print_console(unsigned char *, size_t);
void print_reply(const char *ifname, int count) {
  unsigned char buf[512];
  size_t len;
  while (1) {
    len = sizeof(buf);
    if (get_reply(ifname, 5, buf, &len) == -1)
      break;
    print_console(buf, len);
  }
}


x86 assembly (clang, -O0):
<print_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x200,-0x218(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rdx
mov    $0x5,%esi
lea    -0x218(%rbp),%rcx
call   1030 <get_reply@plt>
cmp    $0xffffffff,%eax
jne    1167 <print_reply+0x47>
jmp    117f <print_reply+0x5f>
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rsi
call   1040 <print_console@plt>
jmp    1132 <print_reply+0x12>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_reply>:
push   %r15
push   %r14
push   %rbx
sub    $0x210,%rsp
mov    %rdi,%r14
movq   $0x200,0x8(%rsp)
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    $0x5,%esi
call   1030 <get_reply@plt>
cmp    $0xffffffff,%eax
je     118e <print_reply+0x6e>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <print_console@plt>
movq   $0x200,0x8(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1030 <get_reply@plt>
cmp    $0xffffffff,%eax
jne    1160 <print_reply+0x40>
add    $0x210,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @print_reply(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [512 x i8]
%6 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %7
7: ; preds = %2, %13
store i64 512, i64* %6
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = call i32 @get_reply(i8* %8, i32 5, i8* %9, i64* %6)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %7
br label %17
13: ; preds = %7
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%15 = load i64, i64* %6
%16 = call i32 @print_console(i8* %14, i64 %15)
br label %7
17: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @print_reply(i8* %0, i32 %1) {
%3 = alloca [512 x i8]
%4 = alloca i64
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = bitcast i64* %4 to i8*
store i64 512, i64* %4
%7 = call i32 @get_reply(i8* %0, i32 5, i8* %5, i64* %4)
%8 = icmp eq i32 %7, -1
br i1 %8, label %14, label %9
9: ; preds = %2, %9
%10 = load i64, i64* %4
%11 = call i32 @print_console(i8* %5, i64 %10)
store i64 512, i64* %4
%12 = call i32 @get_reply(i8* %0, i32 5, i8* %5, i64* %4)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %9
14: ; preds = %9, %2
ret void
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int edi_read(struct flashrom_flashctx *, int, unsigned char *);
int edi_spi_busy(struct flashrom_flashctx *flash) {
  unsigned char buffer;
  int rc;
  rc = edi_read(flash, 0xfead, &buffer);
  if (rc < 0)
    return -1;
  return !!(buffer & (1 << 1));
}


x86 assembly (clang, -O0):
<edi_spi_busy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xfead,%esi
lea    -0x11(%rbp),%rdx
call   1030 <edi_read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1147 <edi_spi_busy+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <edi_spi_busy+0x50>
movzbl -0x11(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edi_spi_busy>:
push   %rax
lea    0x7(%rsp),%rdx
mov    $0xfead,%esi
call   1030 <edi_read@plt>
movzbl 0x7(%rsp),%ecx
shr    %ecx
and    $0x1,%ecx
test   %eax,%eax
mov    $0xffffffff,%eax
cmovns %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @edi_spi_busy(%struct.flashrom_flashctx* %0) {
%2 = alloca i32
%3 = alloca %struct.flashrom_flashctx*
%4 = alloca i8
%5 = alloca i32
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %3
%6 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %3
%7 = call i32 @edi_read(%struct.flashrom_flashctx* %6, i32 65197, i8* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %19
11: ; preds = %1
%12 = load i8, i8* %4
%13 = zext i8 %12 to i32
%14 = and i32 %13, 2
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
store i32 %18, i32* %2
br label %19
19: ; preds = %11, %10
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @edi_spi_busy(%struct.flashrom_flashctx* %0) {
%2 = alloca i8
%3 = call i32 @edi_read(%struct.flashrom_flashctx* %0, i32 65197, i8* %2)
%4 = load i8, i8* %2
%5 = lshr i8 %4, 1
%6 = and i8 %5, 1
%7 = zext i8 %6 to i32
%8 = icmp sgt i32 %3, -1
%9 = select i1 %8, i32 %7, i32 -1
ret i32 %9
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
scalar_t__ stat(char *, struct stat *);
int main(void) {
  struct stat buf;
  if (stat(".", &buf) != 0 || !S_ISDIR(buf.st_mode))
    abort();
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%rax
jne    118a <main+0x3a>
mov    -0x8(%rbp),%edi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1191 <main+0x41>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
mov    %rsp,%rsi
call   1060 <stat@plt>
test   %rax,%rax
jne    1171 <main+0x21>
mov    (%rsp),%edi
call   1050 <S_ISDIR@plt>
test   %eax,%eax
jne    1178 <main+0x28>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
store i32 0, i32* %1
%3 = call i64 @stat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @S_ISDIR(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %5
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [2 x i8] c".\00"
@str = [5 x i8] c"pass\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @stat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @S_ISDIR(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %5
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *ret = malloc(size);
  if (!ret)
    die("Out of memory; malloc failed");
  return ret;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Out of memory; malloc failed\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [29 x i8] c"Out of memory; malloc failed\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int main() { return sizeof(unsigned); }


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

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

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

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

/* Variables and functions */
unsigned int uStrLen(const wchar_t *u) {
  int i = 0;
  if (u == NULL)
    return 0;
  while (*u != (wchar_t)0) {
    u++;
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<uStrLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <uStrLen+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1159 <uStrLen+0x59>
jmp    112b <uStrLen+0x2b>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1153 <uStrLen+0x53>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <uStrLen+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uStrLen>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <uStrLen+0x1c>
cmpq   $0x0,(%rdi)
je     111c <uStrLen+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <uStrLen+0x10>
ret

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

LLVM IR (-O2):
define i32 @uStrLen(i64* %0) {
%2 = icmp eq i64* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i64, i64* %0
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 0, %3 ]
%8 = phi i64* [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i64, i64* %8, i64 1
%10 = add nuw nsw i32 %7, 1
%11 = load i64, i64* %9
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %10, %6 ]
ret i32 %14
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void LCDIDDDMADisable(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x44050000);
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) &= ~0x00000100;
}


x86 assembly (clang, -O0):
<LCDIDDDMADisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x44050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDIDDDMADisable>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x44050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
andl   $0xfffffeff,0xc(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @LCDIDDDMADisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1141178368
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 12
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, -257
store volatile i32 %12, i32* %10
ret void
}

LLVM IR (-O2):
define void @LCDIDDDMADisable(i32 %0) {
%2 = icmp eq i32 %0, 1141178368
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 12
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, -257
store volatile i32 %9, i32* %7
ret void
}
decode_i_p0(int a, int b) { return (a & 0xfff0000f) | 16 << b; }


x86 assembly (clang, -O0):
<decode_i_p0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfff0000f,%eax
mov    -0x8(%rbp),%ecx
mov    $0x10,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_i_p0>:
mov    %esi,%ecx
and    $0xfff0000f,%edi
mov    $0x10,%eax
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @decode_i_p0(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 = and i32 %5, -1048561
%7 = load i32, i32* %4
%8 = shl i32 16, %7
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @decode_i_p0(i32 %0, i32 %1) {
%3 = and i32 %0, -1048561
%4 = shl i32 16, %1
%5 = or i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int num;
  printf("Digite um numero: ");
  scanf("%d", &num);
  if (num % 2 == 0)
    printf("O numero entrado eh par.\n");
  else
    printf("O numero entrado eh impar.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1169 <main+0x49>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    1175 <main+0x55>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
testb  $0x1,0x4(%rsp)
lea    0xed7(%rip),%rax
lea    0xeb5(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"O numero entrado eh par.\0A\00"
@.str.3 = [28 x i8] c"O numero entrado eh impar.\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"O numero entrado eh impar.\00"
@str.4 = [25 x i8] c"O numero entrado eh par.\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int raw_to_RH(uint16_t raw) {
  int v = raw;
  v *= 125;
  v /= 65536;
  v -= 6;
  return v;
}


x86 assembly (clang, -O0):
<raw_to_RH>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0x7d,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x6,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_to_RH>:
imul   $0x7d,%edi,%ecx
lea    0xffff(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x10,%eax
add    $0xfffffffa,%eax
ret

LLVM IR (-O0):
define i32 @raw_to_RH(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = mul nsw i32 %5, 125
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = sdiv i32 %7, 65536
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 6
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @raw_to_RH(i32 %0) {
%2 = mul nsw i32 %0, 125
%3 = sdiv i32 %2, 65536
%4 = add nsw i32 %3, -6
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void abort() { fprintf(stderr, "ATTENTION: called to abort!\n"); }


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

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"ATTENTION: called to abort!\0A\00"
define void @abort() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"ATTENTION: called to abort!\0A\00"
define void @abort() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
unreachable
}
/* Variables and functions */
float fast_sin(float);
float fast_cos(float x) { return fast_sin(x + 0.5f); }


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

x86 assembly (clang, -O2):
<fast_cos>:
addss  0xee8(%rip),%xmm0
jmp    1030 <fast_sin@plt>

LLVM IR (-O0):
define float @fast_cos(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fadd float %3, 5.000000e-01
%5 = call float @fast_sin(float %4)
ret float %5
}

LLVM IR (-O2):
define float @fast_cos(float %0) {
%2 = fadd float %0, 5.000000e-01
%3 = tail call float @fast_sin(float %2)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void hook1(void) {
  printf("atexit hook 1\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<hook1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hook1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"atexit hook 1\0A\00"
@stdout = global i32 0
define void @hook1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [14 x i8] c"atexit hook 1\00"
define void @hook1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort_crypto_lib(char *);
int /*<<< orphan*/ is_nonce(struct item *);
void check_is_nonce(struct item *item) {
  if (!is_nonce(item))
    abort_crypto_lib("Presented item is not a nonce");
}


x86 assembly (clang, -O0):
<check_is_nonce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_nonce@plt>
cmp    $0x0,%eax
jne    114a <check_is_nonce+0x2a>
lea    0xebb(%rip),%rdi
call   1040 <abort_crypto_lib@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_is_nonce>:
push   %rax
call   1030 <is_nonce@plt>
test   %eax,%eax
je     112c <check_is_nonce+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1040 <abort_crypto_lib@plt>

LLVM IR (-O0):
%struct.item = type { i32 }
@.str = [30 x i8] c"Presented item is not a nonce\00"
define void @check_is_nonce(%struct.item* %0) {
%2 = alloca %struct.item*
store %struct.item* %0, %struct.item** %2
%3 = load %struct.item*, %struct.item** %2
%4 = call i32 @is_nonce(%struct.item* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @abort_crypto_lib(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
%struct.item = type { i32 }
@.str = [30 x i8] c"Presented item is not a nonce\00"
define void @check_is_nonce(%struct.item* %0) {
%2 = tail call i32 @is_nonce(%struct.item* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @abort_crypto_lib(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int INT_MAX;
int main(void) {
  1 << 5;
  INT_MAX >> 2;
  return 0;
}


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

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

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @INT_MAX
%3 = ashr i32 %2, 2
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int copy_target_solutions_to_container(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(5, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<copy_target_solutions_to_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x5,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_target_solutions_to_container>:
mov    $0x5,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @copy_target_solutions_to_container() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 5, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @copy_target_solutions_to_container() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 5, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
void overflow(void *buf, int actualSize, int overflowSize) {
  char *ptr = (char *)buf;
  for (int i = 0; i < overflowSize; i++) {
    ptr[actualSize + i] = 'x';
  }
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1148 <overflow+0x48>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x78,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111d <overflow+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
test   %edx,%edx
jle    112b <overflow+0x1b>
push   %rax
movslq %esi,%rax
add    %rax,%rdi
mov    %edx,%edx
mov    $0x78,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @overflow(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr i8, i8* %0, i64 %6
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %5, %3
ret void
}
int c011(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @c011() {
ret i32 0
}

LLVM IR (-O2):
define i32 @c011() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *print_message_function(void *ptr) {
  char *message;
  message = (char *)ptr;
  printf("%s ", message);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<print_message_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message_function>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define noalias i8* @print_message_function(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char x = 0;
  printf("%d\n", x);
  printf("%1$.*2$d%3$hhn", 5, 10, &x);
  printf("\n");
  printf("%d\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x5,%esi
mov    $0xa,%edx
lea    -0x1(%rbp),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x1(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
lea    0xecf(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xf(%rsp),%rcx
mov    $0x5,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [15 x i8] c"%1$.*2$d%3$hhn\00"
define i32 @main() {
%1 = alloca i8
store i8 0, i8* %1
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 10, i8* %1)
%4 = call i32 @putchar(i32 10)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void unlink() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

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

LLVM IR (-O2):
define void @unlink() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}