#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 BUFSIZ;
int /*<<< orphan*/ read_or_die(char *, int);
void skip(int size) {
  char buf[BUFSIZ];
  int r;
  while (size) {
    r = size > BUFSIZ ? BUFSIZ : size;
    read_or_die(buf, r);
    size -= r;
  };
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     119c <skip+0x8c>
mov    -0x4(%rbp),%eax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
jle    1174 <skip+0x64>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
jmp    117a <skip+0x6a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
call   1030 <read_or_die@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <skip+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2ebb(%rip),%r13
mov    0x0(%r13),%r15d
mov    %rsp,%r14
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
test   %edi,%edi
je     117a <skip+0x6a>
mov    %edi,%r12d
cmp    %edi,%r15d
cmovge %edi,%r15d
mov    %r14,%rdi
mov    %r15d,%esi
call   1030 <read_or_die@plt>
sub    %r15d,%r12d
je     117a <skip+0x6a>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%ebx
cmp    %ebx,%r12d
cmovle %r12d,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <read_or_die@plt>
sub    %ebx,%r12d
jne    1160 <skip+0x50>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@BUFSIZ = global i32 0
define void @skip(i32 %0) {
%2 = load i32, i32* @BUFSIZ
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = icmp eq i32 %0, 0
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = icmp slt i32 %2, %0
%8 = select i1 %7, i32 %2, i32 %0
%9 = call i32 @read_or_die(i8* %4, i32 %8)
%10 = sub nsw i32 %0, %8
%11 = icmp eq i32 %10, 0
br i1 %11, label %20, label %12
12: ; preds = %6, %12
%13 = phi i32 [ %18, %12 ], [ %10, %6 ]
%14 = load i32, i32* @BUFSIZ
%15 = icmp sgt i32 %13, %14
%16 = select i1 %15, i32 %14, i32 %13
%17 = call i32 @read_or_die(i8* %4, i32 %16)
%18 = sub nsw i32 %13, %16
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %6, %1
ret void
}