#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_CUR;
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ v_printf(int, char *, int, ...);
int NESSeekAheadNTiles(FILE *ifile, int n) {
  v_printf(3, "NESSeekAheadNTiles(ifile=%08x, n=%d)", ifile, n);
  v_printf(4, "Seeking ahead: %d", 16 * n);
  return fseek(ifile, 16 * n, SEEK_CUR);
}


x86 assembly (clang, -O0):
<NESSeekAheadNTiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edx
mov    -0xc(%rbp),%ecx
mov    $0x3,%edi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1040 <v_printf@plt>
mov    -0xc(%rbp),%edx
shl    $0x4,%edx
mov    $0x4,%edi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1040 <v_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x4,%esi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
call   1030 <fseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NESSeekAheadNTiles>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xed0(%rip),%rsi
mov    $0x3,%edi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <v_printf@plt>
shl    $0x4,%ebx
lea    0xeda(%rip),%rsi
mov    $0x4,%edi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <v_printf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fseek@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"NESSeekAheadNTiles(ifile=%08x, n=%d)\00"
@.str.1 = [18 x i8] c"Seeking ahead: %d\00"
@SEEK_CUR = global i32 0
define i32 @NESSeekAheadNTiles(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i32
%7 = load i32, i32* %4
%8 = call i32 (i32, i8*, i32, ...) @v_printf(i32 3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %4
%10 = mul nsw i32 16, %9
%11 = call i32 (i32, i8*, i32, ...) @v_printf(i32 4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = mul nsw i32 16, %13
%15 = load i32, i32* @SEEK_CUR
%16 = call i32 @fseek(i32* %12, i32 %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
@.str = [37 x i8] c"NESSeekAheadNTiles(ifile=%08x, n=%d)\00"
@.str.1 = [18 x i8] c"Seeking ahead: %d\00"
@SEEK_CUR = global i32 0
define i32 @NESSeekAheadNTiles(i32* %0, i32 %1) {
%3 = ptrtoint i32* %0 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 (i32, i8*, i32, ...) @v_printf(i32 3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %1)
%6 = shl nsw i32 %1, 4
%7 = tail call i32 (i32, i8*, i32, ...) @v_printf(i32 4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @SEEK_CUR
%9 = tail call i32 @fseek(i32* %0, i32 %6, i32 %8)
ret i32 %9
}