xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x94() {
  Assert_real((isodigit(148) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              745, ("isodigit should be 0 for 0x94"));
}


x86 assembly (clang, -O0):
<t_isodigit_0x94>:
push   %rbp
mov    %rsp,%rbp
mov    $0x94,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2e9,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0x94>:
push   %rax
mov    $0x94,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x2e9,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x94\00"
define void @t_isodigit_0x94() {
%1 = call i64 @isodigit(i32 148)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 745, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x94\00"
define void @t_isodigit_0x94() {
%1 = tail call i64 @isodigit(i32 148)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 745, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookbooleanarray_(char *x, unsigned int *n) { lookNarray(x, (*n * 4)); }


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

x86 assembly (clang, -O2):
<lookbooleanarray_>:
mov    (%rsi),%esi
shl    $0x2,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookbooleanarray_(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 = load i32, i32* %6
%8 = mul i32 %7, 4
%9 = call i32 @lookNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @lookbooleanarray_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 2
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int strlen(char const *);
int stringEndsWith(const char *s, const char *suffix) {
  int sLength = strlen(s);
  int suffixLength = strlen(suffix);
  return (sLength >= suffixLength) &&
         (strcmp(s + (sLength - suffixLength), suffix) == 0);
}


x86 assembly (clang, -O0):
<stringEndsWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x19(%rbp)
jl     117b <stringEndsWith+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringEndsWith>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%ebp
jl     115d <stringEndsWith+0x3d>
movslq %ebp,%rax
add    %rax,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @stringEndsWith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp slt i32 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = sub nsw i32 %3, %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = tail call i64 @strcmp(i8* %9, i8* %1)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %6, %2
%14 = phi i32 [ 0, %2 ], [ %12, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("C Wrapper test function");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"C Wrapper test function\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"C Wrapper test function\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
int setregid(gid_t rgid, gid_t egid) {
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<setregid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec6(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setregid>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EPERM = global i32 0
@errno = global i32 0
define i32 @setregid(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @EPERM
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EPERM = global i32 0
@errno = global i32 0
define i32 @setregid(i32 %0, i32 %1) {
%3 = load i32, i32* @EPERM
store i32 %3, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int PTHREAD_CANCEL_ASYNCHRONOUS;
int /*<<< orphan*/ __libc_pread(int, void *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_setcanceltype(int, int *);
ssize_t __attribute__((weak))
pread(int fd, void *buf, size_t count, off_t offset) {
  ssize_t result;
  int oldtype;
  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
  result = __libc_pread(fd, buf, count, offset);
  pthread_setcanceltype(oldtype, NULL);
  return result;
}


x86 assembly (clang, -O0):
<pread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    -0x24(%rbp),%rsi
call   1040 <pthread_setcanceltype@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <__libc_pread@plt>
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_setcanceltype@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pread>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%rsi
call   1040 <pthread_setcanceltype@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <__libc_pread@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
xor    %esi,%esi
call   1040 <pthread_setcanceltype@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define weak i32 @pread(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%11 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%12 = call i32 @pthread_setcanceltype(i32 %11, i32* %10)
%13 = load i32, i32* %5
%14 = load i8*, i8** %6
%15 = load i64, i64* %7
%16 = load i32, i32* %8
%17 = call i32 @__libc_pread(i32 %13, i8* %14, i64 %15, i32 %16)
store i32 %17, i32* %9
%18 = load i32, i32* %10
%19 = call i32 @pthread_setcanceltype(i32 %18, i32* null)
%20 = load i32, i32* %9
ret i32 %20
}

LLVM IR (-O2):
@PTHREAD_CANCEL_ASYNCHRONOUS = global i32 0
define weak i32 @pread(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = load i32, i32* @PTHREAD_CANCEL_ASYNCHRONOUS
%8 = call i32 @pthread_setcanceltype(i32 %7, i32* %5)
%9 = call i32 @__libc_pread(i32 %0, i8* %1, i64 %2, i32 %3)
%10 = load i32, i32* %5
%11 = call i32 @pthread_setcanceltype(i32 %10, i32* null)
ret i32 %9
}
/* Variables and functions */
int strcmp(char const *, char const *);
int _strcmp_null(const char *s1, const char *s2) {
  if (s1 && s2)
    return (strcmp(s1, s2));
  else {
    if (s2)
      return -1;
    else if (s1)
      return 1;
    else
      return 0;
  }
}


x86 assembly (clang, -O0):
<_strcmp_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <_strcmp_null+0x3b>
cmpq   $0x0,-0x18(%rbp)
je     114b <_strcmp_null+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1180 <_strcmp_null+0x70>
cmpq   $0x0,-0x18(%rbp)
je     1162 <_strcmp_null+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    1180 <_strcmp_null+0x70>
cmpq   $0x0,-0x10(%rbp)
je     1179 <_strcmp_null+0x69>
movl   $0x1,-0x4(%rbp)
jmp    1180 <_strcmp_null+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcmp_null>:
test   %rdi,%rdi
je     111f <_strcmp_null+0xf>
test   %rsi,%rsi
je     111f <_strcmp_null+0xf>
jmp    1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rdi,%rdi
setne  %cl
neg    %rsi
sbb    %eax,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_strcmp_null(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
br label %11
8: ; preds = %2
%9 = zext i1 %3 to i32
%10 = select i1 %4, i32 -1, i32 %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ %7, %6 ], [ %10, %8 ]
ret i32 %12
}
char *getCompileDateString() { return "2011-08-19 20:23"; }


x86 assembly (clang, -O0):
<getCompileDateString>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"2011-08-19 20:23\00"
define i8* @getCompileDateString() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"2011-08-19 20:23\00"
define i8* @getCompileDateString() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
scalar_t__ sigismember(int /*<<< orphan*/ *, size_t);
void print_pend(sigset_t *pending) {
  size_t i = 0;
  for (; i < 32; ++i) {
    if (sigismember(pending, i)) {
      putchar('1');
    } else {
      putchar('0');
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_pend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x20,-0x10(%rbp)
jae    1195 <print_pend+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     1175 <print_pend+0x45>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    117f <print_pend+0x4f>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    1184 <print_pend+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <print_pend+0x14>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pend>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <sigismember@plt>
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1130 <print_pend+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @print_pend(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
store i32* %0, i32** %2
store i64 0, i64* %3
br label %4
4: ; preds = %17, %1
%5 = load i64, i64* %3
%6 = icmp ult i64 %5, 32
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i32*, i32** %2
%9 = load i64, i64* %3
%10 = call i64 @sigismember(i32* %8, i64 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @putchar(i8 signext 49)
br label %16
14: ; preds = %7
%15 = call i32 @putchar(i8 signext 48)
br label %16
16: ; preds = %14, %12
br label %17
17: ; preds = %16
%18 = load i64, i64* %3
%19 = add i64 %18, 1
store i64 %19, i64* %3
br label %4
20: ; preds = %4
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_pend(i32* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %8, %2 ]
%4 = tail call i64 @sigismember(i32* %0, i64 %3)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8 48, i8 49
%7 = tail call i32 @putchar(i8 signext %6)
%8 = add nuw nsw i64 %3, 1
%9 = icmp eq i64 %8, 32
br i1 %9, label %10, label %2
10: ; preds = %2
%11 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void bb_do_delay(int seconds) {
  time_t start, now;
  time(&start);
  now = start;
  while (difftime(now, start) < seconds) {
    sleep(seconds);
    time(&now);
  }
}


x86 assembly (clang, -O0):
<bb_do_delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <time@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <difftime@plt>
cmp    -0x4(%rbp),%eax
jge    1174 <bb_do_delay+0x44>
mov    -0x4(%rbp),%edi
call   1050 <sleep@plt>
lea    -0xc(%rbp),%rdi
call   1040 <time@plt>
jmp    114a <bb_do_delay+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_do_delay>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x4(%rsp),%rdi
call   1040 <time@plt>
mov    0x4(%rsp),%edi
mov    %edi,(%rsp)
mov    %edi,%esi
call   1030 <difftime@plt>
cmp    %ebx,%eax
jge    117f <bb_do_delay+0x4f>
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1050 <sleep@plt>
mov    %r14,%rdi
call   1040 <time@plt>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
call   1030 <difftime@plt>
cmp    %ebx,%eax
jl     1160 <bb_do_delay+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @bb_do_delay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @time(i32* %2)
%7 = load i32, i32* %2
store i32 %7, i32* %3
%8 = call i32 @difftime(i32 %7, i32 %7)
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %17
10: ; preds = %1, %10
%11 = call i32 @sleep(i32 %0)
%12 = call i32 @time(i32* %3)
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @difftime(i32 %13, i32 %14)
%16 = icmp slt i32 %15, %0
br i1 %16, label %10, label %17
17: ; preds = %10, %1
ret void
}
/* Variables and functions */
scalar_t__ str_has_prefix(char const *, char *);
int encoding_char_size(const char *encoding) {
  if (str_has_prefix(encoding, "UTF-16"))
    return 2;
  if (str_has_prefix(encoding, "UTF-32"))
    return 2;
  return 1;
}


x86 assembly (clang, -O0):
<encoding_char_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <str_has_prefix@plt>
cmp    $0x0,%rax
je     1142 <encoding_char_size+0x32>
movl   $0x2,-0x4(%rbp)
jmp    116f <encoding_char_size+0x5f>
mov    -0x10(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <str_has_prefix@plt>
cmp    $0x0,%rax
je     1168 <encoding_char_size+0x58>
movl   $0x2,-0x4(%rbp)
jmp    116f <encoding_char_size+0x5f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encoding_char_size>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <str_has_prefix@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     112f <encoding_char_size+0x1f>
pop    %rbx
ret
lea    0xed1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <str_has_prefix@plt>
cmp    $0x1,%rax
mov    $0x2,%eax
sbb    $0x0,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"UTF-16\00"
@.str.1 = [7 x i8] c"UTF-32\00"
define i32 @encoding_char_size(i8* %0) {
%2 = tail call i64 @str_has_prefix(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @str_has_prefix(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 1, i32 2
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 2, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Sprint(int, int /*<<< orphan*/, int, char *);
int /*<<< orphan*/ glColor3f(double, int /*<<< orphan*/, double);
void invalid() {
  glColor3f(1.0, 0, 5.0);
  Sprint(-10, 0, 2, "Please Press a KEY from 1 to 6 !");
}


x86 assembly (clang, -O0):
<invalid>:
push   %rbp
mov    %rsp,%rbp
movsd  0xed4(%rip),%xmm0
xor    %edi,%edi
movsd  0xed2(%rip),%xmm1
call   1030 <glColor3f@plt>
mov    $0xfffffff6,%edi
xor    %esi,%esi
mov    $0x2,%edx
lea    0xec2(%rip),%rcx
call   1040 <Sprint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalid>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
xor    %edi,%edi
call   1030 <glColor3f@plt>
lea    0xed1(%rip),%rcx
mov    $0xfffffff6,%edi
xor    %esi,%esi
mov    $0x2,%edx
pop    %rax
jmp    1040 <Sprint@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Please Press a KEY from 1 to 6 !\00"
define void @invalid() {
%1 = call i32 @glColor3f(double 1.000000e+00, i32 0, double 5.000000e+00)
%2 = call i32 @Sprint(i32 -10, i32 0, i32 2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Please Press a KEY from 1 to 6 !\00"
define void @invalid() {
%1 = tail call i32 @glColor3f(double 1.000000e+00, i32 0, double 5.000000e+00)
%2 = tail call i32 @Sprint(i32 -10, i32 0, i32 2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}
int num_length(double n) {
  if (n < 10)
    return 1;
  else
    return 1 + num_length(n / 10);
}


x86 assembly (clang, -O0):
<num_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113c <num_length+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1158 <num_length+0x48>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <num_length@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_length>:
mov    $0x1,%eax
movsd  0xef3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     112d <num_length+0x2d>
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
divsd  %xmm1,%xmm0
add    $0x1,%eax
ucomisd %xmm0,%xmm1
jbe    1120 <num_length+0x20>
ret

LLVM IR (-O0):
define i32 @num_length(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 1.000000e+01
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
%8 = load double, double* %3
%9 = fdiv double %8, 1.000000e+01
%10 = call i32 @num_length(double %9)
%11 = add nsw i32 1, %10
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 @num_length(double %0) {
%2 = fcmp olt double %0, 1.000000e+01
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi double [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = fdiv double %4, 1.000000e+01
%7 = add nuw nsw i32 %5, 1
%8 = fcmp olt double %6, 1.000000e+01
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = add nuw i32 %5, 2
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 1, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
void *obs_source_get_ref(void *);
void *obs_source_addref_safe_(void *ref) { return obs_source_get_ref(ref); }


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

x86 assembly (clang, -O2):
<obs_source_addref_safe_>:
jmp    1030 <obs_source_get_ref@plt>

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

LLVM IR (-O2):
define i8* @obs_source_addref_safe_(i8* %0) {
%2 = tail call i8* @obs_source_get_ref(i8* %0)
ret i8* %2
}
unsigned xrop3_162_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = D & stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_162_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_162_0_0>:
not    %dil
or     %sil,%dil
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_162_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = xor i8 %0, -1
%4 = or i8 %3, %1
%5 = zext i8 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void clrscr(void) { printf("%c[2J%c[?6h", 27, 27); }


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

x86 assembly (clang, -O2):
<clrscr>:
lea    0xee9(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1b,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%c[2J%c[?6h\00"
define void @clrscr() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 27, i32 27)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%c[2J%c[?6h\00"
define void @clrscr() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 27, i32 27)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exibeMenuAnt(int);
int /*<<< orphan*/ printf(char *);
void menu2(int at) {
  exibeMenuAnt(at);
  printf("ATUAL: 2\n");
}


x86 assembly (clang, -O0):
<menu2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <exibeMenuAnt@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu2>:
push   %rax
call   1040 <exibeMenuAnt@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [9 x i8] c"ATUAL: 2\00"
define void @menu2(i32 %0) {
%2 = tail call i32 @exibeMenuAnt(i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void fail(const char *s) {
  perror(s);
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @fail(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int mod4();
int /*<<< orphan*/ printf(char *, ...);
int mod3() {
  printf("\t%d\n", mod4());
  printf("mod3\n");
  return 3;
}


x86 assembly (clang, -O0):
<mod3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mod4@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod3>:
push   %rax
xor    %eax,%eax
call   1040 <mod4@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"\09%d\0A\00"
@str = [5 x i8] c"mod3\00"
define i32 @mod3() {
%1 = tail call i32 (...) @mod4()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 3
}
double soma(double a, double b) { return a + b; }


x86 assembly (clang, -O0):
<soma>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<soma>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @soma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @soma(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
volatile void die(char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void *c_error_ptr() { return (void *)(-1); }


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

x86 assembly (clang, -O2):
<c_error_ptr>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i8* @c_error_ptr() {
ret i8* inttoptr (i64 -1 to i8*)
}

LLVM IR (-O2):
define i8* @c_error_ptr() {
ret i8* inttoptr (i64 -1 to i8*)
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int fstat(int, struct stat *);
int isopen(int fd) {
  int nread;
  struct stat buf;
  nread = fstat(fd, &buf);
  if (nread > -1) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <fstat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jle    1140 <isopen+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1147 <isopen+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isopen>:
push   %rax
mov    %rsp,%rsi
call   1030 <fstat@plt>
not    %eax
shr    $0x1f,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isopen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.stat
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %5)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, -1
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):
%struct.stat = type { i32 }
define i32 @isopen(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = xor i32 %4, -1
%6 = lshr i32 %5, 31
ret i32 %6
}
int hot_power2(unsigned n) {
  unsigned p2 = 1;
  while (p2 <= n)
    p2 <<= 1;
  return p2;
}


x86 assembly (clang, -O0):
<hot_power2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     1128 <hot_power2+0x28>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <hot_power2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hot_power2>:
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jbe    1110 <hot_power2+0x10>
ret

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

LLVM IR (-O2):
define i32 @hot_power2(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp ugt i32 %3, %0
%5 = shl i32 %3, 1
br i1 %4, label %6, label %2
6: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int rand();
int constrainedRandom(int values) { return rand() % values; }


x86 assembly (clang, -O0):
<constrainedRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constrainedRandom>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @constrainedRandom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @constrainedRandom(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
double match_pear(double p, double q, void *data) {
  (void)data;
  return (1 - (1 - q) * p / 3 - (1 - p) * q / 3 - 2 * (1 - p) * (1 - q) / 9);
}


x86 assembly (clang, -O0):
<match_pear>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  0xeee(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xeec(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xed0(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xec4(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  0xe9d(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe89(%rip),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe70(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_pear>:
movsd  0xef8(%rip),%xmm3
movapd %xmm3,%xmm4
subsd  %xmm1,%xmm4
unpcklpd %xmm4,%xmm1
mulsd  %xmm0,%xmm4
divsd  0xee8(%rip),%xmm4
movapd %xmm3,%xmm2
subsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
divpd  0xed0(%rip),%xmm3
subsd  %xmm4,%xmm2
subsd  %xmm3,%xmm2
unpckhpd %xmm3,%xmm3
subsd  %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @match_pear(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i8*
store double %0, double* %4
store double %1, double* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load double, double* %5
%9 = fsub double 1.000000e+00, %8
%10 = load double, double* %4
%11 = fmul double %9, %10
%12 = fdiv double %11, 3.000000e+00
%13 = fsub double 1.000000e+00, %12
%14 = load double, double* %4
%15 = fsub double 1.000000e+00, %14
%16 = load double, double* %5
%17 = fmul double %15, %16
%18 = fdiv double %17, 3.000000e+00
%19 = fsub double %13, %18
%20 = load double, double* %4
%21 = fsub double 1.000000e+00, %20
%22 = fmul double 2.000000e+00, %21
%23 = load double, double* %5
%24 = fsub double 1.000000e+00, %23
%25 = fmul double %22, %24
%26 = fdiv double %25, 9.000000e+00
%27 = fsub double %19, %26
ret double %27
}

LLVM IR (-O2):
define double @match_pear(double %0, double %1, i8* nocapture readnone %2) {
%4 = fsub double 1.000000e+00, %1
%5 = fmul double %4, %0
%6 = fdiv double %5, 3.000000e+00
%7 = fsub double 1.000000e+00, %6
%8 = fsub double 1.000000e+00, %0
%9 = fmul double %8, 2.000000e+00
%10 = insertelement <2 x double> poison, double %8, i64 0
%11 = insertelement <2 x double> %10, double %9, i64 1
%12 = insertelement <2 x double> poison, double %1, i64 0
%13 = insertelement <2 x double> %12, double %4, i64 1
%14 = fmul <2 x double> %11, %13
%15 = fdiv <2 x double> %14, <double 3.000000e+00, double 9.000000e+00>
%16 = extractelement <2 x double> %15, i64 0
%17 = fsub double %7, %16
%18 = extractelement <2 x double> %15, i64 1
%19 = fsub double %17, %18
ret double %19
}
/* Variables and functions */
int /*<<< orphan*/ rbkts_destroy();
void kvst_destroy(void) { rbkts_destroy(); }


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

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

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

LLVM IR (-O2):
define void @kvst_destroy() {
%1 = tail call i32 (...) @rbkts_destroy()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memmove(unsigned long long *, unsigned long long *,
                           long long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *moveMem(void *memPtr) {
  unsigned long long *mem = (unsigned long long *)memPtr;
  memmove(mem, mem + 8,
          (((1LL << 31) / sizeof(unsigned long long)) - 1) *
              sizeof(unsigned long long) / 2);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<moveMem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x40,%rsi
mov    $0x3ffffffc,%edx
call   1040 <memmove@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveMem>:
push   %rax
lea    0x40(%rdi),%rsi
mov    $0x3ffffffc,%edx
call   1040 <memmove@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @moveMem(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i64*
store i64* %6, i64** %4
%7 = load i64*, i64** %4
%8 = load i64*, i64** %4
%9 = getelementptr inbounds i64, i64* %8, i64 8
%10 = call i32 @memmove(i64* %7, i64* %9, i64 1073741820)
%11 = call i32 @pthread_exit(i32* null)
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @moveMem(i8* %0) {
%2 = bitcast i8* %0 to i64*
%3 = getelementptr inbounds i8, i8* %0, i64 64
%4 = bitcast i8* %3 to i64*
%5 = tail call i32 @memmove(i64* %2, i64* %4, i64 1073741820)
%6 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ instr(char *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
int /*<<< orphan*/ report_status(char *);
void cmd_instr(int nargs, char **args) {
  char string[256];
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(2);
  report_return(instr(string));
  report_status(string);
}


x86 assembly (clang, -O0):
<cmd_instr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1060 <check_arg_count@plt>
cmp    $0x1,%eax
jne    117a <cmd_instr+0x2a>
jmp    11a3 <cmd_instr+0x53>
mov    $0x2,%edi
call   1070 <report_count@plt>
lea    -0x110(%rbp),%rdi
call   1050 <instr@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
lea    -0x110(%rbp),%rdi
call   1040 <report_status@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_instr>:
push   %rbx
sub    $0x100,%rsp
xor    %esi,%esi
call   1060 <check_arg_count@plt>
cmp    $0x1,%eax
je     1188 <cmd_instr+0x38>
mov    $0x2,%edi
call   1070 <report_count@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <instr@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
mov    %rbx,%rdi
call   1040 <report_status@plt>
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @cmd_instr(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @check_arg_count(i32 %0, i32 0)
%6 = icmp eq i32 %5, 1
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = tail call i32 @report_count(i32 2)
%9 = call i32 @instr(i8* %4)
%10 = call i32 @report_return(i32 %9)
%11 = call i32 @report_status(i8* %4)
br label %12
12: ; preds = %2, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned int);
void waitForTimerUs(unsigned int nbUs) { usleep(nbUs); }


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

x86 assembly (clang, -O2):
<waitForTimerUs>:
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define void @waitForTimerUs(i32 %0) {
%2 = tail call i32 @usleep(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_FILL;
int /*<<< orphan*/ GL_FRONT_AND_BACK;
int /*<<< orphan*/ GL_LINE;
int /*<<< orphan*/ glPolygonMode(int /*<<< orphan*/, int /*<<< orphan*/);
void wire(void) {
  static int w;
  if (w ^= 1)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  else
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}


x86 assembly (clang, -O0):
<wire>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f12(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x2f09(%rip)
cmp    $0x0,%eax
je     1148 <wire+0x38>
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
call   1030 <glPolygonMode@plt>
jmp    115f <wire+0x4f>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
call   1030 <glPolygonMode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wire>:
xorl   $0x1,0x2f15(%rip)
mov    0x2eca(%rip),%rax
mov    (%rax),%edi
jne    1130 <wire+0x20>
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
jmp    1030 <glPolygonMode@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <glPolygonMode@plt>

LLVM IR (-O0):
@wire.w = internal global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_LINE = global i32 0
@GL_FILL = global i32 0
define void @wire() {
%1 = load i32, i32* @wire.w
%2 = xor i32 %1, 1
store i32 %2, i32* @wire.w
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i32, i32* @GL_FRONT_AND_BACK
%6 = load i32, i32* @GL_LINE
%7 = call i32 @glPolygonMode(i32 %5, i32 %6)
br label %12
8: ; preds = %0
%9 = load i32, i32* @GL_FRONT_AND_BACK
%10 = load i32, i32* @GL_FILL
%11 = call i32 @glPolygonMode(i32 %9, i32 %10)
br label %12
12: ; preds = %8, %4
ret void
}

LLVM IR (-O2):
@wire.w = internal unnamed_addr global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_LINE = global i32 0
@GL_FILL = global i32 0
define void @wire() {
%1 = load i32, i32* @wire.w
%2 = xor i32 %1, 1
store i32 %2, i32* @wire.w
%3 = icmp eq i32 %2, 0
%4 = load i32, i32* @GL_FRONT_AND_BACK
%5 = load i32, i32* @GL_FILL
%6 = load i32, i32* @GL_LINE
%7 = select i1 %3, i32 %5, i32 %6
%8 = tail call i32 @glPolygonMode(i32 %4, i32 %7)
ret void
}
int ceil_div(int x, int y) { return (x + y - 1) / y; }


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

x86 assembly (clang, -O2):
<ceil_div>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @ceil_div(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
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @ceil_div(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sdiv i32 %4, %1
ret i32 %5
}