#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 */
typedef int uLong;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int unzlocal_getByte(int /*<<< orphan*/ *, int *);
int unzlocal_getLong(FILE *fin, uLong *pX) {
  uLong x;
  int i = 0;
  int err;
  err = unzlocal_getByte(fin, &i);
  x = (uLong)i;
  if (err == (0))
    err = unzlocal_getByte(fin, &i);
  x += ((uLong)i) << 8;
  if (err == (0))
    err = unzlocal_getByte(fin, &i);
  x += ((uLong)i) << 16;
  if (err == (0))
    err = unzlocal_getByte(fin, &i);
  x += ((uLong)i) << 24;
  if (err == (0))
    *pX = x;
  else
    *pX = 0;
  return err;
}


x86 assembly (clang, -O0):
<unzlocal_getLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <unzlocal_getByte@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1157 <unzlocal_getLong+0x47>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <unzlocal_getByte@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x8,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    117d <unzlocal_getLong+0x6d>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <unzlocal_getByte@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11a3 <unzlocal_getLong+0x93>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <unzlocal_getByte@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x18,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11c7 <unzlocal_getLong+0xb7>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11d1 <unzlocal_getLong+0xc1>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unzlocal_getLong>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <unzlocal_getByte@plt>
mov    0xc(%rsp),%ebp
test   %eax,%eax
je     1145 <unzlocal_getLong+0x35>
mov    %ebp,%ebx
shl    $0x8,%ebx
add    %ebp,%ebx
jmp    1163 <unzlocal_getLong+0x53>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1030 <unzlocal_getByte@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,%ebx
shl    $0x8,%ebx
add    %ebp,%ebx
test   %eax,%eax
je     118a <unzlocal_getLong+0x7a>
mov    %ecx,%ebp
mov    %ebp,%r12d
shl    $0x10,%r12d
add    %ebx,%r12d
shl    $0x18,%ebp
add    %r12d,%ebp
xor    %ecx,%ecx
test   %eax,%eax
cmove  %ebp,%ecx
mov    %ecx,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1030 <unzlocal_getByte@plt>
mov    0xc(%rsp),%ebp
mov    %ebp,%r12d
shl    $0x10,%r12d
add    %ebx,%r12d
test   %eax,%eax
jne    116d <unzlocal_getLong+0x5d>
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1030 <unzlocal_getByte@plt>
mov    0xc(%rsp),%ebp
jmp    116d <unzlocal_getLong+0x5d>

LLVM IR (-O0):
define i32 @unzlocal_getLong(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
%8 = load i32*, i32** %3
%9 = call i32 @unzlocal_getByte(i32* %8, i32* %6)
store i32 %9, i32* %7
%10 = load i32, i32* %6
store i32 %10, i32* %5
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32*, i32** %3
%15 = call i32 @unzlocal_getByte(i32* %14, i32* %6)
store i32 %15, i32* %7
br label %16
16: ; preds = %13, %2
%17 = load i32, i32* %6
%18 = shl i32 %17, 8
%19 = load i32, i32* %5
%20 = add nsw i32 %19, %18
store i32 %20, i32* %5
%21 = load i32, i32* %7
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32*, i32** %3
%25 = call i32 @unzlocal_getByte(i32* %24, i32* %6)
store i32 %25, i32* %7
br label %26
26: ; preds = %23, %16
%27 = load i32, i32* %6
%28 = shl i32 %27, 16
%29 = load i32, i32* %5
%30 = add nsw i32 %29, %28
store i32 %30, i32* %5
%31 = load i32, i32* %7
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = load i32*, i32** %3
%35 = call i32 @unzlocal_getByte(i32* %34, i32* %6)
store i32 %35, i32* %7
br label %36
36: ; preds = %33, %26
%37 = load i32, i32* %6
%38 = shl i32 %37, 24
%39 = load i32, i32* %5
%40 = add nsw i32 %39, %38
store i32 %40, i32* %5
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = load i32, i32* %5
%45 = load i32*, i32** %4
store i32 %44, i32* %45
br label %48
46: ; preds = %36
%47 = load i32*, i32** %4
store i32 0, i32* %47
br label %48
48: ; preds = %46, %43
%49 = load i32, i32* %7
ret i32 %49
}

LLVM IR (-O2):
define i32 @unzlocal_getLong(i32* %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @unzlocal_getByte(i32* %0, i32* %3)
%6 = load i32, i32* %3
%7 = icmp eq i32 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = mul i32 %6, 257
br label %16
10: ; preds = %2
%11 = call i32 @unzlocal_getByte(i32* %0, i32* %3)
%12 = load i32, i32* %3
%13 = shl i32 %12, 8
%14 = add nsw i32 %13, %6
%15 = icmp eq i32 %11, 0
br i1 %15, label %22, label %16
16: ; preds = %10, %8
%17 = phi i32 [ %6, %8 ], [ %12, %10 ]
%18 = phi i32 [ %9, %8 ], [ %14, %10 ]
%19 = phi i32 [ %5, %8 ], [ %11, %10 ]
%20 = shl i32 %17, 16
%21 = add nsw i32 %20, %18
br label %31
22: ; preds = %10
%23 = call i32 @unzlocal_getByte(i32* %0, i32* %3)
%24 = load i32, i32* %3
%25 = shl i32 %24, 16
%26 = add nsw i32 %25, %14
%27 = icmp eq i32 %23, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @unzlocal_getByte(i32* %0, i32* %3)
%30 = load i32, i32* %3
br label %31
31: ; preds = %16, %28, %22
%32 = phi i32 [ %30, %28 ], [ %24, %22 ], [ %17, %16 ]
%33 = phi i32 [ %26, %28 ], [ %26, %22 ], [ %21, %16 ]
%34 = phi i32 [ %29, %28 ], [ %23, %22 ], [ %19, %16 ]
%35 = icmp eq i32 %34, 0
%36 = shl i32 %32, 24
%37 = add nsw i32 %36, %33
%38 = select i1 %35, i32 %37, i32 0
store i32 %38, i32* %1
ret i32 %34
}