#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*/ qread(unsigned char *, char *, int);
long long readlonglong(unsigned char *infile) {
  int i;
  long long a;
  unsigned char b[8];
  for (i = 0; i < 8; i++)
    qread(infile, (char *)&b[i], 1);
  a = b[0];
  for (i = 1; i < 8; i++)
    a = (a << 8) + b[i];
  return (a);
}


x86 assembly (clang, -O0):
<readlonglong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1154 <readlonglong+0x44>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
lea    -0x20(%rbp),%rsi
add    %rax,%rsi
mov    $0x1,%edx
call   1030 <qread@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <readlonglong+0x13>
movzbl -0x20(%rbp),%eax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1193 <readlonglong+0x83>
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
movslq -0xc(%rbp),%rcx
movzbl -0x20(%rbp,%rcx,1),%ecx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <readlonglong+0x53>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readlonglong>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0x9(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xa(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xb(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xd(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <qread@plt>
movzbl 0x8(%rsp),%eax
movzbl 0x9(%rsp),%ecx
shl    $0x10,%eax
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0xa(%rsp),%eax
or     %ecx,%eax
movzbl 0xb(%rsp),%ecx
shl    $0x10,%rax
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0xc(%rsp),%eax
or     %rcx,%rax
movzbl 0xd(%rsp),%ecx
shl    $0x10,%rax
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0xe(%rsp),%edx
or     %rcx,%rdx
shl    $0x8,%rdx
movzbl 0xf(%rsp),%eax
or     %rdx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @readlonglong(i8* %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = call i32 @qread(i8* %0, i8* %3, i32 1)
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
%6 = call i32 @qread(i8* %0, i8* %5, i32 1)
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
%8 = call i32 @qread(i8* %0, i8* %7, i32 1)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
%10 = call i32 @qread(i8* %0, i8* %9, i32 1)
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
%12 = call i32 @qread(i8* %0, i8* %11, i32 1)
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
%14 = call i32 @qread(i8* %0, i8* %13, i32 1)
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
%16 = call i32 @qread(i8* %0, i8* %15, i32 1)
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
%18 = call i32 @qread(i8* %0, i8* %17, i32 1)
%19 = load i8, i8* %3
%20 = zext i8 %19 to i64
%21 = load i8, i8* %5
%22 = zext i8 %21 to i64
%23 = shl nuw nsw i64 %20, 16
%24 = shl nuw nsw i64 %22, 8
%25 = or i64 %23, %24
%26 = load i8, i8* %7
%27 = zext i8 %26 to i64
%28 = or i64 %25, %27
%29 = load i8, i8* %9
%30 = zext i8 %29 to i64
%31 = shl nuw nsw i64 %28, 16
%32 = shl nuw nsw i64 %30, 8
%33 = or i64 %31, %32
%34 = load i8, i8* %11
%35 = zext i8 %34 to i64
%36 = or i64 %33, %35
%37 = load i8, i8* %13
%38 = zext i8 %37 to i64
%39 = shl i64 %36, 16
%40 = shl nuw nsw i64 %38, 8
%41 = or i64 %39, %40
%42 = load i8, i8* %15
%43 = zext i8 %42 to i64
%44 = or i64 %41, %43
%45 = shl i64 %44, 8
%46 = load i8, i8* %17
%47 = zext i8 %46 to i64
%48 = or i64 %45, %47
ret i64 %48
}