#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 EOF;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ panic(char *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ sys_panic(char const *);
void blast(FILE *ark, const char *ark_name, long start, long size) {
  if (0 != fseek(ark, start, SEEK_SET))
    sys_panic(ark_name);
  while (0 < size--) {
    int c = getc(ark);
    if (EOF == c)
      panic("Premature EOF or I/O error");
    putc(c, stdout);
  }
}


x86 assembly (clang, -O0):
<blast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e61(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1195 <blast+0x45>
mov    -0x10(%rbp),%rdi
call   1030 <sys_panic@plt>
jmp    119a <blast+0x4a>
mov    -0x20(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jge    11f4 <blast+0xa4>
mov    -0x8(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
cmp    -0x24(%rbp),%eax
jne    11de <blast+0x8e>
lea    0xe27(%rip),%rdi
call   1040 <panic@plt>
mov    -0x24(%rbp),%edi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
call   1050 <putc@plt>
jmp    119a <blast+0x4a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blast>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %rdx,%rsi
mov    %eax,%edx
call   1060 <fseek@plt>
test   %rax,%rax
je     1184 <blast+0x34>
mov    %r15,%rdi
call   1030 <sys_panic@plt>
test   %rbx,%rbx
jle    11df <blast+0x8f>
add    $0x1,%rbx
mov    0x2e54(%rip),%r12
lea    0xe65(%rip),%r15
mov    0x2e2e(%rip),%r13
jmp    11c5 <blast+0x75>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%esi
mov    %ebp,%edi
call   1050 <putc@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jbe    11df <blast+0x8f>
mov    %r14,%rdi
call   1070 <getc@plt>
mov    %eax,%ebp
cmp    %eax,(%r12)
jne    11b0 <blast+0x60>
mov    %r15,%rdi
call   1040 <panic@plt>
jmp    11b0 <blast+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@EOF = global i32 0
@.str = [27 x i8] c"Premature EOF or I/O error\00"
@stdout = global i32 0
define void @blast(i32* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i32*, i32** %5
%11 = load i64, i64* %7
%12 = load i32, i32* @SEEK_SET
%13 = call i64 @fseek(i32* %10, i64 %11, i32 %12)
%14 = icmp ne i64 0, %13
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i8*, i8** %6
%17 = call i32 @sys_panic(i8* %16)
br label %18
18: ; preds = %15, %4
br label %19
19: ; preds = %31, %18
%20 = load i64, i64* %8
%21 = add nsw i64 %20, -1
store i64 %21, i64* %8
%22 = icmp slt i64 0, %20
br i1 %22, label %23, label %35
23: ; preds = %19
%24 = load i32*, i32** %5
%25 = call i32 @getc(i32* %24)
store i32 %25, i32* %9
%26 = load i32, i32* @EOF
%27 = load i32, i32* %9
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 @panic(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = load i32, i32* %9
%33 = load i32, i32* @stdout
%34 = call i32 @putc(i32 %32, i32 %33)
br label %19
35: ; preds = %19
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@EOF = global i32 0
@.str = [27 x i8] c"Premature EOF or I/O error\00"
@stdout = global i32 0
define void @blast(i32* nocapture %0, i8* %1, i64 %2, i64 %3) {
%5 = load i32, i32* @SEEK_SET
%6 = tail call i64 @fseek(i32* %0, i64 %2, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @sys_panic(i8* %1)
br label %10
10: ; preds = %8, %4
%11 = icmp sgt i64 %3, 0
br i1 %11, label %12, label %24
12: ; preds = %10, %20
%13 = phi i64 [ %14, %20 ], [ %3, %10 ]
%14 = add nsw i64 %13, -1
%15 = tail call i32 @getc(i32* %0)
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %16, %15
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 @panic(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = load i32, i32* @stdout
%22 = tail call i32 @putc(i32 %15, i32 %21)
%23 = icmp ugt i64 %13, 1
br i1 %23, label %12, label %24
24: ; preds = %20, %10
ret void
}