#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*/ assert(int /*<<< orphan*/);
int fread(char *, int, int, int /*<<< orphan*/ *);
int IO_skip(FILE *fp, long size) {
  char c;
  assert(fp && (size >= 0));
  while (size > 0) {
    if (fread(&c, 1, 1, fp) != 1) {
      return 0;
    }
    size--;
  }
  return 1;
}


x86 assembly (clang, -O0):
<IO_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1a(%rbp)
je     114b <IO_skip+0x2b>
cmpq   $0x0,-0x18(%rbp)
setge  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
jle    119d <IO_skip+0x7d>
mov    -0x10(%rbp),%rcx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     118c <IO_skip+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <IO_skip+0x84>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1158 <IO_skip+0x38>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_skip>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setns  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
test   %rbx,%rbx
jle    1184 <IO_skip+0x64>
add    $0x1,%rbx
lea    0xf(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    118b <IO_skip+0x6b>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
jge    1160 <IO_skip+0x40>
mov    $0x1,%eax
jmp    118d <IO_skip+0x6d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @IO_skip(i32* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i8
store i32* %0, i32** %4
store i64 %1, i64* %5
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i64, i64* %5
%11 = icmp sge i64 %10, 0
br label %12
12: ; preds = %9, %2
%13 = phi i1 [ false, %2 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
br label %16
16: ; preds = %24, %12
%17 = load i64, i64* %5
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32*, i32** %4
%21 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %20)
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 0, i32* %3
br label %28
24: ; preds = %19
%25 = load i64, i64* %5
%26 = add nsw i64 %25, -1
store i64 %26, i64* %5
br label %16
27: ; preds = %16
store i32 1, i32* %3
br label %28
28: ; preds = %27, %23
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @IO_skip(i32* %0, i64 %1) {
%3 = alloca i8
%4 = icmp ne i32* %0, null
%5 = icmp sgt i64 %1, -1
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp sgt i64 %1, 0
br i1 %9, label %13, label %17
10: ; preds = %13
%11 = add nsw i64 %14, -1
%12 = icmp sgt i64 %14, 1
br i1 %12, label %13, label %17
13: ; preds = %2, %10
%14 = phi i64 [ %11, %10 ], [ %1, %2 ]
%15 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %0)
%16 = icmp eq i32 %15, 1
br i1 %16, label %10, label %17
17: ; preds = %13, %10, %2
%18 = phi i32 [ 1, %2 ], [ 1, %10 ], [ 0, %13 ]
ret i32 %18
}