#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_WRONLY;
int close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
scalar_t__ ioctl(int, char, void *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
unsigned short rand();
int /*<<< orphan*/ scanf(char *, ...);
int write(int, unsigned short *, int);
int main(int argc, char *argv[]) {
  int fd = 0;
  int chan = 0;
  int scrivi = 1;
  char scelta = 'n';
  unsigned short buff;
  unsigned short ciclo = 0;
  fd = open("/dev/mpv955", O_WRONLY);
  printf("il file descriptor e' %d\n", fd);
  if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0002), NULL) != 0)
    perror("ioctl()");
  if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0008), NULL) != 0)
    perror("ioctl()");
  while (scrivi) {
    do {
      printf("insert channel [0-7]: ");
      scanf("%d", &chan);
      getchar();
    } while ((chan < 0) || (chan > 7));
    buff = rand();
    if (write(fd, &buff, chan) <= -1) {
      printf("Errore nella scrittura\n");
    } else {
      printf("channel %d <- %X\n", chan, buff);
    }
    printf("write (y/n) ? ");
    scanf("%c", &scelta);
    if (scelta == 'y') {
      if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0001), NULL) != 0)
        perror("ioctl()");
      while (ciclo == 0) {
        if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0010), (void *)&ciclo) !=
            0)
          perror("ioctl");
      }
      ciclo = 0;
      if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0001), NULL) != 0)
        perror("ioctl()");
    }
    getchar();
    printf("exit (y/n) ? ");
    scanf("%c", &scelta);
    if (scelta == 'y') {
      scrivi = 0;
    }
    getchar();
  }
  printf("close() ha restituito %d\n", close(fd));
  exit(0);
}


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)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movb   $0x6e,-0x1d(%rbp)
movw   $0x0,-0x22(%rbp)
mov    0x2dfc(%rip),%rax
mov    (%rax),%esi
lea    0xe1b(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     1225 <main+0x85>
lea    0xe06(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x14(%rbp),%edi
mov    $0x8,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     124c <main+0xac>
lea    0xddf(%rip),%rdi
call   10a0 <perror@plt>
jmp    1251 <main+0xb1>
cmpl   $0x0,-0x1c(%rbp)
je     1401 <main+0x261>
jmp    1260 <main+0xc0>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd0(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x1,%al
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x23(%rbp)
jl     12a0 <main+0x100>
cmpl   $0x7,-0x18(%rbp)
setg   %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    1260 <main+0xc0>
mov    $0x0,%al
call   10c0 <rand@plt>
mov    %ax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
lea    -0x20(%rbp),%rsi
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jg     12e1 <main+0x141>
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f6 <main+0x156>
mov    -0x18(%rbp),%esi
movzwl -0x20(%rbp),%edx
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd76(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x79,%eax
jne    13ba <main+0x21a>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     134a <main+0x1aa>
lea    0xce1(%rip),%rdi
call   10a0 <perror@plt>
jmp    134f <main+0x1af>
movzwl -0x22(%rbp),%eax
cmp    $0x0,%eax
jne    1388 <main+0x1e8>
mov    -0x14(%rbp),%edi
lea    -0x22(%rbp),%rdx
mov    $0x10,%esi
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     1383 <main+0x1e3>
lea    0xd06(%rip),%rdi
call   10a0 <perror@plt>
jmp    134f <main+0x1af>
movw   $0x0,-0x22(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     13b5 <main+0x215>
lea    0xc76(%rip),%rdi
call   10a0 <perror@plt>
jmp    13ba <main+0x21a>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xcc2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcab(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x79,%eax
jne    13f5 <main+0x255>
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
jmp    1251 <main+0xb1>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    %eax,%esi
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movb   $0x6e,0xd(%rsp)
movw   $0x0,0xe(%rsp)
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
lea    0xe1e(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%r14d
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     121a <main+0x6a>
lea    0xe11(%rip),%rdi
call   10b0 <perror@plt>
mov    %r14d,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     123a <main+0x8a>
lea    0xdf1(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%r12d
lea    0xde7(%rip),%r15
lea    0xdf7(%rip),%rbp
lea    0x10(%rsp),%rbx
jmp    12c0 <main+0x110>
movw   $0x0,0xe(%rsp)
mov    %r14d,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
jne    13af <main+0x1ff>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xdf0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdd9(%rip),%rdi
lea    0xd(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0xd(%rsp),%r13b
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0x79,%r13b
mov    $0x0,%eax
cmove  %eax,%r12d
test   %r12d,%r12d
je     13ce <main+0x21e>
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
cmpl   $0x7,0x10(%rsp)
ja     12c0 <main+0x110>
xor    %eax,%eax
call   10d0 <rand@plt>
mov    %eax,%r13d
mov    %ax,0x16(%rsp)
mov    0x10(%rsp),%edx
mov    %r14d,%edi
lea    0x16(%rsp),%rsi
call   1040 <write@plt>
test   %eax,%eax
js     1321 <main+0x171>
mov    0x10(%rsp),%esi
movzwl %r13w,%edx
lea    0xd30(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    132d <main+0x17d>
lea    0xd72(%rip),%rdi
call   1030 <puts@plt>
lea    0xd26(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd27(%rip),%rdi
lea    0xd(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
cmpb   $0x79,0xd(%rsp)
jne    1274 <main+0xc4>
mov    %r14d,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
jne    13c0 <main+0x210>
cmpw   $0x0,0xe(%rsp)
lea    0xe(%rsp),%r13
jne    1255 <main+0xa5>
jmp    138c <main+0x1dc>
cmpw   $0x0,0xe(%rsp)
jne    1255 <main+0xa5>
mov    %r14d,%edi
mov    $0x10,%esi
mov    %r13,%rdx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1380 <main+0x1d0>
lea    0xcc4(%rip),%rdi
call   10b0 <perror@plt>
jmp    1380 <main+0x1d0>
lea    0xc70(%rip),%rdi
call   10b0 <perror@plt>
jmp    1274 <main+0xc4>
lea    0xc5f(%rip),%rdi
call   10b0 <perror@plt>
jmp    136d <main+0x1bd>
mov    %r14d,%edi
call   1070 <close@plt>
lea    0xca3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/mpv955\00"
@O_WRONLY = global i32 0
@.str.1 = [26 x i8] c"il file descriptor e' %d\0A\00"
@.str.2 = [8 x i8] c"ioctl()\00"
@.str.3 = [23 x i8] c"insert channel [0-7]: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [24 x i8] c"Errore nella scrittura\0A\00"
@.str.6 = [18 x i8] c"channel %d <- %X\0A\00"
@.str.7 = [15 x i8] c"write (y/n) ? \00"
@.str.8 = [3 x i8] c"%c\00"
@.str.9 = [6 x i8] c"ioctl\00"
@.str.10 = [14 x i8] c"exit (y/n) ? \00"
@.str.11 = [26 x i8] c"close() ha restituito %d\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 i8
%10 = alloca i16
%11 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
store i8 110, i8* %9
store i16 0, i16* %11
%12 = load i32, i32* @O_WRONLY
%13 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %6
%17 = call i64 @ioctl(i32 %16, i8 signext 2, i8* null)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %2
%22 = load i32, i32* %6
%23 = call i64 @ioctl(i32 %22, i8 signext 8, i8* null)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
br label %28
28: ; preds = %97, %27
%29 = load i32, i32* %8
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %99
31: ; preds = %28
br label %32
32: ; preds = %42, %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%35 = call i32 (...) @getchar()
br label %36
36: ; preds = %32
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* %7
%41 = icmp sgt i32 %40, 7
br label %42
42: ; preds = %39, %36
%43 = phi i1 [ true, %36 ], [ %41, %39 ]
br i1 %43, label %32, label %44
44: ; preds = %42
%45 = call zeroext i16 (...) @rand()
store i16 %45, i16* %10
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = call i32 @write(i32 %46, i16* %10, i32 %47)
%49 = icmp sle i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %57
52: ; preds = %44
%53 = load i32, i32* %7
%54 = load i16, i16* %10
%55 = zext i16 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %53, i32 %55)
br label %57
57: ; preds = %52, %50
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %9)
%60 = load i8, i8* %9
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 121
br i1 %62, label %63, label %89
63: ; preds = %57
%64 = load i32, i32* %6
%65 = call i64 @ioctl(i32 %64, i8 signext 1, i8* null)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %69
69: ; preds = %67, %63
br label %70
70: ; preds = %81, %69
%71 = load i16, i16* %11
%72 = zext i16 %71 to i32
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %82
74: ; preds = %70
%75 = load i32, i32* %6
%76 = bitcast i16* %11 to i8*
%77 = call i64 @ioctl(i32 %75, i8 signext 16, i8* %76)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %81
81: ; preds = %79, %74
br label %70
82: ; preds = %70
store i16 0, i16* %11
%83 = load i32, i32* %6
%84 = call i64 @ioctl(i32 %83, i8 signext 1, i8* null)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %82
%87 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %88
88: ; preds = %86, %82
br label %89
89: ; preds = %88, %57
%90 = call i32 (...) @getchar()
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%92 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %9)
%93 = load i8, i8* %9
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 121
br i1 %95, label %96, label %97
96: ; preds = %89
store i32 0, i32* %8
br label %97
97: ; preds = %96, %89
%98 = call i32 (...) @getchar()
br label %28
99: ; preds = %28
%100 = load i32, i32* %6
%101 = call i32 @close(i32 %100)
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %101)
%103 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/mpv955\00"
@O_WRONLY = global i32 0
@.str.1 = [26 x i8] c"il file descriptor e' %d\0A\00"
@.str.2 = [8 x i8] c"ioctl()\00"
@.str.3 = [23 x i8] c"insert channel [0-7]: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [18 x i8] c"channel %d <- %X\0A\00"
@.str.7 = [15 x i8] c"write (y/n) ? \00"
@.str.8 = [3 x i8] c"%c\00"
@.str.9 = [6 x i8] c"ioctl\00"
@.str.10 = [14 x i8] c"exit (y/n) ? \00"
@.str.11 = [26 x i8] c"close() ha restituito %d\0A\00"
@str = [23 x i8] c"Errore nella scrittura\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i16
%6 = alloca i16
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
store i8 110, i8* %4
%8 = bitcast i16* %5 to i8*
%9 = bitcast i16* %6 to i8*
store i16 0, i16* %6
%10 = load i32, i32* @O_WRONLY
%11 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i64 @ioctl(i32 %11, i8 signext 2, i8* null)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = tail call i64 @ioctl(i32 %11, i8 signext 8, i8* null)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %68
%24 = phi i32 [ %75, %68 ], [ 1, %22 ]
br label %25
25: ; preds = %23, %25
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%28 = call i32 (...) @getchar()
%29 = load i32, i32* %3
%30 = icmp ugt i32 %29, 7
br i1 %30, label %25, label %31
31: ; preds = %25
%32 = call zeroext i16 (...) @rand()
store i16 %32, i16* %5
%33 = load i32, i32* %3
%34 = call i32 @write(i32 %11, i16* %5, i32 %33)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %42
38: ; preds = %31
%39 = load i32, i32* %3
%40 = zext i16 %32 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %39, i32 %40)
br label %42
42: ; preds = %38, %36
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%45 = load i8, i8* %4
%46 = icmp eq i8 %45, 121
br i1 %46, label %47, label %68
47: ; preds = %42
%48 = call i64 @ioctl(i32 %11, i8 signext 1, i8* null)
%49 = icmp eq i64 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %47
%51 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
%53 = load i16, i16* %6
%54 = icmp eq i16 %53, 0
br i1 %54, label %55, label %63
55: ; preds = %52, %60
%56 = call i64 @ioctl(i32 %11, i8 signext 16, i8* %9)
%57 = icmp eq i64 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %55
%59 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %60
60: ; preds = %58, %55
%61 = load i16, i16* %6
%62 = icmp eq i16 %61, 0
br i1 %62, label %55, label %63
63: ; preds = %60, %52
store i16 0, i16* %6
%64 = call i64 @ioctl(i32 %11, i8 signext 1, i8* null)
%65 = icmp eq i64 %64, 0
br i1 %65, label %68, label %66
66: ; preds = %63
%67 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %68
68: ; preds = %63, %66, %42
%69 = call i32 (...) @getchar()
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%71 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%72 = load i8, i8* %4
%73 = icmp eq i8 %72, 121
%74 = call i32 (...) @getchar()
%75 = select i1 %73, i32 0, i32 %24
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %23
77: ; preds = %68
%78 = call i32 @close(i32 %11)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %78)
%80 = call i32 @exit(i32 0)
unreachable
}