#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 */
scalar_t__ ENODEV;
scalar_t__ ENXIO;
int /*<<< orphan*/ O_RDONLY;
int atoi(char *);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int open(char *, int /*<<< orphan*/);
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  char *dev = NULL;
  int check_interval = 100;
  int number_of_checks = 0;
  int verbose = 0;
  int c;
  while ((c = getopt(argc, argv, "d:i:n:vVh")) != -1) {
    switch (c) {
    case 'd':
      dev = optarg;
      break;
    case 'i':
      check_interval = atoi(optarg);
      if (check_interval < 0) {
        fprintf(stderr, "Error: check interval (-i) must be >= 0\n");
        return 1;
      }
      break;
    case 'n':
      number_of_checks = atoi(optarg);
      if (number_of_checks < 0) {
        fprintf(stderr, "Error: number of checks (-n) must be >= 0\n");
        return 1;
      }
      break;
    case 'v':
      verbose++;
      break;
    case 'V':
      version();
      return 0;
    case 'h':
      usage();
      return 0;
    default:
      usage();
      return 1;
    }
  }
  if (!dev) {
    fprintf(stderr, "Error: no device selected\n");
    usage();
    return 1;
  }
  for (;;) {
    int fd = open(dev, O_RDONLY);
    if (fd != -1) {
      if (verbose)
        printf("Opening device %s success\n", dev);
      return 0;
    }
    if (errno != ENODEV && errno != ENXIO) {
      fprintf(stderr, "Unexpected error while opening device %s: %s (%d)\n",
              dev, strerror(errno), errno);
      return 1;
    }
    if (verbose > 1)
      printf("Device not available (yet).\n");
    if (number_of_checks > 0) {
      if (--number_of_checks == 0) {
        if (verbose)
          printf("Failed opening device %s\n", dev);
        return 1;
      }
    }
    usleep(check_interval * 1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     12f2 <main+0x162>
mov    -0x28(%rbp),%eax
add    $0xffffffaa,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x20,%eax
ja     12da <main+0x14a>
mov    -0x38(%rbp),%rax
lea    0xdfe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2de6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    12ed <main+0x15d>
mov    0x2dd3(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    125d <main+0xcd>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
jmp    12ed <main+0x15d>
mov    0x2d8f(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    12a1 <main+0x111>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
jmp    12ed <main+0x15d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12ed <main+0x15d>
mov    $0x0,%al
call   1050 <version@plt>
movl   $0x0,-0x4(%rbp)
jmp    146a <main+0x2da>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    146a <main+0x2da>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
jmp    11c3 <main+0x33>
cmpq   $0x0,-0x18(%rbp)
jne    1327 <main+0x197>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
jmp    132c <main+0x19c>
mov    -0x18(%rbp),%rdi
mov    0x2ca9(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
je     1373 <main+0x1e3>
cmpl   $0x0,-0x24(%rbp)
je     1367 <main+0x1d7>
mov    -0x18(%rbp),%rsi
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    146a <main+0x2da>
mov    0x2c4e(%rip),%rax
mov    (%rax),%rax
mov    0x2c34(%rip),%rcx
cmp    (%rcx),%rax
je     13f8 <main+0x268>
mov    0x2c34(%rip),%rax
mov    (%rax),%rax
mov    0x2c22(%rip),%rcx
cmp    (%rcx),%rax
je     13f8 <main+0x268>
mov    0x2c22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c06(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    %rax,%rcx
mov    0x2bed(%rip),%rax
mov    (%rax),%r8
lea    0xd33(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
cmpl   $0x1,-0x24(%rbp)
jle    1410 <main+0x280>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    1459 <main+0x2c9>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    1454 <main+0x2c4>
cmpl   $0x0,-0x24(%rbp)
je     1448 <main+0x2b8>
mov    -0x18(%rbp),%rsi
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <main+0x2da>
jmp    1459 <main+0x2c9>
imul   $0x3e8,-0x1c(%rbp),%edi
call   10b0 <usleep@plt>
jmp    132c <main+0x19c>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %r14d,%r14d
mov    $0x64,%eax
lea    0xec5(%rip),%r13
mov    0x2e32(%rip),%r15
movl   $0x0,(%rsp)
xor    %r12d,%r12d
mov    %eax,0x4(%rsp)
jmp    11e3 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%r12
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r13,%rdx
call   1090 <getopt@plt>
cmp    $0x64,%eax
je     11e0 <main+0x40>
lea    -0x56(%rax),%ecx
cmp    $0x20,%ecx
ja     1251 <main+0xb1>
lea    0xdfc(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    (%r15),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
test   %eax,%eax
jns    11e3 <main+0x43>
jmp    139f <main+0x1ff>
addl   $0x1,(%rsp)
jmp    11e3 <main+0x43>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%rdi
call   10a0 <atoi@plt>
test   %eax,%eax
jns    11d0 <main+0x30>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
jmp    13af <main+0x20f>
cmp    $0xffffffff,%eax
jne    12be <main+0x11e>
test   %r12,%r12
je     12a7 <main+0x107>
mov    0x2d7e(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %r12,%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     12db <main+0x13b>
cmpl   $0x0,(%rsp)
je     136b <main+0x1cb>
lea    0xe7a(%rip),%rdi
xor    %ebx,%ebx
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12ca <main+0x12a>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <version@plt>
jmp    12ca <main+0x12a>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <usage@plt>
jmp    12ca <main+0x12a>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xe2b(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1070 <usage@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
imul   $0x3e8,0x4(%rsp),%ebx
mov    0x2cde(%rip),%r13
mov    0x2cc7(%rip),%r15
jmp    131e <main+0x17e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r14d,%r14d
mov    %ebx,%edi
call   10c0 <usleep@plt>
mov    0x0(%rbp),%esi
mov    %r12,%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
jne    1272 <main+0xd2>
mov    0x0(%r13),%rdi
cmp    (%r15),%rdi
je     1333 <main+0x193>
mov    0x2c92(%rip),%rax
cmp    (%rax),%rdi
jne    1372 <main+0x1d2>
cmpl   $0x2,(%rsp)
jl     1345 <main+0x1a5>
lea    0xe25(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    1300 <main+0x160>
add    $0xffffffff,%r14d
jne    1303 <main+0x163>
mov    $0x1,%ebx
cmpl   $0x0,(%rsp)
je     12ca <main+0x12a>
lea    0xde5(%rip),%rdi
jmp    1285 <main+0xe5>
xor    %ebx,%ebx
jmp    12ca <main+0x12a>
mov    0x2c57(%rip),%rax
mov    (%rax),%ebx
call   10b0 <strerror@plt>
mov    0x0(%r13),%r8
lea    0xd8d(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    12c5 <main+0x125>
mov    0x2c2a(%rip),%rax
mov    (%rax),%edi
lea    0xd08(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    12c5 <main+0x125>

LLVM IR (-O0):
@.str = [10 x i8] c"d:i:n:vVh\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [41 x i8] c"Error: check interval (-i) must be >= 0\0A\00"
@.str.2 = [43 x i8] c"Error: number of checks (-n) must be >= 0\0A\00"
@.str.3 = [27 x i8] c"Error: no device selected\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [27 x i8] c"Opening device %s success\0A\00"
@errno = global i64 0
@ENODEV = global i64 0
@ENXIO = global i64 0
@.str.5 = [51 x i8] c"Unexpected error while opening device %s: %s (%d)\0A\00"
@.str.6 = [29 x i8] c"Device not available (yet).\0A\00"
@.str.7 = [26 x i8] c"Failed opening device %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 100, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %48, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %10
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %49
17: ; preds = %12
%18 = load i32, i32* %10
switch i32 %18, label %46 [
i32 100, label %19
i32 105, label %21
i32 110, label %30
i32 118, label %39
i32 86, label %42
i32 104, label %44
]
19: ; preds = %17
%20 = load i8*, i8** @optarg
store i8* %20, i8** %6
br label %48
21: ; preds = %17
%22 = load i8*, i8** @optarg
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %109
29: ; preds = %21
br label %48
30: ; preds = %17
%31 = load i8*, i8** @optarg
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %109
38: ; preds = %30
br label %48
39: ; preds = %17
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
store i32 %41, i32* %9
br label %48
42: ; preds = %17
%43 = call i32 (...) @version()
store i32 0, i32* %3
br label %109
44: ; preds = %17
%45 = call i32 (...) @usage()
store i32 0, i32* %3
br label %109
46: ; preds = %17
%47 = call i32 (...) @usage()
store i32 1, i32* %3
br label %109
48: ; preds = %39, %38, %29, %19
br label %12
49: ; preds = %12
%50 = load i8*, i8** %6
%51 = icmp ne i8* %50, null
br i1 %51, label %56, label %52
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%55 = call i32 (...) @usage()
store i32 1, i32* %3
br label %109
56: ; preds = %49
br label %57
57: ; preds = %105, %56
%58 = load i8*, i8** %6
%59 = load i32, i32* @O_RDONLY
%60 = call i32 @open(i8* %58, i32 %59)
store i32 %60, i32* %11
%61 = load i32, i32* %11
%62 = icmp ne i32 %61, -1
br i1 %62, label %63, label %70
63: ; preds = %57
%64 = load i32, i32* %9
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i8*, i8** %6
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %67)
br label %69
69: ; preds = %66, %63
store i32 0, i32* %3
br label %109
70: ; preds = %57
%71 = load i64, i64* @errno
%72 = load i64, i64* @ENODEV
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %85
74: ; preds = %70
%75 = load i64, i64* @errno
%76 = load i64, i64* @ENXIO
%77 = icmp ne i64 %75, %76
br i1 %77, label %78, label %85
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %6
%81 = load i64, i64* @errno
%82 = call i8* @strerror(i64 %81)
%83 = load i64, i64* @errno
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i8* %80, i8* %82, i64 %83)
store i32 1, i32* %3
br label %109
85: ; preds = %74, %70
%86 = load i32, i32* %9
%87 = icmp sgt i32 %86, 1
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %90
90: ; preds = %88, %85
%91 = load i32, i32* %8
%92 = icmp sgt i32 %91, 0
br i1 %92, label %93, label %105
93: ; preds = %90
%94 = load i32, i32* %8
%95 = add nsw i32 %94, -1
store i32 %95, i32* %8
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %104
97: ; preds = %93
%98 = load i32, i32* %9
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load i8*, i8** %6
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %101)
br label %103
103: ; preds = %100, %97
store i32 1, i32* %3
br label %109
104: ; preds = %93
br label %105
105: ; preds = %104, %90
%106 = load i32, i32* %7
%107 = mul nsw i32 %106, 1000
%108 = call i32 @usleep(i32 %107)
br label %57
109: ; preds = %103, %78, %69, %52, %46, %44, %42, %35, %26
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str = [10 x i8] c"d:i:n:vVh\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [41 x i8] c"Error: check interval (-i) must be >= 0\0A\00"
@.str.2 = [43 x i8] c"Error: number of checks (-n) must be >= 0\0A\00"
@.str.3 = [27 x i8] c"Error: no device selected\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [27 x i8] c"Opening device %s success\0A\00"
@errno = global i64 0
@ENODEV = global i64 0
@ENXIO = global i64 0
@.str.5 = [51 x i8] c"Unexpected error while opening device %s: %s (%d)\0A\00"
@.str.7 = [26 x i8] c"Failed opening device %s\0A\00"
@str = [28 x i8] c"Device not available (yet).\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %20, %2
%4 = phi i32 [ %22, %20 ], [ 100, %2 ]
%5 = phi i32 [ %9, %20 ], [ 0, %2 ]
%6 = phi i32 [ %13, %20 ], [ 0, %2 ]
%7 = phi i8* [ %16, %20 ], [ null, %2 ]
br label %8
8: ; preds = %3, %27
%9 = phi i32 [ %5, %3 ], [ %29, %27 ]
%10 = phi i32 [ %6, %3 ], [ %13, %27 ]
%11 = phi i8* [ %7, %3 ], [ %16, %27 ]
br label %12
12: ; preds = %8, %34
%13 = phi i32 [ %10, %8 ], [ %35, %34 ]
%14 = phi i8* [ %11, %8 ], [ %16, %34 ]
br label %15
15: ; preds = %12, %18
%16 = phi i8* [ %19, %18 ], [ %14, %12 ]
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %17, label %40 [
i32 -1, label %42
i32 100, label %18
i32 105, label %20
i32 110, label %27
i32 118, label %34
i32 86, label %36
i32 104, label %38
]
18: ; preds = %15
%19 = load i8*, i8** @optarg
br label %15
20: ; preds = %15
%21 = load i8*, i8** @optarg
%22 = tail call i32 @atoi(i8* %21)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %3
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %90
27: ; preds = %15
%28 = load i8*, i8** @optarg
%29 = tail call i32 @atoi(i8* %28)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
br label %90
34: ; preds = %15
%35 = add nsw i32 %13, 1
br label %12
36: ; preds = %15
%37 = tail call i32 (...) @version()
br label %90
38: ; preds = %15
%39 = tail call i32 (...) @usage()
br label %90
40: ; preds = %15
%41 = tail call i32 (...) @usage()
br label %90
42: ; preds = %15
%43 = icmp eq i8* %16, null
br i1 %43, label %51, label %44
44: ; preds = %42
%45 = load i32, i32* @O_RDONLY
%46 = tail call i32 @open(i8* %16, i32 %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %55
48: ; preds = %44
%49 = icmp sgt i32 %13, 1
%50 = mul nsw i32 %4, 1000
br label %59
51: ; preds = %42
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%54 = tail call i32 (...) @usage()
br label %90
55: ; preds = %84, %44
%56 = icmp eq i32 %13, 0
br i1 %56, label %90, label %57
57: ; preds = %55
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %16)
br label %90
59: ; preds = %48, %84
%60 = phi i32 [ %9, %48 ], [ %85, %84 ]
%61 = load i64, i64* @errno
%62 = load i64, i64* @ENODEV
%63 = icmp eq i64 %61, %62
%64 = load i64, i64* @ENXIO
%65 = icmp eq i64 %61, %64
%66 = select i1 %63, i1 true, i1 %65
br i1 %66, label %72, label %67
67: ; preds = %59
%68 = load i32, i32* @stderr
%69 = tail call i8* @strerror(i64 %61)
%70 = load i64, i64* @errno
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i8* %16, i8* %69, i64 %70)
br label %90
72: ; preds = %59
br i1 %49, label %73, label %75
73: ; preds = %72
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %75
75: ; preds = %73, %72
%76 = icmp sgt i32 %60, 0
br i1 %76, label %77, label %84
77: ; preds = %75
%78 = add nsw i32 %60, -1
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %84
80: ; preds = %77
%81 = icmp eq i32 %13, 0
br i1 %81, label %90, label %82
82: ; preds = %80
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %16)
br label %90
84: ; preds = %75, %77
%85 = phi i32 [ %78, %77 ], [ 0, %75 ]
%86 = tail call i32 @usleep(i32 %50)
%87 = load i32, i32* @O_RDONLY
%88 = tail call i32 @open(i8* %16, i32 %87)
%89 = icmp eq i32 %88, -1
br i1 %89, label %59, label %55
90: ; preds = %80, %82, %55, %57, %67, %51, %40, %38, %36, %31, %24
%91 = phi i32 [ 1, %40 ], [ 0, %38 ], [ 0, %36 ], [ 1, %31 ], [ 1, %24 ], [ 1, %51 ], [ 1, %80 ], [ 1, %82 ], [ 0, %55 ], [ 0, %57 ], [ 1, %67 ]
ret i32 %91
}