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

/* Variables and functions */
int /*<<< orphan*/ buffer_get_attributes(int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ get_uint32(int /*<<< orphan*/ *, int *, int *);
int read_hashed_item_info(FILE *fp, int *next_offset, uint32_t n_items) {
  int i;
  uint32_t id;
  uint32_t type;
  for (i = 0; i < n_items; i++) {
    get_uint32(fp, next_offset, &id);
    get_uint32(fp, next_offset, &type);
    buffer_get_attributes(fp, next_offset);
  }
  return 1;
}


x86 assembly (clang, -O0):
<read_hashed_item_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1183 <read_hashed_item_info+0x63>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <get_uint32@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <get_uint32@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <buffer_get_attributes@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <read_hashed_item_info+0x1a>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_hashed_item_info>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
jle    117c <read_hashed_item_info+0x5c>
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <get_uint32@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1030 <get_uint32@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <buffer_get_attributes@plt>
add    $0xffffffff,%ebx
jne    1150 <read_hashed_item_info+0x30>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @read_hashed_item_info(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %24, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = load i32*, i32** %5
%17 = call i32 @get_uint32(i32* %15, i32* %16, i32* %8)
%18 = load i32*, i32** %4
%19 = load i32*, i32** %5
%20 = call i32 @get_uint32(i32* %18, i32* %19, i32* %9)
%21 = load i32*, i32** %4
%22 = load i32*, i32** %5
%23 = call i32 @buffer_get_attributes(i32* %21, i32* %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
ret i32 1
}

LLVM IR (-O2):
define i32 @read_hashed_item_info(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %16
9: ; preds = %3, %9
%10 = phi i32 [ %14, %9 ], [ 0, %3 ]
%11 = call i32 @get_uint32(i32* %0, i32* %1, i32* %4)
%12 = call i32 @get_uint32(i32* %0, i32* %1, i32* %5)
%13 = call i32 @buffer_get_attributes(i32* %0, i32* %1)
%14 = add nuw nsw i32 %10, 1
%15 = icmp eq i32 %14, %2
br i1 %15, label %16, label %9
16: ; preds = %9, %3
ret i32 1
}