xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void HandleDestroy() { exit(10); }


x86 assembly (clang, -O0):
<HandleDestroy>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<HandleDestroy>:
push   %rax
mov    $0xa,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @HandleDestroy() {
%1 = call i32 @exit(i32 10)
unreachable
}

LLVM IR (-O2):
define void @HandleDestroy() {
%1 = tail call i32 @exit(i32 10)
unreachable
}
int fits_bits(int x, int n) {
  int w = sizeof(int) << 3;
  int offset = w - n;
  return (x << offset >> offset) == x;
}


x86 assembly (clang, -O0):
<fits_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x20,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fits_bits>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%edx
shl    %cl,%edx
sar    %cl,%edx
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @fits_bits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 32, i32* %5
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %6
%10 = load i32, i32* %3
%11 = load i32, i32* %6
%12 = shl i32 %10, %11
%13 = load i32, i32* %6
%14 = ashr i32 %12, %13
%15 = load i32, i32* %3
%16 = icmp eq i32 %14, %15
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @fits_bits(i32 %0, i32 %1) {
%3 = sub nsw i32 32, %1
%4 = shl i32 %0, %3
%5 = ashr i32 %4, %3
%6 = icmp eq i32 %5, %0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
void __nv_sincos(double, double *, double *);
void sincos(double __a, double *__sptr, double *__cptr) {
  return __nv_sincos(__a, __sptr, __cptr);
}


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

x86 assembly (clang, -O2):
<sincos>:
jmp    1030 <__nv_sincos@plt>

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

LLVM IR (-O2):
define void @sincos(double %0, double* %1, double* %2) {
tail call void @__nv_sincos(double %0, double* %1, double* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t decode_uint16(uint8_t **payload) {
  uint16_t res = *(uint16_t *)(*payload);
  (*payload) += sizeof(uint16_t);
  return ntohs(res);
}


x86 assembly (clang, -O0):
<decode_uint16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%edi
call   1030 <ntohs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_uint16>:
mov    (%rdi),%rcx
mov    (%rcx),%eax
add    $0x10,%rcx
mov    %rcx,(%rdi)
mov    %eax,%edi
jmp    1030 <ntohs@plt>

LLVM IR (-O0):
define i32 @decode_uint16(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 4
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = call i32 @ntohs(i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @decode_uint16(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %2, i64 4
store i32* %4, i32** %0
%5 = tail call i32 @ntohs(i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SchedulerBasicP__Scheduler__init();
void RealMainP__Scheduler__init(void) { SchedulerBasicP__Scheduler__init(); }


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

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

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

LLVM IR (-O2):
define void @RealMainP__Scheduler__init() {
%1 = tail call i32 (...) @SchedulerBasicP__Scheduler__init()
ret void
}
int isalpha_upper(char letter) {
  if (letter >= 'A' && letter <= 'Z')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isalpha_upper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1130 <isalpha_upper+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1130 <isalpha_upper+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <isalpha_upper+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha_upper>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isalpha_upper(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @isalpha_upper(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned char *skip_space(unsigned char *ptr) {
  while (1) {
    unsigned char c = *ptr;
    if (c == ' ' || c == 9) {
      ptr++;
      continue;
    } else
      break;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<skip_space>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x20,%eax
je     112b <skip_space+0x2b>
movzbl -0x9(%rbp),%eax
cmp    $0x9,%eax
jne    113c <skip_space+0x3c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_space+0x8>
jmp    1141 <skip_space+0x41>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_space>:
mov    %rdi,%rax
jmp    1114 <skip_space+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skip_space+0x10>
cmp    $0x9,%cl
je     1110 <skip_space+0x10>
ret

LLVM IR (-O0):
define i8* @skip_space(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
br label %4
4: ; preds = %1, %14
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 9
br i1 %13, label %14, label %17
14: ; preds = %10, %4
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %4
17: ; preds = %10
br label %18
18: ; preds = %17
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @skip_space(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
void set_fs(unsigned long val) {
  __asm__("mov %0,%%fs" ::"a"((unsigned short)val));
}


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

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

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

LLVM IR (-O2):
define void @set_fs(i64 %0) {
%2 = trunc i64 %0 to i16
tail call void asm sideeffect "mov $0,%fs", "{ax},~{dirflag},~{fpsr},~{flags}"(i16 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int /*<<< orphan*/ AES_ENCRYPT;
int /*<<< orphan*/ AES_cbc_encrypt(char *, char *, int, int /*<<< orphan*/ *,
                                   char *, int /*<<< orphan*/);
int /*<<< orphan*/ AES_set_encrypt_key(char *, int, int /*<<< orphan*/ *);
int htc_aes_encrypt_chunk(char *buf, int size, char *key, char *iv) {
  AES_KEY enc_key;
  AES_set_encrypt_key(key, 8 * 0x10, &enc_key);
  AES_cbc_encrypt(buf, buf, size, &enc_key, iv, AES_ENCRYPT);
}


x86 assembly (clang, -O0):
<htc_aes_encrypt_chunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x80,%esi
lea    -0x2c(%rbp),%rdx
call   1030 <AES_set_encrypt_key@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%r8
mov    0x2e81(%rip),%rax
mov    (%rax),%r9d
lea    -0x2c(%rbp),%rcx
call   1040 <AES_cbc_encrypt@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htc_aes_encrypt_chunk>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x4(%rsp),%r15
mov    %rdx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
call   1030 <AES_set_encrypt_key@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <AES_cbc_encrypt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@AES_ENCRYPT = global i32 0
define i32 @htc_aes_encrypt_chunk(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %8
%12 = call i32 @AES_set_encrypt_key(i8* %11, i32 128, i32* %10)
%13 = load i8*, i8** %6
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = load i8*, i8** %9
%17 = load i32, i32* @AES_ENCRYPT
%18 = call i32 @AES_cbc_encrypt(i8* %13, i8* %14, i32 %15, i32* %10, i8* %16, i32 %17)
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
@AES_ENCRYPT = global i32 0
define i32 @htc_aes_encrypt_chunk(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @AES_set_encrypt_key(i8* %2, i32 128, i32* %5)
%8 = load i32, i32* @AES_ENCRYPT
%9 = call i32 @AES_cbc_encrypt(i8* %0, i8* %0, i32 %1, i32* %5, i8* %3, i32 %8)
ret i32 undef
}
int test20(int x) {
  return x && 4;
  return x && sizeof(int) == 4;
  return x && (signed char)1;
  return x || 0;
  return x || 1;
  return x || -1;
  return x || 5;
  return x && 0;
  return x && 1;
  return x && -1;
  return x && 5;
  return x || (0);
  return x || (1);
  return x || (-1);
  return x || (5);
  return x && (0);
  return x && (1);
  return x && (-1);
  return x && (5);
}


x86 assembly (clang, -O0):
<test20>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <test20+0x20>
mov    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1120 <test20+0x20>
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test20>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @test20(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
%7 = phi i1 [ false, %1 ], [ true, %5 ]
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @test20(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct _reent {
  int dummy;
};

/* Variables and functions */
void *BT_kMalloc(size_t);
void *_malloc_r(struct _reent *r, size_t size) {
  void *new = BT_kMalloc(size);
  ;
  return new;
}


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

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

LLVM IR (-O0):
%struct._reent = type { i32 }
define i8* @_malloc_r(%struct._reent* %0, i64 %1) {
%3 = alloca %struct._reent*
%4 = alloca i64
%5 = alloca i8*
store %struct._reent* %0, %struct._reent** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @BT_kMalloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
ret i8* %8
}

LLVM IR (-O2):
%struct._reent = type { i32 }
define i8* @_malloc_r(%struct._reent* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @BT_kMalloc(i64 %1)
ret i8* %3
}
/* Variables and functions */
int api0(int);
int timer_new(void) { return api0(100); }


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

x86 assembly (clang, -O2):
<timer_new>:
mov    $0x64,%edi
jmp    1030 <api0@plt>

LLVM IR (-O0):
define i32 @timer_new() {
%1 = call i32 @api0(i32 100)
ret i32 %1
}

LLVM IR (-O2):
define i32 @timer_new() {
%1 = tail call i32 @api0(i32 100)
ret i32 %1
}
extern char LowerCase(char c) {
  if (c >= 'A' && c <= 'Z')
    return c + ('a' - 'A');
  return c;
}


x86 assembly (clang, -O0):
<LowerCase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <LowerCase+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <LowerCase+0x33>
movsbl -0x2(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1139 <LowerCase+0x39>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LowerCase>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @LowerCase(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = add nsw i32 %13, 32
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %18
16: ; preds = %7, %1
%17 = load i8, i8* %3
store i8 %17, i8* %2
br label %18
18: ; preds = %16, %11
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @LowerCase(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
double DSConvertZUnitsToMM(int z, int zUnits) { return z * zUnits / 1000.0; }


x86 assembly (clang, -O0):
<DSConvertZUnitsToMM>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xee3(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DSConvertZUnitsToMM>:
imul   %esi,%edi
cvtsi2sd %edi,%xmm0
divsd  0xef1(%rip),%xmm0
ret

LLVM IR (-O0):
define double @DSConvertZUnitsToMM(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 = mul nsw i32 %5, %6
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 1.000000e+03
ret double %9
}

LLVM IR (-O2):
define double @DSConvertZUnitsToMM(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 1.000000e+03
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int32_t WriteUint8Be(uint8_t value, void *out) {
  assert(out != NULL);
  uint8_t *buf = (uint8_t *)out;
  buf[0] = value;
  return 1;
}


x86 assembly (clang, -O0):
<WriteUint8Be>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteUint8Be>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
mov    %ebp,(%rbx)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @WriteUint8Be(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %5
%12 = load i32, i32* %3
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 %12, i32* %14
ret i32 1
}

LLVM IR (-O2):
define i32 @WriteUint8Be(i32 %0, i8* writeonly %1) {
%3 = icmp ne i8* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = bitcast i8* %1 to i32*
store i32 %0, i32* %6
ret i32 1
}
int addDigits(int num) {
  int x;
  x = 1 + (num - 1) % 9;
  return x;
}


x86 assembly (clang, -O0):
<addDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addDigits>:
add    $0xffffffff,%edi
movslq %edi,%rax
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @addDigits(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = srem i32 %2, 9
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ pfan_draw_text(char *, int /*<<< orphan*/, int,
                                  unsigned short *);
void Test_textNoChar(unsigned short display[156]) {
  pfan_draw_text("", 0, 1, display);
}


x86 assembly (clang, -O0):
<Test_textNoChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xed9(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <pfan_draw_text@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test_textNoChar>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <pfan_draw_text@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @Test_textNoChar(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = call i32 @pfan_draw_text(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i16* %3)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @Test_textNoChar(i16* %0) {
%2 = tail call i32 @pfan_draw_text(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i16* %0)
ret void
}
/* Variables and functions */
char is_blank(char const);
char is_blank_string(const char *c) {
  char result = 1;
  while (result && (*c != '\0')) {
    result &= is_blank(*c);
    c++;
  }
  return result;
}


x86 assembly (clang, -O0):
<is_blank_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x1,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     1142 <is_blank_string+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1152 <is_blank_string+0x42>
jmp    117b <is_blank_string+0x6b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_blank@plt>
movsbl %al,%ecx
movsbl -0x9(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <is_blank_string+0x10>
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_blank_string>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
test   %al,%al
je     113b <is_blank_string+0x2b>
movsbl %al,%edi
call   1030 <is_blank@plt>
add    $0x1,%rbx
test   $0x1,%al
jne    1120 <is_blank_string+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @is_blank_string(i8* nocapture %0) {
br label %2
2: ; preds = %1, %6
%3 = phi i8* [ %0, %1 ], [ %9, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call signext i8 @is_blank(i8 signext %4)
%8 = and i8 %7, 1
%9 = getelementptr inbounds i8, i8* %3, i64 1
%10 = icmp eq i8 %8, 0
br i1 %10, label %11, label %2
11: ; preds = %6, %2
%12 = phi i8 [ 0, %6 ], [ 1, %2 ]
ret i8 %12
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void signal_handler(int n) {
  fprintf(stderr, "got signal %d\n", n);
  _exit(1);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%edx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"got signal %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"got signal %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @_exit(i32 1)
unreachable
}
void roadmap_start_export_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @roadmap_start_export_reset() {
ret void
}
int my_str_islower(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] >= 'a' && str[i] <= 'z')
      i++;
    else
      return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<my_str_islower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116d <my_str_islower+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     115c <my_str_islower+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     115c <my_str_islower+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <my_str_islower+0x68>
movl   $0x0,-0x4(%rbp)
jmp    1174 <my_str_islower+0x74>
jmp    110f <my_str_islower+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_str_islower>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1123 <my_str_islower+0x23>
add    $0x1,%rdi
nop
add    $0x9f,%cl
cmp    $0x1a,%cl
jae    1124 <my_str_islower+0x24>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <my_str_islower+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @my_str_islower(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %33, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 97
br i1 %20, label %21, label %32
21: ; preds = %13
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 122
br i1 %28, label %29, label %32
29: ; preds = %21
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %33
32: ; preds = %21, %13
store i32 0, i32* %2
br label %35
33: ; preds = %29
br label %5
34: ; preds = %5
store i32 1, i32* %2
br label %35
35: ; preds = %34, %32
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @my_str_islower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %13
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1, %4
%9 = phi i64 [ %13, %4 ], [ 0, %1 ]
%10 = phi i8 [ %6, %4 ], [ %2, %1 ]
%11 = add i8 %10, -97
%12 = icmp ult i8 %11, 26
%13 = add nuw i64 %9, 1
br i1 %12, label %4, label %14
14: ; preds = %8, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %8 ]
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ bson_parse_integer_64(char const *);
int64_t bson_parse_date(const char *cur) { return bson_parse_integer_64(cur); }


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

x86 assembly (clang, -O2):
<bson_parse_date>:
jmp    1030 <bson_parse_integer_64@plt>

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

LLVM IR (-O2):
define i32 @bson_parse_date(i8* %0) {
%2 = tail call i32 @bson_parse_integer_64(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write_err(char const *);
void error(const char *msg) {
  write_err("sysloglwrite: Error: ");
  write_err(msg);
  write_err("\n");
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <write_err@plt>
mov    -0x8(%rbp),%rdi
call   1030 <write_err@plt>
lea    0xede(%rip),%rdi
call   1030 <write_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <write_err@plt>
mov    %rbx,%rdi
call   1030 <write_err@plt>
lea    0xee7(%rip),%rdi
pop    %rbx
jmp    1030 <write_err@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"sysloglwrite: Error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @write_err(i8* %4)
%6 = call i32 @write_err(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"sysloglwrite: Error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0) {
%2 = tail call i32 @write_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @write_err(i8* %0)
%4 = tail call i32 @write_err(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_serverbyte();
void get_serverdata(void *data, int size) {
  char *p;
  for (p = data; size > 0; size--)
    *(p++) = get_serverbyte();
}


x86 assembly (clang, -O0):
<get_serverdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1159 <get_serverdata+0x49>
mov    $0x0,%al
call   1030 <get_serverbyte@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <get_serverdata+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_serverdata>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1135 <get_serverdata+0x25>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
nop
xor    %eax,%eax
call   1030 <get_serverbyte@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1120 <get_serverdata+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @get_serverdata(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8* [ %9, %4 ], [ %0, %2 ]
%6 = phi i32 [ %10, %4 ], [ %1, %2 ]
%7 = tail call i32 (...) @get_serverbyte()
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %5
%10 = add nsw i32 %6, -1
%11 = icmp ugt i32 %6, 1
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int si_pid;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, char *, int);
char *strsignal(int);
void catchGrantPermission(int sig, siginfo_t *info, void *more) {
  printf("%d received granted permission signal (%s) from %d\n", getpid(),
         strsignal(sig), info->si_pid);
}


x86 assembly (clang, -O0):
<catchGrantPermission>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strsignal@plt>
mov    -0x1c(%rbp),%esi
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catchGrantPermission>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1050 <strsignal@plt>
mov    (%r14),%ecx
lea    0xead(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@.str = [52 x i8] c"%d received granted permission signal (%s) from %d\0A\00"
define void @catchGrantPermission(i32 %0, %struct.TYPE_3__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
store i32 %0, i32* %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i8* %2, i8** %6
%7 = call i32 (...) @getpid()
%8 = load i32, i32* %4
%9 = call i8* @strsignal(i32 %8)
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %9, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@.str = [52 x i8] c"%d received granted permission signal (%s) from %d\0A\00"
define void @catchGrantPermission(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @getpid()
%5 = tail call i8* @strsignal(i32 %0)
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %5, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage:\n");
  printf(" itdbadddir -create <database> <photodb> <file ...>\n");
  printf(" itdbadddir <database> <photodb> <file ...>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [53 x i8] c" itdbadddir -create <database> <photodb> <file ...>\0A\00"
@.str.2 = [45 x i8] c" itdbadddir <database> <photodb> <file ...>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.3 = [52 x i8] c" itdbadddir -create <database> <photodb> <file ...>\00"
@str.4 = [44 x i8] c" itdbadddir <database> <photodb> <file ...>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ NRF24_InsWrite(int, int /*<<< orphan*/ const *, int);
void NRF24_Set_TX_Addr(const uint8_t *tx_addr) {
  NRF24_InsWrite(0x20 | 0x10, tx_addr, 5);
}


x86 assembly (clang, -O0):
<NRF24_Set_TX_Addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x30,%edi
mov    $0x5,%edx
call   1030 <NRF24_InsWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NRF24_Set_TX_Addr>:
mov    %rdi,%rsi
mov    $0x30,%edi
mov    $0x5,%edx
jmp    1030 <NRF24_InsWrite@plt>

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

LLVM IR (-O2):
define void @NRF24_Set_TX_Addr(i32* %0) {
%2 = tail call i32 @NRF24_InsWrite(i32 48, i32* %0, i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_spaces(int n) {
  for (int i = 0; i < n; ++i)
    putchar(' ');
}


x86 assembly (clang, -O0):
<print_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <print_spaces+0x36>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_spaces+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spaces>:
push   %rbx
test   %edi,%edi
jle    112f <print_spaces+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <print_spaces+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_spaces(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @putchar(i8 signext 32)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int socketcall_cp(int (*)(int, struct sockaddr const *, int /*<<< orphan*/),
                  int, struct sockaddr const *, int /*<<< orphan*/,
                  int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int connect(int fd, const struct sockaddr *addr, socklen_t len) {
  return socketcall_cp(connect, fd, addr, len, 0, 0, 0);
}


x86 assembly (clang, -O0):
<connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    0x2eb5(%rip),%rdi
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <socketcall_cp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect>:
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
movl   $0x0,(%rsp)
mov    0x2ec2(%rip),%rdi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <socketcall_cp@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32, i32* %6
%10 = call i32 @socketcall_cp(i32 (i32, %struct.sockaddr*, i32)* @connect, i32 %7, %struct.sockaddr* %8, i32 %9, i32 0, i32 0, i32 0)
ret i32 %10
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @socketcall_cp(i32 (i32, %struct.sockaddr*, i32)* @connect, i32 %0, %struct.sockaddr* %1, i32 %2, i32 0, i32 0, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_11504() {
  Assert_real((isqrt(11504) == 107),
              "/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/stdlib/isqrt.c",
              1520, ("Integer square root of 11504 should be 107"));
}


x86 assembly (clang, -O0):
<t_sqrt_11504>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2cf0,%edi
call   1030 <isqrt@plt>
cmp    $0x6b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x5f0,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_11504>:
push   %rax
mov    $0x2cf0,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x6b,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x5f0,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [43 x i8] c"Integer square root of 11504 should be 107\00"
define void @t_sqrt_11504() {
%1 = call i32 @isqrt(i32 11504)
%2 = icmp eq i32 %1, 107
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1520, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [43 x i8] c"Integer square root of 11504 should be 107\00"
define void @t_sqrt_11504() {
%1 = tail call i32 @isqrt(i32 11504)
%2 = icmp eq i32 %1, 107
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1520, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printMessage(char *);
int /*<<< orphan*/ scanf(char *, int *);
int readNumber(char msg[]) {
  printMessage(msg);
  int *digit = (int *)malloc(sizeof(int));
  scanf("%d", digit);
  return *digit;
}


x86 assembly (clang, -O0):
<readNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printMessage@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readNumber>:
push   %rbx
call   1030 <printMessage@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rdi
mov    %rax,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @readNumber(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printMessage(i8* %4)
%6 = call i64 @malloc(i32 4)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @readNumber(i8* %0) {
%2 = tail call i32 @printMessage(i8* %0)
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
ret i32 %6
}
unsigned char *CopySequence(sequence, lsequence)
unsigned char *sequence;
int lsequence;
{
  unsigned char *s = AllocateSequenceMemory(lsequence);
  memcpy(s, sequence, (lsequence + 1) * sizeof(unsigned char));
  return s;
}


x86 assembly (clang, -O0):
<CopySequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1030 <AllocateSequenceMemory@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
shl    $0x0,%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CopySequence>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
xor    %eax,%eax
call   1030 <AllocateSequenceMemory@plt>
movslq %eax,%rdi
add    $0x1,%ebx
movslq %ebx,%rdx
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
define i8* @CopySequence(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 (i32, ...) bitcast (i32 (...)* @AllocateSequenceMemory to i32 (i32, ...)*)(i32 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 1
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @CopySequence(i8* nocapture %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @AllocateSequenceMemory to i32 (i32, ...)*)(i32 %1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = add nsw i32 %1, 1
%7 = sext i32 %6 to i64
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 %0, i64 %7, i1 false)
ret i8* %5
}
void func_nothing(void) {}


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

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

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

LLVM IR (-O2):
define void @func_nothing() {
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  long quot;
  long rem;
};
typedef TYPE_1__ ldiv_t;

/* Variables and functions */
ldiv_t ldiv(long num, long denom) {
  ldiv_t result;
  result.quot = num / denom;
  result.rem = num % denom;
  return result;
}


x86 assembly (clang, -O0):
<ldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldiv>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1115 <ldiv+0x15>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64 }
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = sdiv i64 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = srem i64 %10, %11
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 %12, i64* %13
%14 = bitcast %struct.TYPE_3__* %3 to { i64, i64 }*
%15 = load { i64, i64 }, { i64, i64 }* %14
ret { i64, i64 } %15
}

LLVM IR (-O2):
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = srem i64 %0, %1
%5 = insertvalue { i64, i64 } poison, i64 %3, 0
%6 = insertvalue { i64, i64 } %5, i64 %4, 1
ret { i64, i64 } %6
}