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

/* Variables and functions */
int /*<<< orphan*/ IO_Read_BE_LONG(long *, int /*<<< orphan*/ *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int IO_Read_BE_LONGS(long *buffer, int number, FILE *fp) {
  assert(buffer && (number > 0) && fp);
  while (number > 0) {
    if (!IO_Read_BE_LONG(buffer, fp))
      return 0;
    buffer++;
    number--;
  }
  return 1;
}


x86 assembly (clang, -O0):
<IO_Read_BE_LONGS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     115d <IO_Read_BE_LONGS+0x3d>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jle    115d <IO_Read_BE_LONGS+0x3d>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
jle    11b0 <IO_Read_BE_LONGS+0x90>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <IO_Read_BE_LONG@plt>
cmp    $0x0,%eax
jne    1196 <IO_Read_BE_LONGS+0x76>
movl   $0x0,-0x4(%rbp)
jmp    11b7 <IO_Read_BE_LONGS+0x97>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    116a <IO_Read_BE_LONGS+0x4a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_Read_BE_LONGS>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %esi,%esi
setg   %cl
and    %al,%cl
test   %rdx,%rdx
setne  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%r15d
test   %ebp,%ebp
jle    1180 <IO_Read_BE_LONGS+0x60>
add    $0x1,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <IO_Read_BE_LONG@plt>
test   %eax,%eax
je     117d <IO_Read_BE_LONGS+0x5d>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1160 <IO_Read_BE_LONGS+0x40>
jmp    1180 <IO_Read_BE_LONGS+0x60>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @IO_Read_BE_LONGS(i64* %0, i32 %1, i32* %2) {
%4 = icmp ne i64* %0, null
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
%7 = icmp ne i32* %2, null
%8 = and i1 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
br i1 %5, label %11, label %20
11: ; preds = %3, %16
%12 = phi i32 [ %18, %16 ], [ %1, %3 ]
%13 = phi i64* [ %17, %16 ], [ %0, %3 ]
%14 = tail call i32 @IO_Read_BE_LONG(i64* %13, i32* %2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = getelementptr inbounds i64, i64* %13, i64 1
%18 = add nsw i32 %12, -1
%19 = icmp sgt i32 %12, 1
br i1 %19, label %11, label %20
20: ; preds = %11, %16, %3
%21 = phi i32 [ 1, %3 ], [ 1, %16 ], [ 0, %11 ]
ret i32 %21
}