#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 /*<<< orphan*/ O_RDWR;
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ ioctl(int, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
size_t optind;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ usage(int /*<<< orphan*/, int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd;
  int c = 0;
  int clear = 0;
  int setpos = 0;
  int pos = 0;
  int contr = 0;
  int cont_num = 0;
  char *string;
  printf(" TWI LCD Test Application\n\n");
  while ((c = getopt(argc, argv, "vch?d:p:")) > 0) {
    switch (c) {
    case 'v':
      printf("%s: version %s\n", argv[0], "0.1");
      exit(0);
    case 'c':
      clear++;
      break;
    case 'd':
      contr++;
      cont_num = atoi(optarg);
      break;
    case 'p':
      setpos++;
      pos = atoi(optarg);
      break;
    case 'h':
    case '?':
      usage(stdout, 0);
      break;
    default:
      fprintf(stderr, "ERROR: unkown option '%c'\n", c);
      usage(stderr, 1);
      break;
    }
  }
  fd = open("/dev/lcd", O_RDWR);
  if (fd < 0) {
    printf("Can't open dev lcd.\n");
    return -1;
  }
  if (contr) {
    ioctl(fd, 12, cont_num);
    printf(" Selected Controller\t: %d \n", cont_num);
  }
  if (clear) {
    ioctl(fd, 3, 1);
    printf(" Clearing Display\t: \n");
    sleep(1);
  }
  if (setpos) {
    ioctl(fd, 17, pos);
    printf(" Position\t\t: %d \n", pos);
  }
  string = argv[optind];
  if (string) {
    printf(" Message\t\t: %s \n", string);
    write(fd, string, strlen(string));
  }
  close(fd);
  exit(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)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xee0(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    130a <main+0x14a>
mov    -0x18(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x37,%eax
ja     12da <main+0x11a>
mov    -0x40(%rbp),%rax
lea    0xdb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea1(%rip),%rdi
lea    0xeaa(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1305 <main+0x145>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
jmp    1305 <main+0x145>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    1305 <main+0x145>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1090 <usage@plt>
jmp    1305 <main+0x145>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xe2c(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1090 <usage@plt>
jmp    120e <main+0x4e>
mov    0x2ccf(%rip),%rax
mov    (%rax),%esi
lea    0xe1a(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1345 <main+0x185>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%eax
add    $0x50,%rsp
pop    %rbp
ret
cmpl   $0x0,-0x28(%rbp)
je     1370 <main+0x1b0>
mov    -0x14(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    $0xc,%esi
call   1060 <ioctl@plt>
mov    -0x2c(%rbp),%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     13a4 <main+0x1e4>
mov    -0x14(%rbp),%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1060 <ioctl@plt>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
cmpl   $0x0,-0x20(%rbp)
je     13cf <main+0x20f>
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%edx
mov    $0x11,%esi
call   1060 <ioctl@plt>
mov    -0x24(%rbp),%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x2bfe(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1427 <main+0x267>
mov    -0x38(%rbp),%rsi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edi,%r15d
lea    0xf75(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdx
mov    %r15d,%edi
mov    %r13,%rsi
call   10c0 <getopt@plt>
test   %eax,%eax
jle    12c7 <main+0xf7>
movl   $0x0,0xc(%rsp)
lea    0xec7(%rip),%rbp
lea    0xde0(%rip),%r12
xor    %r14d,%r14d
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
xor    %ebx,%ebx
jmp    1273 <main+0xa3>
mov    0x2d8a(%rip),%rcx
mov    (%rcx),%edi
lea    0xeb6(%rip),%rsi
mov    %eax,%edx
call   1090 <fprintf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   10a0 <usage@plt>
mov    %r15d,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   10c0 <getopt@plt>
test   %eax,%eax
jle    12e4 <main+0x114>
lea    -0x3f(%rax),%ecx
cmp    $0x37,%ecx
ja     1237 <main+0x67>
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
jmp    125c <main+0x8c>
add    $0x1,%ebx
jmp    1261 <main+0x91>
add    $0x1,%r14d
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,0xc(%rsp)
jmp    1261 <main+0x91>
addl   $0x1,0x14(%rsp)
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    1261 <main+0x91>
xor    %ebx,%ebx
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
jns    133d <main+0x16d>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x0(%r13),%rsi
lea    0xdc1(%rip),%rdi
lea    0xdca(%rip),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    %eax,%ebp
test   %r14d,%r14d
jne    13bf <main+0x1ef>
test   %ebx,%ebx
jne    13ec <main+0x21c>
cmpl   $0x0,0x14(%rsp)
je     1378 <main+0x1a8>
mov    %ebp,%edi
mov    $0x11,%esi
mov    0x10(%rsp),%r14d
mov    %r14d,%edx
call   1070 <ioctl@plt>
lea    0xdcf(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c59(%rip),%rax
mov    (%rax),%rax
mov    0x0(%r13,%rax,8),%rbx
test   %rbx,%rbx
je     13b1 <main+0x1e1>
lea    0xdbc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %ebp,%edi
call   1080 <close@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    %ebp,%edi
mov    $0xc,%esi
mov    0xc(%rsp),%r14d
mov    %r14d,%edx
call   1070 <ioctl@plt>
lea    0xd47(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebx,%ebx
je     134c <main+0x17c>
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1070 <ioctl@plt>
lea    0xd77(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
cmpl   $0x0,0x14(%rsp)
jne    1353 <main+0x183>
jmp    1378 <main+0x1a8>

LLVM IR (-O0):
@.str = [28 x i8] c" TWI LCD Test Application\0A\0A\00"
@.str.1 = [9 x i8] c"vch?d:p:\00"
@.str.2 = [16 x i8] c"%s: version %s\0A\00"
@.str.3 = [4 x i8] c"0.1\00"
@optarg = global i32 0
@stdout = global i32 0
@stderr = global i32 0
@.str.4 = [27 x i8] c"ERROR: unkown option '%c'\0A\00"
@.str.5 = [9 x i8] c"/dev/lcd\00"
@O_RDWR = global i32 0
@.str.6 = [21 x i8] c"Can't open dev lcd.\0A\00"
@.str.7 = [28 x i8] c" Selected Controller\09: %d \0A\00"
@.str.8 = [22 x i8] c" Clearing Display\09: \0A\00"
@.str.9 = [18 x i8] c" Position\09\09: %d \0A\00"
@optind = global i64 0
@.str.10 = [17 x i8] c" Message\09\09: %s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %50, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 %18, i32* %7
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %51
20: ; preds = %15
%21 = load i32, i32* %7
switch i32 %21, label %44 [
i32 118, label %22
i32 99, label %28
i32 100, label %31
i32 112, label %36
i32 104, label %41
i32 63, label %41
]
22: ; preds = %20
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %20
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %50
31: ; preds = %20
%32 = load i32, i32* %11
%33 = add nsw i32 %32, 1
store i32 %33, i32* %11
%34 = load i32, i32* @optarg
%35 = call i32 @atoi(i32 %34)
store i32 %35, i32* %12
br label %50
36: ; preds = %20
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
%39 = load i32, i32* @optarg
%40 = call i32 @atoi(i32 %39)
store i32 %40, i32* %10
br label %50
41: ; preds = %20, %20
%42 = load i32, i32* @stdout
%43 = call i32 @usage(i32 %42, i32 0)
br label %50
44: ; preds = %20
%45 = load i32, i32* @stderr
%46 = load i32, i32* %7
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @stderr
%49 = call i32 @usage(i32 %48, i32 1)
br label %50
50: ; preds = %44, %41, %36, %31, %28
br label %15
51: ; preds = %15
%52 = load i32, i32* @O_RDWR
%53 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %52)
store i32 %53, i32* %6
%54 = load i32, i32* %6
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
ret i32 -1
58: ; preds = %51
%59 = load i32, i32* %11
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %67
61: ; preds = %58
%62 = load i32, i32* %6
%63 = load i32, i32* %12
%64 = call i32 @ioctl(i32 %62, i32 12, i32 %63)
%65 = load i32, i32* %12
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %61, %58
%68 = load i32, i32* %8
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %67
%71 = load i32, i32* %6
%72 = call i32 @ioctl(i32 %71, i32 3, i32 1)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%74 = call i32 @sleep(i32 1)
br label %75
75: ; preds = %70, %67
%76 = load i32, i32* %9
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %84
78: ; preds = %75
%79 = load i32, i32* %6
%80 = load i32, i32* %10
%81 = call i32 @ioctl(i32 %79, i32 17, i32 %80)
%82 = load i32, i32* %10
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %78, %75
%85 = load i8**, i8*** %5
%86 = load i64, i64* @optind
%87 = getelementptr inbounds i8*, i8** %85, i64 %86
%88 = load i8*, i8** %87
store i8* %88, i8** %13
%89 = load i8*, i8** %13
%90 = icmp ne i8* %89, null
br i1 %90, label %91, label %99
91: ; preds = %84
%92 = load i8*, i8** %13
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %92)
%94 = load i32, i32* %6
%95 = load i8*, i8** %13
%96 = load i8*, i8** %13
%97 = call i32 @strlen(i8* %96)
%98 = call i32 @write(i32 %94, i8* %95, i32 %97)
br label %99
99: ; preds = %91, %84
%100 = load i32, i32* %6
%101 = call i32 @close(i32 %100)
%102 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"vch?d:p:\00"
@.str.2 = [16 x i8] c"%s: version %s\0A\00"
@.str.3 = [4 x i8] c"0.1\00"
@optarg = global i32 0
@stdout = global i32 0
@stderr = global i32 0
@.str.4 = [27 x i8] c"ERROR: unkown option '%c'\0A\00"
@.str.5 = [9 x i8] c"/dev/lcd\00"
@O_RDWR = global i32 0
@.str.7 = [28 x i8] c" Selected Controller\09: %d \0A\00"
@.str.9 = [18 x i8] c" Position\09\09: %d \0A\00"
@optind = global i64 0
@.str.10 = [17 x i8] c" Message\09\09: %s \0A\00"
@str = [27 x i8] c" TWI LCD Test Application\0A\00"
@str.11 = [21 x i8] c" Clearing Display\09: \00"
@str.12 = [20 x i8] c"Can't open dev lcd.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %43
6: ; preds = %2, %35
%7 = phi i32 [ %41, %35 ], [ %4, %2 ]
%8 = phi i32 [ %40, %35 ], [ 0, %2 ]
%9 = phi i32 [ %39, %35 ], [ 0, %2 ]
%10 = phi i32 [ %38, %35 ], [ 0, %2 ]
%11 = phi i32 [ %37, %35 ], [ 0, %2 ]
%12 = phi i32 [ %36, %35 ], [ 0, %2 ]
switch i32 %7, label %30 [
i32 118, label %13
i32 99, label %17
i32 100, label %19
i32 112, label %23
i32 104, label %27
i32 63, label %27
]
13: ; preds = %6
%14 = load i8*, i8** %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %6
%18 = add nsw i32 %12, 1
br label %35
19: ; preds = %6
%20 = add nsw i32 %9, 1
%21 = load i32, i32* @optarg
%22 = tail call i32 @atoi(i32 %21)
br label %35
23: ; preds = %6
%24 = add nsw i32 %11, 1
%25 = load i32, i32* @optarg
%26 = tail call i32 @atoi(i32 %25)
br label %35
27: ; preds = %6, %6
%28 = load i32, i32* @stdout
%29 = tail call i32 @usage(i32 %28, i32 0)
br label %35
30: ; preds = %6
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %7)
%33 = load i32, i32* @stderr
%34 = tail call i32 @usage(i32 %33, i32 1)
br label %35
35: ; preds = %30, %27, %23, %19, %17
%36 = phi i32 [ %12, %30 ], [ %12, %27 ], [ %12, %23 ], [ %12, %19 ], [ %18, %17 ]
%37 = phi i32 [ %11, %30 ], [ %11, %27 ], [ %24, %23 ], [ %11, %19 ], [ %11, %17 ]
%38 = phi i32 [ %10, %30 ], [ %10, %27 ], [ %26, %23 ], [ %10, %19 ], [ %10, %17 ]
%39 = phi i32 [ %9, %30 ], [ %9, %27 ], [ %9, %23 ], [ %20, %19 ], [ %9, %17 ]
%40 = phi i32 [ %8, %30 ], [ %8, %27 ], [ %8, %23 ], [ %22, %19 ], [ %8, %17 ]
%41 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp sgt i32 %41, 0
br i1 %42, label %6, label %43
43: ; preds = %35, %2
%44 = phi i32 [ 0, %2 ], [ %36, %35 ]
%45 = phi i32 [ 0, %2 ], [ %37, %35 ]
%46 = phi i32 [ 0, %2 ], [ %38, %35 ]
%47 = phi i32 [ 0, %2 ], [ %39, %35 ]
%48 = phi i32 [ 0, %2 ], [ %40, %35 ]
%49 = load i32, i32* @O_RDWR
%50 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %43
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0))
ret i32 -1
54: ; preds = %43
%55 = icmp eq i32 %47, 0
br i1 %55, label %59, label %56
56: ; preds = %54
%57 = tail call i32 @ioctl(i32 %50, i32 12, i32 %48)
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %48)
br label %59
59: ; preds = %56, %54
%60 = icmp eq i32 %44, 0
br i1 %60, label %65, label %61
61: ; preds = %59
%62 = tail call i32 @ioctl(i32 %50, i32 3, i32 1)
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.11, i64 0, i64 0))
%64 = tail call i32 @sleep(i32 1)
br label %65
65: ; preds = %61, %59
%66 = icmp eq i32 %45, 0
br i1 %66, label %70, label %67
67: ; preds = %65
%68 = tail call i32 @ioctl(i32 %50, i32 17, i32 %46)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %46)
br label %70
70: ; preds = %67, %65
%71 = load i64, i64* @optind
%72 = getelementptr inbounds i8*, i8** %1, i64 %71
%73 = load i8*, i8** %72
%74 = icmp eq i8* %73, null
br i1 %74, label %79, label %75
75: ; preds = %70
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i8* %73)
%77 = tail call i32 @strlen(i8* %73)
%78 = tail call i32 @write(i32 %50, i8* %73, i32 %77)
br label %79
79: ; preds = %75, %70
%80 = tail call i32 @close(i32 %50)
%81 = tail call i32 @exit(i32 0)
unreachable
}