xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void put1(const char *string) {
  while (*string) {
    putchar(*string++);
  }
}


x86 assembly (clang, -O0):
<put1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <put1+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <put1+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put1>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <put1+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <put1+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @put1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @putchar(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @put1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
void *V3DMHListGetPtr(void **list, int total, int i) {
  if ((list == NULL) || (i < 0) || (i >= total))
    return (NULL);
  else
    return (list[i]);
}


x86 assembly (clang, -O0):
<V3DMHListGetPtr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     112f <V3DMHListGetPtr+0x2f>
cmpl   $0x0,-0x18(%rbp)
jl     112f <V3DMHListGetPtr+0x2f>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     113c <V3DMHListGetPtr+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    114c <V3DMHListGetPtr+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<V3DMHListGetPtr>:
xor    %eax,%eax
cmp    %esi,%edx
jge    1115 <V3DMHListGetPtr+0x15>
test   %rdi,%rdi
je     1115 <V3DMHListGetPtr+0x15>
test   %edx,%edx
js     1115 <V3DMHListGetPtr+0x15>
mov    %edx,%eax
mov    (%rdi,%rax,8),%rax
ret

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

LLVM IR (-O2):
define i8* @V3DMHListGetPtr(i8** %0, i32 %1, i32 %2) {
%4 = icmp ne i8** %0, null
%5 = icmp sgt i32 %2, -1
%6 = and i1 %4, %5
%7 = icmp slt i32 %2, %1
%8 = and i1 %7, %6
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = zext i32 %2 to i64
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
br label %13
13: ; preds = %3, %9
%14 = phi i8* [ %12, %9 ], [ null, %3 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ EBADF;
int STDIN_FILENO;
int /*<<< orphan*/ errno;
int _read(int file, char *ptr, int len) {
  if (STDIN_FILENO == file) {
    return 0;
  } else {
    errno = EBADF;
    return -1;
  }
}


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    112c <_read+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1145 <_read+0x45>
mov    0x2ea5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea4(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read>:
mov    0x2ec9(%rip),%rcx
xor    %eax,%eax
cmp    %edi,(%rcx)
je     1124 <_read+0x24>
mov    0x2ec4(%rip),%rax
mov    (%rax),%eax
mov    0x2ec3(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@EBADF = global i32 0
@errno = global i32 0
define i32 @_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @STDIN_FILENO
%5 = icmp eq i32 %4, %0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = load i32, i32* @EBADF
store i32 %7, i32* @errno
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ -1, %6 ], [ 0, %3 ]
ret i32 %9
}
int a2(int a, int b) { return a == 2 && b == 3; }


x86 assembly (clang, -O0):
<a2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jne    1123 <a2+0x23>
cmpl   $0x3,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a2>:
xor    $0x2,%edi
xor    $0x3,%esi
xor    %eax,%eax
or     %edi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @a2(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 = icmp eq i32 %5, 2
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @a2(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 2
%4 = icmp eq i32 %1, 3
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ orbita_err(char *);
double _orbita_potential_miyamoto_disk_Mr(const void *par, const double R) {
  orbita_err("M(R) not implemented for Miyamoto-Nagai disk.");
  return -1;
}


x86 assembly (clang, -O0):
<_orbita_potential_miyamoto_disk_Mr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    0xee0(%rip),%rdi
call   1030 <orbita_err@plt>
movsd  0xecb(%rip),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_orbita_potential_miyamoto_disk_Mr>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <orbita_err@plt>
movsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [46 x i8] c"M(R) not implemented for Miyamoto-Nagai disk.\00"
define double @_orbita_potential_miyamoto_disk_Mr(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = call i32 @orbita_err(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret double -1.000000e+00
}

LLVM IR (-O2):
@.str = [46 x i8] c"M(R) not implemented for Miyamoto-Nagai disk.\00"
define double @_orbita_potential_miyamoto_disk_Mr(i8* nocapture readnone %0, double %1) {
%3 = tail call i32 @orbita_err(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret double -1.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "chmod"
        " [-R] mode file\n  -R	Recursively change file mode bits\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [68 x i8] c"Usage: chmod [-R] mode file\0A -R\09Recursively change file mode bits\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [68 x i8] c"Usage: chmod [-R] mode file\0A -R\09Recursively change file mode bits\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
uint32_t HibernateRTCGet(void) {
  return ((*((volatile uint32_t *)(0x400FC000))));
}


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

x86 assembly (clang, -O2):
<HibernateRTCGet>:
mov    0x400fc000,%eax
ret

LLVM IR (-O0):
define i32 @HibernateRTCGet() {
%1 = load volatile i32, i32* inttoptr (i64 1074774016 to i32*)
ret i32 %1
}

LLVM IR (-O2):
define i32 @HibernateRTCGet() {
%1 = load volatile i32, i32* inttoptr (i64 1074774016 to i32*)
ret i32 %1
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t fixmul31(int32_t x, int32_t y) {
  int64_t temp;
  temp = x;
  temp *= y;
  temp >>= 31;
  return (int32_t)temp;
}


x86 assembly (clang, -O0):
<fixmul31>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixmul31>:
mov    %edi,%eax
imul   %esi,%eax
sar    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @fixmul31(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 = load i32, i32* %5
%9 = mul nsw i32 %8, %7
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = ashr i32 %10, 31
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @fixmul31(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = ashr i32 %3, 31
ret i32 %4
}
/* Variables and functions */
int Sgcd(int);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  printf("\n");
  printf("\n%d\n", Sgcd(1000 * 1000));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xf4240,%edi
call   1040 <Sgcd@plt>
mov    %eax,%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xf4240,%edi
call   1050 <Sgcd@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"\0A%d\0A\00"
define void @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @Sgcd(i32 1000000)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"\0A%d\0A\00"
define void @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @Sgcd(i32 1000000)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
void memrev32(void *p) {
  unsigned char *x = p, t;
  t = x[0];
  x[0] = x[3];
  x[3] = t;
  t = x[1];
  x[1] = x[2];
  x[2] = t;
}


x86 assembly (clang, -O0):
<memrev32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<memrev32>:
mov    (%rdi),%al
mov    0x3(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

LLVM IR (-O0):
define void @memrev32(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
store i8 %8, i8* %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 3
%11 = load i8, i8* %10
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i8, i8* %4
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 3
store i8 %14, i8* %16
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
store i8 %19, i8* %4
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8 %22, i8* %24
%25 = load i8, i8* %4
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @memrev32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 3
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = load i8, i8* %7
store i8 %8, i8* %5
store i8 %6, i8* %7
ret void
}
/* Variables and functions */
char *duplicate(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *str = "hei der";
  char *c = duplicate(str);
  printf("%s", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <duplicate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"hei der\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i8* @duplicate(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int _str_sort_cmp(const void *p, const void *q) {
  return strcmp(*(const char **)p, *(const char **)q);
}


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

x86 assembly (clang, -O2):
<_str_sort_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @_str_sort_cmp(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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @_str_sort_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i, sn = 0;
  for (i = 1; i <= 8; i++) {
    if (i < 4)
      sn = sn + (2);
  }
  assert(sn == 8 * (2) || sn == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     115d <main+0x4d>
cmpl   $0x4,-0x8(%rbp)
jge    114a <main+0x3a>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <main+0x3f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1176 <main+0x66>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 8
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 2
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %7
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 16
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br label %23
23: ; preds = %20, %17
%24 = phi i1 [ true, %17 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ot(char *);
defstorage() { ot("space\t"); }


x86 assembly (clang, -O0):
<defstorage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ot@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"space\09\00"
define i32 @defstorage() {
%1 = alloca i32
%2 = call i32 @ot(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [7 x i8] c"space\09\00"
define i32 @defstorage() {
%1 = tail call i32 @ot(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ OAL_CREATE_SEMAPHORE();
int fc8300_ppi_init(void *handle, unsigned short param1,
                    unsigned short param2) {
  OAL_CREATE_SEMAPHORE();
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <OAL_CREATE_SEMAPHORE@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fc8300_ppi_init(i8* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = call i32 (...) @OAL_CREATE_SEMAPHORE()
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8300_ppi_init(i8* nocapture readnone %0, i16 zeroext %1, i16 zeroext %2) {
%4 = tail call i32 (...) @OAL_CREATE_SEMAPHORE()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__38__IO__clr();
void Msp430GpioC__2__HplGeneralIO__clr(void) {
  HplMsp430GeneralIOP__38__IO__clr();
}


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

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

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

LLVM IR (-O2):
define void @Msp430GpioC__2__HplGeneralIO__clr() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__38__IO__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *f();
int main() {
  char *p = f();
  if (p[1] != 42)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2a,%eax
je     1162 <main+0x32>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
cmpb   $0x2a,0x1(%rax)
jne    1145 <main+0x15>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* (...) @f()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 42
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* (...) @f()
%2 = getelementptr inbounds i8, i8* %1, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 42
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %0
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ do_two_times2_Good(int);
void call_do_two_times2_Good_FP() { do_two_times2_Good(5); }


x86 assembly (clang, -O0):
<call_do_two_times2_Good_FP>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <do_two_times2_Good@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_do_two_times2_Good_FP>:
mov    $0x5,%edi
jmp    1030 <do_two_times2_Good@plt>

LLVM IR (-O0):
define void @call_do_two_times2_Good_FP() {
%1 = call i32 @do_two_times2_Good(i32 5)
ret void
}

LLVM IR (-O2):
define void @call_do_two_times2_Good_FP() {
%1 = tail call i32 @do_two_times2_Good(i32 5)
ret void
}
int sock_ssl(int fd) { return fd; }


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

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

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

LLVM IR (-O2):
define i32 @sock_ssl(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
bool isbracket(char ch) {
  return ch == '(' || ch == ')' || ch == '{' || ch == '}' || ch == '[' ||
         ch == ']';
}


x86 assembly (clang, -O0):
<isbracket>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x28,%ecx
mov    %al,-0x2(%rbp)
je     1171 <isbracket+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x29,%ecx
mov    %al,-0x2(%rbp)
je     1171 <isbracket+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7b,%ecx
mov    %al,-0x2(%rbp)
je     1171 <isbracket+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7d,%ecx
mov    %al,-0x2(%rbp)
je     1171 <isbracket+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5b,%ecx
mov    %al,-0x2(%rbp)
je     1171 <isbracket+0x71>
movsbl -0x1(%rbp),%eax
cmp    $0x5d,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isbracket>:
mov    $0x1,%eax
lea    -0x5b(%rdi),%ecx
cmp    $0x22,%cl
ja     1120 <isbracket+0x20>
movzbl %cl,%ecx
movabs $0x500000001,%rdx
bt     %rcx,%rdx
jb     1128 <isbracket+0x28>
lea    -0x28(%rdi),%ecx
cmp    $0x2,%cl
jae    1129 <isbracket+0x29>
ret
xor    %eax,%eax
cmp    $0x5d,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isbracket(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 40
br i1 %5, label %26, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 41
br i1 %9, label %26, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 123
br i1 %13, label %26, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 125
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 91
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 93
br label %26
26: ; preds = %22, %18, %14, %10, %6, %1
%27 = phi i1 [ true, %18 ], [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %25, %22 ]
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @isbracket(i8 signext %0) {
switch i8 %0, label %2 [
i8 125, label %5
i8 123, label %5
i8 91, label %5
i8 41, label %5
i8 40, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 93
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
};
struct TYPE_4__ {
  TYPE_1__ xclient;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xclient_type(void *_p) {
  return (int)((XEvent *)_p)->xclient.type;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xclient_type>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xclient_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xclient_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int strToInt(const char string[]);
  printf("%i\n", strToInt("245"));
  printf("%i\n", strToInt("100") + 25);
  printf("%i\n", strToInt("13x5"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <strToInt@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <strToInt@plt>
mov    %eax,%esi
add    $0x19,%esi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1030 <strToInt@plt>
mov    %eax,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xedc(%rip),%rdi
call   1030 <strToInt@plt>
lea    0xecc(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <strToInt@plt>
lea    0x19(%rax),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <strToInt@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"245\00"
@.str.2 = [4 x i8] c"100\00"
@.str.3 = [5 x i8] c"13x5\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @strToInt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @strToInt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = add nsw i32 %4, 25
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @strToInt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [4 x i8] c"245\00"
@.str.2 = [4 x i8] c"100\00"
@.str.3 = [5 x i8] c"13x5\00"
define i32 @main() {
%1 = tail call i32 @strToInt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @strToInt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = add nsw i32 %3, 25
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @strToInt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
float __nv_erfcf(float);
float erfcf(float __a) { return __nv_erfcf(__a); }


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

x86 assembly (clang, -O2):
<erfcf>:
jmp    1030 <__nv_erfcf@plt>

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

LLVM IR (-O2):
define float @erfcf(float %0) {
%2 = tail call float @__nv_erfcf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ print_hex(char *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ write(int, char *, int);
void _send(int sockfd, char *data, int n) {
  write(sockfd, data, n);
  printf("send %zd bytes\n", n);
  print_hex(data, n);
}


x86 assembly (clang, -O0):
<_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <print_hex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_send>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
call   1030 <write@plt>
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <print_hex@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"send %zd bytes\0A\00"
define void @_send(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @write(i32 %7, i8* %8, i32 %9)
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @print_hex(i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"send %zd bytes\0A\00"
define void @_send(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 @print_hex(i8* %1, i32 %2)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;

/* Variables and functions */
scalar_t__ FocusIn;
int is_focus_in(XEvent *ev) { return (ev->type == FocusIn); }


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

x86 assembly (clang, -O2):
<is_focus_in>:
mov    (%rdi),%rcx
mov    0x2ee6(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@FocusIn = global i64 0
define i32 @is_focus_in(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @FocusIn
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@FocusIn = global i64 0
define i32 @is_focus_in(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = load i64, i64* @FocusIn
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ shorty();
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char *buffer;
  buffer = (char *)malloc(64);
  strcpy(buffer, "abc");
  printf("%s\n", buffer);
  shorty();
  printf("returned from shorty & do_nothing.\n");
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <shorty@plt>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x40,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1060 <shorty@plt>
lea    0xe81(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [36 x i8] c"returned from shorty & do_nothing.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @malloc(i32 64)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 (...) @shorty()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@str = [35 x i8] c"returned from shorty & do_nothing.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 64)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) %4)
%7 = tail call i32 (...) @shorty()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @free(i8* %4)
ret i32 0
}
void SCE_Quit_FileCache(void) {}


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

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

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

LLVM IR (-O2):
define void @SCE_Quit_FileCache() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ trebleft_arquivo_ttreble();
scalar_t__ trebleft_meu_index(int /*<<< orphan*/);
int main(void) {
  if (trebleft_meu_index(trebleft_arquivo_ttreble())) {
    return 0;
  } else {
    printf("Arquivo %s invalido...", "/etc/ttreble.cnf");
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <trebleft_arquivo_ttreble@plt>
mov    %eax,%edi
call   1040 <trebleft_meu_index@plt>
cmp    $0x0,%rax
je     1163 <main+0x33>
movl   $0x0,-0x4(%rbp)
jmp    117d <main+0x4d>
lea    0xe96(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <trebleft_arquivo_ttreble@plt>
mov    %eax,%edi
call   1040 <trebleft_meu_index@plt>
test   %rax,%rax
jne    115e <main+0x2e>
lea    0xeb3(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Arquivo %s invalido...\00"
@.str.1 = [17 x i8] c"/etc/ttreble.cnf\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @trebleft_arquivo_ttreble()
%3 = call i64 @trebleft_meu_index(i32 %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %8
8: ; preds = %6, %5
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [23 x i8] c"Arquivo %s invalido...\00"
@.str.1 = [17 x i8] c"/etc/ttreble.cnf\00"
define i32 @main() {
%1 = tail call i32 (...) @trebleft_arquivo_ttreble()
%2 = tail call i64 @trebleft_meu_index(i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %0, %4
%7 = phi i32 [ 1, %4 ], [ 0, %0 ]
ret i32 %7
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_initialize_number_of_quaddobl_Laurentials(int length) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(563, &length, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_initialize_number_of_quaddobl_Laurentials>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x233,%edi
lea    -0x4(%rbp),%rsi
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):
<syscon_initialize_number_of_quaddobl_Laurentials>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x233,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @syscon_initialize_number_of_quaddobl_Laurentials(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 563, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
/* Type definitions */
struct t_twc_list_item {
  int dummy;
};
struct t_twc_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ twc_list_add(struct t_twc_list *, struct t_twc_list_item *);
struct t_twc_list_item *twc_list_item_new_data(void const *);
struct t_twc_list_item *twc_list_item_new_data_add(struct t_twc_list *list,
                                                   const void *data) {
  struct t_twc_list_item *item = twc_list_item_new_data(data);
  twc_list_add(list, item);
  return item;
}


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

x86 assembly (clang, -O2):
<twc_list_item_new_data_add>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <twc_list_item_new_data@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <twc_list_add@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.t_twc_list_item = type { i32 }
%struct.t_twc_list = type { i32 }
define %struct.t_twc_list_item* @twc_list_item_new_data_add(%struct.t_twc_list* %0, i8* %1) {
%3 = alloca %struct.t_twc_list*
%4 = alloca i8*
%5 = alloca %struct.t_twc_list_item*
store %struct.t_twc_list* %0, %struct.t_twc_list** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call %struct.t_twc_list_item* @twc_list_item_new_data(i8* %6)
store %struct.t_twc_list_item* %7, %struct.t_twc_list_item** %5
%8 = load %struct.t_twc_list*, %struct.t_twc_list** %3
%9 = load %struct.t_twc_list_item*, %struct.t_twc_list_item** %5
%10 = call i32 @twc_list_add(%struct.t_twc_list* %8, %struct.t_twc_list_item* %9)
%11 = load %struct.t_twc_list_item*, %struct.t_twc_list_item** %5
ret %struct.t_twc_list_item* %11
}

LLVM IR (-O2):
%struct.t_twc_list_item = type { i32 }
%struct.t_twc_list = type { i32 }
define %struct.t_twc_list_item* @twc_list_item_new_data_add(%struct.t_twc_list* %0, i8* %1) {
%3 = tail call %struct.t_twc_list_item* @twc_list_item_new_data(i8* %1)
%4 = tail call i32 @twc_list_add(%struct.t_twc_list* %0, %struct.t_twc_list_item* %3)
ret %struct.t_twc_list_item* %3
}
int test_39(void) {
  int *ptr = (int *)0x1000;
  return *ptr;
}


x86 assembly (clang, -O0):
<test_39>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1000,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_39>:
mov    0x1000,%eax
ret

LLVM IR (-O0):
define i32 @test_39() {
%1 = alloca i32*
store i32* inttoptr (i64 4096 to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @test_39() {
%1 = load i32, i32* inttoptr (i64 4096 to i32*)
ret i32 %1
}
extern void extern_extern_prepostdeclared2(void) {}


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

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

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

LLVM IR (-O2):
define void @extern_extern_prepostdeclared2() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
scalar_t__ fputc(unsigned char, int /*<<< orphan*/ *);
void write_byte(FILE *stream, unsigned char byte) {
  if (fputc(byte, stream) == EOF) {
    error("i/o-error while writing to outfile");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movzbl %al,%edi
call   1030 <fputc@plt>
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
jne    1177 <write_byte+0x47>
lea    0xe98(%rip),%rdi
call   1040 <error@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_byte>:
push   %rax
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
call   1030 <fputc@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
je     114c <write_byte+0x1c>
pop    %rax
ret
lea    0xead(%rip),%rdi
call   1040 <error@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EOF = global i64 0
@.str = [35 x i8] c"i/o-error while writing to outfile\00"
define void @write_byte(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i32*, i32** %3
%7 = call i64 @fputc(i8 zeroext %5, i32* %6)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [35 x i8] c"i/o-error while writing to outfile\00"
define void @write_byte(i32* nocapture %0, i8 zeroext %1) {
%3 = tail call i64 @fputc(i8 zeroext %1, i32* %0)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool UARTCharsAvail(uint32_t ui32Base) {
  ;
  return (((*((volatile uint32_t *)(ui32Base + 0x00000018))) & 0x00000010)
              ? false
              : true);
}


x86 assembly (clang, -O0):
<UARTCharsAvail>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x18,%eax
cltq
mov    (%rax),%edx
and    $0x10,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharsAvail>:
movslq %edi,%rcx
xor    %eax,%eax
testl  $0x10,0x18(%rcx)
sete   %al
ret

LLVM IR (-O0):
define i32 @UARTCharsAvail(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 24
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, 16
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @UARTCharsAvail(i32 %0) {
%2 = add nsw i32 %0, 24
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = lshr i32 %5, 4
%7 = and i32 %6, 1
%8 = xor i32 %7, 1
ret i32 %8
}