#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 /*<<< orphan*/ fread(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void *malloc(int);
int /*<<< orphan*/ *stdin;
void skip(FILE *f, int len) {
  if (f != stdin) {
    fseek(f, len, SEEK_CUR);
  } else {
    void *buf = malloc(len);
    fread(buf, len, 1, f);
    free(buf);
  }
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
je     117d <skip+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
jmp    11a7 <skip+0x67>
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2e90(%rip),%rax
cmp    %rdi,(%rax)
je     116c <skip+0x2c>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <fseek@plt>
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@stdin = global i32* null
@SEEK_CUR = global i32 0
define void @skip(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** @stdin
%8 = icmp ne i32* %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = load i32, i32* @SEEK_CUR
%13 = call i32 @fseek(i32* %10, i32 %11, i32 %12)
br label %23
14: ; preds = %2
%15 = load i32, i32* %4
%16 = call i8* @malloc(i32 %15)
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i32, i32* %4
%19 = load i32*, i32** %3
%20 = call i32 @fread(i8* %17, i32 %18, i32 1, i32* %19)
%21 = load i8*, i8** %5
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %14, %9
ret void
}

LLVM IR (-O2):
@stdin = global i32* null
@SEEK_CUR = global i32 0
define void @skip(i32* nocapture %0, i32 %1) {
%3 = load i32*, i32** @stdin
%4 = icmp eq i32* %3, %0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @SEEK_CUR
%7 = tail call i32 @fseek(i32* %0, i32 %1, i32 %6)
br label %12
8: ; preds = %2
%9 = tail call i8* @malloc(i32 %1)
%10 = tail call i32 @fread(i8* %9, i32 %1, i32 1, i32* %0)
%11 = tail call i32 @free(i8* %9)
br label %12
12: ; preds = %8, %5
ret void
}