#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 scalar_t__ off_t;

/* Variables and functions */
scalar_t__ _mksparse(int, scalar_t__, int, char **);
int _usage();
int getopt(int, char **, char *);
char *optarg;
int optind;
scalar_t__ strtol(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int force = 0;
  int o;
  off_t size = 0;
  char *p;
  while ((o = getopt(argc, argv, "fs:")) != -1)
    switch (o) {
    case 'f':
      force = 1;
      break;
    case 's':
      size = strtol(optarg, &p, 0);
      if (*optarg == '\0' || *p != '\0')
        return _usage();
      break;
    default:
      return _usage();
    }
  if (optind == argc || size < 0)
    return _usage();
  return (_mksparse(force, size, argc - optind, &argv[optind]) == 0) ? 0 : 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     121c <main+0xdc>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x66,%eax
je     11a9 <main+0x69>
jmp    1198 <main+0x58>
mov    -0x2c(%rbp),%eax
sub    $0x73,%eax
je     11b5 <main+0x75>
jmp    1208 <main+0xc8>
movl   $0x1,-0x14(%rbp)
jmp    1217 <main+0xd7>
mov    0x2e3c(%rip),%rax
mov    (%rax),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f4 <main+0xb4>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1203 <main+0xc3>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x149>
jmp    1217 <main+0xd7>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x149>
jmp    1165 <main+0x25>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     1239 <main+0xf9>
cmpq   $0x0,-0x20(%rbp)
jge    1248 <main+0x108>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x149>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    0x2d87(%rip),%rax
sub    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    0x2d7a(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1060 <_mksparse@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xe9f(%rip),%r12
mov    0x2e90(%rip),%r15
lea    0x10(%rsp),%r13
xor    %ebx,%ebx
nop
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
cmp    $0x73,%eax
jne    11a6 <main+0x66>
mov    (%r15),%rdi
mov    %r13,%rsi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,%rbx
mov    (%r15),%rax
cmpb   $0x0,(%rax)
je     11ff <main+0xbf>
mov    0x10(%rsp),%rax
cmpb   $0x0,(%rax)
je     1170 <main+0x30>
jmp    11ff <main+0xbf>
cmp    $0xffffffff,%eax
je     11bc <main+0x7c>
cmp    $0x66,%eax
jne    11ff <main+0xbf>
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
jmp    1170 <main+0x30>
mov    0x2e1d(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
je     11ff <main+0xbf>
test   %rbx,%rbx
js     11ff <main+0xbf>
sub    %eax,%ebp
lea    (%r14,%rax,8),%rcx
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <_mksparse@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_usage@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"fs:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i64 0, i64* %8
br label %10
10: ; preds = %35, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %7
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %36
15: ; preds = %10
%16 = load i32, i32* %7
switch i32 %16, label %33 [
i32 102, label %17
i32 115, label %18
]
17: ; preds = %15
store i32 1, i32* %6
br label %35
18: ; preds = %15
%19 = load i8*, i8** @optarg
%20 = call i64 @strtol(i8* %19, i8** %9, i32 0)
store i64 %20, i64* %8
%21 = load i8*, i8** @optarg
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %18
%26 = load i8*, i8** %9
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25, %18
%31 = call i32 (...) @_usage()
store i32 %31, i32* %3
br label %59
32: ; preds = %25
br label %35
33: ; preds = %15
%34 = call i32 (...) @_usage()
store i32 %34, i32* %3
br label %59
35: ; preds = %32, %17
br label %10
36: ; preds = %10
%37 = load i32, i32* @optind
%38 = load i32, i32* %4
%39 = icmp eq i32 %37, %38
br i1 %39, label %43, label %40
40: ; preds = %36
%41 = load i64, i64* %8
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40, %36
%44 = call i32 (...) @_usage()
store i32 %44, i32* %3
br label %59
45: ; preds = %40
%46 = load i32, i32* %6
%47 = load i64, i64* %8
%48 = load i32, i32* %4
%49 = load i32, i32* @optind
%50 = sub nsw i32 %48, %49
%51 = load i8**, i8*** %5
%52 = load i32, i32* @optind
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = call i64 @_mksparse(i32 %46, i64 %47, i32 %50, i8** %54)
%56 = icmp eq i64 %55, 0
%57 = zext i1 %56 to i64
%58 = select i1 %56, i32 0, i32 2
store i32 %58, i32* %3
br label %59
59: ; preds = %45, %43, %33, %30
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str = [4 x i8] c"fs:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
br label %5
5: ; preds = %8, %2
%6 = phi i32 [ 0, %2 ], [ 1, %8 ]
%7 = phi i64 [ 0, %2 ], [ %9, %8 ]
br label %8
8: ; preds = %5, %17
%9 = phi i64 [ %13, %17 ], [ %7, %5 ]
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %23 [
i32 -1, label %25
i32 102, label %5
i32 115, label %11
]
11: ; preds = %8
%12 = load i8*, i8** @optarg
%13 = call i64 @strtol(i8* %12, i8** %3, i32 0)
%14 = load i8*, i8** @optarg
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %8, label %21
21: ; preds = %17, %11
%22 = tail call i32 (...) @_usage()
br label %39
23: ; preds = %8
%24 = tail call i32 (...) @_usage()
br label %39
25: ; preds = %8
%26 = load i32, i32* @optind
%27 = icmp eq i32 %26, %0
%28 = icmp slt i64 %9, 0
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = tail call i32 (...) @_usage()
br label %39
32: ; preds = %25
%33 = sub nsw i32 %0, %26
%34 = sext i32 %26 to i64
%35 = getelementptr inbounds i8*, i8** %1, i64 %34
%36 = tail call i64 @_mksparse(i32 %6, i64 %9, i32 %33, i8** %35)
%37 = icmp eq i64 %36, 0
%38 = select i1 %37, i32 0, i32 2
br label %39
39: ; preds = %32, %30, %23, %21
%40 = phi i32 [ %24, %23 ], [ %22, %21 ], [ %31, %30 ], [ %38, %32 ]
ret i32 %40
}