#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*/ SEEK_SET;
scalar_t__ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ohshite(char *, char const *);
int nextentry(FILE *file, int i, int n, const char *filename) {
  i++;
  if (i != n)
    return i;
  if (fseek(file, 0, SEEK_SET))
    ohshite("Failed to rewind rewind user database `%s'", filename);
  return 0;
}


x86 assembly (clang, -O0):
<nextentry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1156 <nextentry+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <nextentry+0x6b>
mov    -0x10(%rbp),%rdi
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
cmp    $0x0,%rax
je     1184 <nextentry+0x64>
mov    -0x20(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1030 <ohshite@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextentry>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
add    $0x1,%ebx
cmp    %edx,%ebx
jne    1156 <nextentry+0x36>
mov    %rcx,%r14
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
xor    %esi,%esi
call   1040 <fseek@plt>
test   %rax,%rax
je     1156 <nextentry+0x36>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
call   1030 <ohshite@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [43 x i8] c"Failed to rewind rewind user database `%s'\00"
define i32 @nextentry(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i32, i32* %7
%11 = add nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = load i32, i32* %7
store i32 %16, i32* %5
br label %26
17: ; preds = %4
%18 = load i32*, i32** %6
%19 = load i32, i32* @SEEK_SET
%20 = call i64 @fseek(i32* %18, i32 0, i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i8*, i8** %9
%24 = call i32 @ohshite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %22, %17
store i32 0, i32* %5
br label %26
26: ; preds = %25, %15
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [43 x i8] c"Failed to rewind rewind user database `%s'\00"
define i32 @nextentry(i32* nocapture %0, i32 %1, i32 %2, i8* %3) {
%5 = add nsw i32 %1, 1
%6 = icmp eq i32 %5, %2
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* @SEEK_SET
%9 = tail call i64 @fseek(i32* %0, i32 0, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @ohshite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %13
13: ; preds = %7, %11, %4
%14 = phi i32 [ %5, %4 ], [ 0, %11 ], [ 0, %7 ]
ret i32 %14
}