#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ input_nnybble(unsigned char *, int, unsigned char *);
int /*<<< orphan*/ qtree_bitins64(unsigned char *, int, int, long long *, int,
                                  int);
void read_bdirect64(unsigned char *infile, long long a[], int n, int nqx,
                    int nqy, unsigned char scratch[], int bit) {
  input_nnybble(infile, ((nqx + 1) / 2) * ((nqy + 1) / 2), scratch);
  qtree_bitins64(scratch, nqx, nqy, a, n, bit);
}


x86 assembly (clang, -O0):
<read_bdirect64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   %eax,%esi
mov    -0x28(%rbp),%rdx
call   1040 <input_nnybble@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    0x10(%rbp),%r9d
call   1030 <qtree_bitins64@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bdirect64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r13
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %rsi,%r15
mov    0x40(%rsp),%r12d
lea    0x1(%rbp),%eax
shr    $0x1f,%eax
add    %ebp,%eax
add    $0x1,%eax
sar    %eax
lea    0x1(%rbx),%ecx
shr    $0x1f,%ecx
lea    (%rbx,%rcx,1),%esi
add    $0x1,%esi
sar    %esi
imul   %eax,%esi
mov    %r9,%rdx
call   1040 <input_nnybble@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15,%rcx
mov    %r14d,%r8d
mov    %r12d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <qtree_bitins64@plt>

LLVM IR (-O0):
define void @read_bdirect64(i8* %0, i64* %1, i32 %2, i32 %3, i32 %4, i8* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i64*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
store i8* %0, i8** %8
store i64* %1, i64** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = load i32, i32* %11
%17 = add nsw i32 %16, 1
%18 = sdiv i32 %17, 2
%19 = load i32, i32* %12
%20 = add nsw i32 %19, 1
%21 = sdiv i32 %20, 2
%22 = mul nsw i32 %18, %21
%23 = load i8*, i8** %13
%24 = call i32 @input_nnybble(i8* %15, i32 %22, i8* %23)
%25 = load i8*, i8** %13
%26 = load i32, i32* %11
%27 = load i32, i32* %12
%28 = load i64*, i64** %9
%29 = load i32, i32* %10
%30 = load i32, i32* %14
%31 = call i32 @qtree_bitins64(i8* %25, i32 %26, i32 %27, i64* %28, i32 %29, i32 %30)
ret void
}

LLVM IR (-O2):
define void @read_bdirect64(i8* %0, i64* %1, i32 %2, i32 %3, i32 %4, i8* %5, i32 %6) {
%8 = add nsw i32 %3, 1
%9 = sdiv i32 %8, 2
%10 = add nsw i32 %4, 1
%11 = sdiv i32 %10, 2
%12 = mul nsw i32 %11, %9
%13 = tail call i32 @input_nnybble(i8* %0, i32 %12, i8* %5)
%14 = tail call i32 @qtree_bitins64(i8* %5, i32 %3, i32 %4, i64* %1, i32 %2, i32 %6)
ret void
}