xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ http_reply(int, int /*<<< orphan*/ *, int, char *, char *,
                              char *);
void not_implemented(int fd) {
  http_reply(fd, NULL, 501, "Not Implemented", "text/plain",
             "That command is not implemented");
}


x86 assembly (clang, -O0):
<not_implemented>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1f5,%edx
lea    0xed2(%rip),%rcx
lea    0xedb(%rip),%r8
lea    0xedf(%rip),%r9
call   1030 <http_reply@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_implemented>:
lea    0xee9(%rip),%rcx
lea    0xef2(%rip),%r8
lea    0xef6(%rip),%r9
xor    %esi,%esi
mov    $0x1f5,%edx
jmp    1030 <http_reply@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Not Implemented\00"
@.str.1 = [11 x i8] c"text/plain\00"
@.str.2 = [32 x i8] c"That command is not implemented\00"
define void @not_implemented(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @http_reply(i32 %3, i32* null, i32 501, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Not Implemented\00"
@.str.1 = [11 x i8] c"text/plain\00"
@.str.2 = [32 x i8] c"That command is not implemented\00"
define void @not_implemented(i32 %0) {
%2 = tail call i32 @http_reply(i32 %0, i32* null, i32 501, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
double BLAST_Expm1(double);
double BLAST_KarlinEtoP(double x) { return -BLAST_Expm1(-x); }


x86 assembly (clang, -O0):
<BLAST_KarlinEtoP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <BLAST_Expm1@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BLAST_KarlinEtoP>:
push   %rax
xorps  0xee8(%rip),%xmm0
call   1030 <BLAST_Expm1@plt>
xorps  0xedc(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @BLAST_KarlinEtoP(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = call double @BLAST_Expm1(double %4)
%6 = fneg double %5
ret double %6
}

LLVM IR (-O2):
define double @BLAST_KarlinEtoP(double %0) {
%2 = fneg double %0
%3 = tail call double @BLAST_Expm1(double %2)
%4 = fneg double %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ Serial_readEnergia(int, unsigned char *, int *, int);
void serialReceiveEnergia(int port, unsigned char outData[], int *outStatus,
                          int receiveBufferLength) {
  Serial_readEnergia(port, outData, outStatus, receiveBufferLength);
}


x86 assembly (clang, -O0):
<serialReceiveEnergia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <Serial_readEnergia@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialReceiveEnergia>:
jmp    1030 <Serial_readEnergia@plt>

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

LLVM IR (-O2):
define void @serialReceiveEnergia(i32 %0, i8* %1, i32* %2, i32 %3) {
%5 = tail call i32 @Serial_readEnergia(i32 %0, i8* %1, i32* %2, i32 %3)
ret void
}
int fun_0(int *x) { return x[0] + x[1] + x[2] + x[3]; }


x86 assembly (clang, -O0):
<fun_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
add    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%eax
mov    -0x8(%rbp),%rcx
add    0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_0>:
movdqu (%rdi),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @fun_0(i32* nocapture %0) {
%2 = bitcast i32* %0 to <4 x i32>*
%3 = load <4 x i32>, <4 x i32>* %2
%4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %3)
ret i32 %4
}
void SetCacheViewMaximumThreads(const unsigned long threads) { (void)threads; }


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

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

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

LLVM IR (-O2):
define void @SetCacheViewMaximumThreads(i64 %0) {
ret void
}
void *infer__builtin___memset_chk(void *dest, int val, unsigned long len,
                                  unsigned long dstlen) {
  if (dstlen < len)
    while (1)
      ;
  return dest;
}


x86 assembly (clang, -O0):
<infer__builtin___memset_chk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    112b <infer__builtin___memset_chk+0x2b>
jmp    1126 <infer__builtin___memset_chk+0x26>
jmp    1126 <infer__builtin___memset_chk+0x26>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<infer__builtin___memset_chk>:
cmp    %rdx,%rcx
jae    1112 <infer__builtin___memset_chk+0x12>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1110 <infer__builtin___memset_chk+0x10>
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @infer__builtin___memset_chk(i8* readnone returned %0, i32 %1, i64 %2, i64 %3) {
%5 = icmp ult i64 %3, %2
br i1 %5, label %6, label %7
6: ; preds = %4, %6
br label %6
7: ; preds = %4
ret i8* %0
}
int VALIDATE_RETVAL(int ret) {
  if (ret)
    return ret;
  return 0;
}


x86 assembly (clang, -O0):
<VALIDATE_RETVAL>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111c <VALIDATE_RETVAL+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1123 <VALIDATE_RETVAL+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @VALIDATE_RETVAL(i32 %0) {
ret i32 %0
}
int mmc_eject(const char *mmc_device) {
  (void)mmc_device;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @mmc_eject(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *strcopyof(char *str) {
  char *temp;
  temp = (char *)malloc(strlen(str) + 1);
  strcpy(temp, str);
  return (temp);
}


x86 assembly (clang, -O0):
<strcopyof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcopyof>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strcopyof(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @strcopyof(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
int F(int x) {
  if (x == 1)
    return 10;
  else
    return F(x - 1) + 2;
}


x86 assembly (clang, -O0):
<F>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1131 <F+0x21>
movl   $0xa,-0x4(%rbp)
jmp    1142 <F+0x32>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <F@plt>
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F>:
cmp    $0x1,%edi
lea    0x8(%rdi,%rdi,1),%ecx
mov    $0xa,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @F(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = shl i32 %0, 1
%4 = add i32 %3, 8
%5 = select i1 %2, i32 10, i32 %4
ret i32 %5
}
int isPowerOfTwo(int n) {
  int i, m = sizeof(int) * 8;
  int t;
  for (i = 0; i < m; i++) {
    t = 1 << i;
    if (n == t)
      return (1);
    if (n < t)
      return (0);
  }
  return (0);
}


x86 assembly (clang, -O0):
<isPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x20,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1171 <isPowerOfTwo+0x71>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1146 <isPowerOfTwo+0x46>
movl   $0x1,-0x4(%rbp)
jmp    1178 <isPowerOfTwo+0x78>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115e <isPowerOfTwo+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    1178 <isPowerOfTwo+0x78>
jmp    1163 <isPowerOfTwo+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <isPowerOfTwo+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfTwo>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
mov    $0x1,%edx
shl    %cl,%edx
cmp    %edi,%edx
je     1130 <isPowerOfTwo+0x30>
xor    %eax,%eax
cmp    %edi,%edx
jg     1130 <isPowerOfTwo+0x30>
lea    0x1(%rcx),%edx
cmp    $0x1f,%ecx
mov    %edx,%ecx
jne    1110 <isPowerOfTwo+0x10>
ret

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

LLVM IR (-O2):
define i32 @isPowerOfTwo(i32 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ 0, %1 ], [ %8, %6 ]
%4 = shl nuw i32 1, %3
%5 = icmp eq i32 %4, %0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = icmp sgt i32 %4, %0
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 32
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %2
11: ; preds = %6, %2
%12 = phi i32 [ 1, %2 ], [ 0, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clearScreen() { printf("\e[1;1H\e[2J"); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
define void @clearScreen() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
void foo487(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo487(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ kill(int /*<<< orphan*/ const, int /*<<< orphan*/);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/ const, int *, int /*<<< orphan*/);
void kill_subprocess_status(const pid_t pid, int *status) {
  kill(pid, SIGKILL);
  waitpid(pid, status, 0);
}


x86 assembly (clang, -O0):
<kill_subprocess_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_subprocess_status>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <waitpid@plt>

LLVM IR (-O0):
@SIGKILL = global i32 0
define void @kill_subprocess_status(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* @SIGKILL
%7 = call i32 @kill(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32*, i32** %4
%10 = call i32 @waitpid(i32 %8, i32* %9, i32 0)
ret void
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define void @kill_subprocess_status(i32 %0, i32* %1) {
%3 = load i32, i32* @SIGKILL
%4 = tail call i32 @kill(i32 %0, i32 %3)
%5 = tail call i32 @waitpid(i32 %0, i32* %1, i32 0)
ret void
}
/* Variables and functions */
char *strstr(char *, char *);
int check_cd(char *command) {
  char *cdloc;
  cdloc = strstr(command, "cd");
  if (cdloc == command) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_cd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    114a <check_cd+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <check_cd+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"cd\00"
define i32 @check_cd(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
long ndelay_with_int(long);
void ndelay(unsigned long nsec) {
  long left = nsec;
  do {
    left = ndelay_with_int(left);
  } while (left > 0);
}


x86 assembly (clang, -O0):
<ndelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ndelay_with_int@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jg     1124 <ndelay+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndelay>:
push   %rax
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rdi
call   1030 <ndelay_with_int@plt>
test   %rax,%rax
jg     1120 <ndelay+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @ndelay(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
br label %5
5: ; preds = %8, %1
%6 = load i64, i64* %3
%7 = call i64 @ndelay_with_int(i64 %6)
store i64 %7, i64* %3
br label %8
8: ; preds = %5
%9 = load i64, i64* %3
%10 = icmp sgt i64 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @ndelay(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %4, %2 ]
%4 = tail call i64 @ndelay_with_int(i64 %3)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
int operation_add(int a, int b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i32 @operation_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
const char *hstrerror(int err) {
  (void)err;
  return ("Unknown resolver error");
}


x86 assembly (clang, -O0):
<hstrerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hstrerror>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Unknown resolver error\00"
define i8* @hstrerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [23 x i8] c"Unknown resolver error\00"
define i8* @hstrerror(i32 %0) {
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int p6c(int c) {
  printf("\n******%c\n", c);
  return 0;
}


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

x86 assembly (clang, -O2):
<p6c>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"\0A******%c\0A\00"
define i32 @p6c(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printChar(char, int);
int /*<<< orphan*/ putchar(char);
void printBlankAndNewLine(int num) {
  printChar(' ', num);
  putchar('\n');
}


x86 assembly (clang, -O0):
<printBlankAndNewLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x20,%edi
call   1040 <printChar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBlankAndNewLine>:
push   %rax
mov    %edi,%esi
mov    $0x20,%edi
call   1040 <printChar@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @printBlankAndNewLine(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printChar(i8 signext 32, i32 %3)
%5 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @printBlankAndNewLine(i32 %0) {
%2 = tail call i32 @printChar(i8 signext 32, i32 %0)
%3 = tail call i32 @putchar(i8 signext 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void FindUnderscores(void) {
  printf("#ifndef F77_NO_UNDERSCORE\n");
  printf("#define F77_NO_UNDERSCORE\n");
  printf("#endif\n");
}


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

x86 assembly (clang, -O2):
<FindUnderscores>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"#ifndef F77_NO_UNDERSCORE\0A\00"
@.str.1 = [27 x i8] c"#define F77_NO_UNDERSCORE\0A\00"
@.str.2 = [8 x i8] c"#endif\0A\00"
define void @FindUnderscores() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [26 x i8] c"#ifndef F77_NO_UNDERSCORE\00"
@str.3 = [26 x i8] c"#define F77_NO_UNDERSCORE\00"
@str.4 = [7 x i8] c"#endif\00"
define void @FindUnderscores() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.4, i64 0, i64 0))
ret void
}
void led_off(int led) {
  int current_value;
  current_value = *(unsigned int *)0xf0000028;
  *(unsigned int *)0xf0000028 = current_value & ~(1 << led);
}


x86 assembly (clang, -O0):
<led_off>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xf0000028,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%eax
and    %eax,%ecx
mov    $0xf0000028,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_off>:
mov    %edi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
mov    $0xf0000028,%ecx
and    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @led_off(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* inttoptr (i64 4026531880 to i32*)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = and i32 %5, %8
store i32 %9, i32* inttoptr (i64 4026531880 to i32*)
ret void
}

LLVM IR (-O2):
define void @led_off(i32 %0) {
%2 = load i32, i32* inttoptr (i64 4026531880 to i32*)
%3 = shl nuw i32 1, %0
%4 = xor i32 %3, -1
%5 = and i32 %2, %4
store i32 %5, i32* inttoptr (i64 4026531880 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *name) {
  fprintf(stderr, "usage: %s bios_file\n", name);
  fprintf(stderr, "  bios_file - BIOS file, either a dump of the SPI flash or "
                  "a .FL1 file\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee1(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s bios_file\0A\00"
@.str.1 = [72 x i8] c" bios_file - BIOS file, either a dump of the SPI flash or a .FL1 file\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s bios_file\0A\00"
@.str.1 = [72 x i8] c" bios_file - BIOS file, either a dump of the SPI flash or a .FL1 file\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int main() {
  int i = 1, sum = 0;
  while (i <= 100) {
    sum += i;
    i++;
  }
  do {
    if (!(sum == 5050))
      asm volatile(".byte 0xd6" : : "a"(1));
  } while (0);
  asm volatile(".byte 0xd6" : : "a"(0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     113a <main+0x3a>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
jmp    113f <main+0x3f>
cmpl   $0x13ba,-0xc(%rbp)
je     1152 <main+0x52>
mov    $0x1,%eax
(bad)
jmp    1157 <main+0x57>
xor    %eax,%eax
(bad)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
tail call void asm sideeffect ".byte 0xd6", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
ret i32 0
}
const char *f(const char *s, unsigned int i) { return &s[i + 3 - 1]; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0x2(%rsi),%eax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @f(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = add i32 %6, 3
%8 = sub i32 %7, 1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
ret i8* %10
}

LLVM IR (-O2):
define i8* @f(i8* readnone %0, i32 %1) {
%3 = add i32 %1, 2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
ret i8* %5
}
const char *sncopy(char *d, const char *s, int n) {
  const char *const d0 = d;
  while (n-- && *s != '\0')
    *d++ = *s++;
  *d = '\0';
  return d0;
}


x86 assembly (clang, -O0):
<sncopy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1140 <sncopy+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1150 <sncopy+0x50>
jmp    1177 <sncopy+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1117 <sncopy+0x17>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sncopy>:
mov    %rdi,%rax
mov    %rdi,%rcx
test   %edx,%edx
je     1126 <sncopy+0x26>
mov    %edx,%edi
xor    %ecx,%ecx
xchg   %ax,%ax
movzbl (%rsi,%rcx,1),%edx
test   %dl,%dl
je     1123 <sncopy+0x23>
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
cmp    %ecx,%edi
jne    1110 <sncopy+0x10>
add    %rax,%rcx
movb   $0x0,(%rcx)
ret

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

LLVM IR (-O2):
define i8* @sncopy(i8* returned writeonly %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %16, label %5
5: ; preds = %3, %12
%6 = phi i32 [ %9, %12 ], [ %2, %3 ]
%7 = phi i8* [ %14, %12 ], [ %0, %3 ]
%8 = phi i8* [ %13, %12 ], [ %1, %3 ]
%9 = add nsw i32 %6, -1
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %10, i8* %7
%15 = icmp eq i32 %9, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %12, %3
%17 = phi i8* [ %0, %3 ], [ %14, %12 ], [ %7, %5 ]
store i8 0, i8* %17
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ test_grid_padding();
int /*<<< orphan*/ test_grid_set_bounds();
int /*<<< orphan*/ test_grid_set_min();
int /*<<< orphan*/ test_grid_simple();
int main(int argc, char **argv) {
  test_grid_simple();
  test_grid_padding();
  test_grid_set_min();
  test_grid_set_bounds();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <test_grid_simple@plt>
mov    $0x0,%al
call   1040 <test_grid_padding@plt>
mov    $0x0,%al
call   1030 <test_grid_set_min@plt>
mov    $0x0,%al
call   1060 <test_grid_set_bounds@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test_grid_simple@plt>
xor    %eax,%eax
call   1040 <test_grid_padding@plt>
xor    %eax,%eax
call   1030 <test_grid_set_min@plt>
xor    %eax,%eax
call   1060 <test_grid_set_bounds@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test_grid_simple()
%7 = call i32 (...) @test_grid_padding()
%8 = call i32 (...) @test_grid_set_min()
%9 = call i32 (...) @test_grid_set_bounds()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_grid_simple()
%4 = tail call i32 (...) @test_grid_padding()
%5 = tail call i32 (...) @test_grid_set_min()
%6 = tail call i32 (...) @test_grid_set_bounds()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, float);
void fltcb(const char *l, char s, float v) {
  printf("Callback [float]: %s %d %f\n", l, (int)s, v);
}


x86 assembly (clang, -O0):
<fltcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
movsbl -0x9(%rbp),%edx
movss  -0x10(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fltcb>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Callback [float]: %s %d %f\0A\00"
define void @fltcb(i8* %0, i8 signext %1, float %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca float
store i8* %0, i8** %4
store i8 %1, i8* %5
store float %2, float* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = load float, float* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9, float %10)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Callback [float]: %s %d %f\0A\00"
define void @fltcb(i8* %0, i8 signext %1, float %2) {
%4 = sext i8 %1 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4, float %2)
ret void
}
void pinModePiFace(int pin, int mode) {}


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

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

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

LLVM IR (-O2):
define void @pinModePiFace(i32 %0, i32 %1) {
ret void
}
void print_sc(char *code) {
  code += 6;
  puts(code);
}


x86 assembly (clang, -O0):
<print_sc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sc>:
add    $0x6,%rdi
xor    %eax,%eax
jmp    1030 <puts@plt>

LLVM IR (-O0):
define void @print_sc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 6
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %5)
ret void
}

LLVM IR (-O2):
define void @print_sc(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 6
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %2)
ret void
}
/* Variables and functions */
size_t strlen(char const *);
int /*<<< orphan*/ write(int, char const *, size_t);
int sendbytes(const char *msg, int fd) {
  size_t len = strlen(msg);
  if (len > 0)
    write(fd, msg, len);
  return 0;
}


x86 assembly (clang, -O0):
<sendbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    1157 <sendbytes+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendbytes>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %rax,%rax
je     113f <sendbytes+0x1f>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sendbytes(i8* nocapture %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @write(i32 %1, i8* %0, i64 %3)
br label %7
7: ; preds = %5, %2
ret i32 0
}
/* Variables and functions */
char *__PHYSFS_platformCopyEnvironmentVariable(char *);
char *getUserNameByUID();
char *__PHYSFS_platformGetUserName(void) {
  char *retval = getUserNameByUID();
  if (retval == NULL)
    retval = __PHYSFS_platformCopyEnvironmentVariable("USER");
  return (retval);
}


x86 assembly (clang, -O0):
<__PHYSFS_platformGetUserName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getUserNameByUID@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114e <__PHYSFS_platformGetUserName+0x2e>
lea    0xebb(%rip),%rdi
call   1040 <__PHYSFS_platformCopyEnvironmentVariable@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__PHYSFS_platformGetUserName>:
push   %rax
xor    %eax,%eax
call   1030 <getUserNameByUID@plt>
test   %rax,%rax
je     112f <__PHYSFS_platformGetUserName+0xf>
pop    %rcx
ret
lea    0xeca(%rip),%rdi
pop    %rax
jmp    1040 <__PHYSFS_platformCopyEnvironmentVariable@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
define i8* @__PHYSFS_platformGetUserName() {
%1 = alloca i8*
%2 = call i8* (...) @getUserNameByUID()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i8* @__PHYSFS_platformCopyEnvironmentVariable(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %1
br label %7
7: ; preds = %5, %0
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
define i8* @__PHYSFS_platformGetUserName() {
%1 = tail call i8* (...) @getUserNameByUID()
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* @__PHYSFS_platformCopyEnvironmentVariable(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %4, %3 ], [ %1, %0 ]
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "merges adc values got by 'adc get' and valculates the "
                  "temperature from it (kty81-110)\n");
  fprintf(stderr, "./kty-merge [-c <kty-calibration-file>] [0-7]* [0-7]*\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf28(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [87 x i8] c"merges adc values got by 'adc get' and valculates the temperature from it (kty81-110)\0A\00"
@.str.1 = [55 x i8] c"./kty-merge [-c <kty-calibration-file>] [0-7]* [0-7]*\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [87 x i8] c"merges adc values got by 'adc get' and valculates the temperature from it (kty81-110)\0A\00"
@.str.1 = [55 x i8] c"./kty-merge [-c <kty-calibration-file>] [0-7]* [0-7]*\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_stuff_mmx_noeol(void *, unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *);
void dump_stuff_mmx(void *buf, unsigned int size, unsigned int index) {
  dump_stuff_mmx_noeol(buf, size, index);
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_stuff_mmx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <dump_stuff_mmx_noeol@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_stuff_mmx>:
push   %rax
call   1040 <dump_stuff_mmx_noeol@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @dump_stuff_mmx(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @dump_stuff_mmx_noeol(i8* %0, i32 %1, i32 %2)
%5 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int u_int;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
u_int res_randomid() {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (0xffff & (now.tv_sec ^ now.tv_usec));
}


x86 assembly (clang, -O0):
<res_randomid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
and    $0xffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<res_randomid>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movzwl (%rsp),%ecx
movzwl 0x4(%rsp),%eax
xor    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @res_randomid() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = xor i32 %4, %6
%8 = and i32 65535, %7
ret i32 %8
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @res_randomid() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = xor i32 %7, %5
%9 = and i32 %8, 65535
ret i32 %9
}
int main(int argc, char **argv) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ sgen2(char *, char *, int, char *);
void cgincpg(char *s, int v) { sgen2("%s\t$%d,%s", "addq", v, s); }


x86 assembly (clang, -O0):
<cgincpg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xed3(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <sgen2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgincpg>:
mov    %esi,%edx
mov    %rdi,%rcx
lea    0xee4(%rip),%rdi
lea    0xee7(%rip),%rsi
jmp    1030 <sgen2@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%s\09$%d,%s\00"
@.str.1 = [5 x i8] c"addq\00"
define void @cgincpg(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @sgen2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s\09$%d,%s\00"
@.str.1 = [5 x i8] c"addq\00"
define void @cgincpg(i8* %0, i32 %1) {
%3 = tail call i32 @sgen2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %0)
ret void
}