#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int rewind_file(char const *);
int /*<<< orphan*/ stderr;
int f_rewind_proc(int mode, unsigned char **sec, float *data,
                  unsigned int ndata, char *inv_out, void **local,
                  const char *arg1) {
  int i;
  if (mode >= 0) {
    i = rewind_file(arg1);
    if (i)
      fprintf(stderr, "WARNING: -rewind failed on %s\n", arg1);
    return i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_rewind_proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1186 <f_rewind_proc+0x66>
mov    0x10(%rbp),%rdi
call   1040 <rewind_file@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     117b <f_rewind_proc+0x5b>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rdx
lea    0xe8a(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <f_rewind_proc+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_rewind_proc>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
test   %edi,%edi
js     1157 <f_rewind_proc+0x37>
mov    0x20(%rsp),%r14
mov    %r14,%rdi
call   1040 <rewind_file@plt>
test   %eax,%eax
je     1157 <f_rewind_proc+0x37>
mov    %eax,%ebp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    %ebp,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"WARNING: -rewind failed on %s\0A\00"
define i32 @f_rewind_proc(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca float*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8**
%15 = alloca i8*
%16 = alloca i32
store i32 %0, i32* %9
store i8** %1, i8*** %10
store float* %2, float** %11
store i32 %3, i32* %12
store i8* %4, i8** %13
store i8** %5, i8*** %14
store i8* %6, i8** %15
%17 = load i32, i32* %9
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %7
%20 = load i8*, i8** %15
%21 = call i32 @rewind_file(i8* %20)
store i32 %21, i32* %16
%22 = load i32, i32* %16
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %15
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %24, %19
%29 = load i32, i32* %16
store i32 %29, i32* %8
br label %31
30: ; preds = %7
store i32 0, i32* %8
br label %31
31: ; preds = %30, %28
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"WARNING: -rewind failed on %s\0A\00"
define i32 @f_rewind_proc(i32 %0, i8** nocapture readnone %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5, i8* %6) {
%8 = icmp sgt i32 %0, -1
br i1 %8, label %9, label %15
9: ; preds = %7
%10 = tail call i32 @rewind_file(i8* %6)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %15
15: ; preds = %7, %9, %12
%16 = phi i32 [ %10, %12 ], [ 0, %9 ], [ 0, %7 ]
ret i32 %16
}