#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int write(int, unsigned short *, int);
int main(int argc, char *argv[]) {
  int fd = 0;
  int chan = 0;
  unsigned short buff;
  int 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()");
  if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0014), (void *)&buff) != 0)
    perror("ioctl()");
  do {
    printf("insert channel [0-7 ; 8=all_channel]: ");
    scanf("%d", &chan);
    getchar();
  } while ((chan < 0) || (chan > 8));
  if (chan == 8) {
    for (chan = 0; chan < 8; chan++) {
      if (write(fd, &buff, chan) <= -1) {
        printf("Errore nella scrittura\n");
      } else {
        printf("channel %d <- %X\n", chan, buff);
      }
    }
  } else {
    if (write(fd, &buff, chan) <= -1) {
      printf("Errore nella scrittura\n");
    } else {
      printf("channel %d <- %X\n", chan, buff);
    }
  }
  if (ioctl(fd, ((('i' << 24) | ('o' << 16)) | 0x0001), NULL) != 0)
    perror("ioctl()");
  ciclo = 0;
  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()");
  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   $0x0,-0x20(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
lea    0xe35(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe2f(%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     120b <main+0x7b>
lea    0xe20(%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     1232 <main+0xa2>
lea    0xdf9(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x14(%rbp),%edi
lea    -0x1a(%rbp),%rdx
mov    $0x14,%esi
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     1259 <main+0xc9>
lea    0xdd2(%rip),%rdi
call   10a0 <perror@plt>
jmp    125e <main+0xce>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde2(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x1,%al
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x21(%rbp)
jl     129c <main+0x10c>
cmpl   $0x8,-0x18(%rbp)
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    125e <main+0xce>
cmpl   $0x8,-0x18(%rbp)
jne    131a <main+0x18a>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1315 <main+0x185>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
lea    -0x1a(%rbp),%rsi
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jg     12ed <main+0x15d>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1302 <main+0x172>
mov    -0x18(%rbp),%esi
movzwl -0x1a(%rbp),%edx
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1307 <main+0x177>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12b8 <main+0x128>
jmp    135f <main+0x1cf>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
lea    -0x1a(%rbp),%rsi
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jg     1345 <main+0x1b5>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    135a <main+0x1ca>
mov    -0x18(%rbp),%esi
movzwl -0x1a(%rbp),%edx
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    135f <main+0x1cf>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     1386 <main+0x1f6>
lea    0xca5(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    13c3 <main+0x233>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rdx
mov    $0x10,%esi
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     13be <main+0x22e>
lea    0xcc9(%rip),%rdi
call   10a0 <perror@plt>
jmp    138d <main+0x1fd>
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     13f1 <main+0x261>
lea    0xc3a(%rip),%rdi
call   10a0 <perror@plt>
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)
movl   $0x0,0x14(%rsp)
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
lea    0xe32(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%r13d
lea    0xe2f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1206 <main+0x66>
lea    0xe25(%rip),%rdi
call   10b0 <perror@plt>
mov    %r13d,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1226 <main+0x86>
lea    0xe05(%rip),%rdi
call   10b0 <perror@plt>
lea    0xe(%rsp),%rdx
mov    %r13d,%edi
mov    $0x14,%esi
call   1060 <ioctl@plt>
test   %rax,%rax
je     1249 <main+0xa9>
lea    0xde2(%rip),%rdi
call   10b0 <perror@plt>
lea    0xdde(%rip),%r14
lea    0xdfe(%rip),%rbp
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    0x10(%rsp),%edx
cmp    $0x8,%edx
ja     1260 <main+0xc0>
jne    12ec <main+0x14c>
movl   $0x0,0x10(%rsp)
lea    0xe(%rsp),%r14
lea    0xdef(%rip),%r15
lea    0xdb6(%rip),%r12
xor    %edx,%edx
jmp    12d3 <main+0x133>
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%esi
movzwl 0xe(%rsp),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%eax
lea    0x1(%rax),%edx
mov    %edx,0x10(%rsp)
cmp    $0x7,%eax
jge    1322 <main+0x182>
mov    %r13d,%edi
mov    %r14,%rsi
call   1040 <write@plt>
test   %eax,%eax
jns    12b0 <main+0x110>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    12c3 <main+0x123>
lea    0xe(%rsp),%rsi
mov    %r13d,%edi
call   1040 <write@plt>
test   %eax,%eax
jns    130b <main+0x16b>
lea    0xd86(%rip),%rdi
call   1030 <puts@plt>
jmp    1322 <main+0x182>
mov    0x10(%rsp),%esi
movzwl 0xe(%rsp),%edx
lea    0xd3d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1342 <main+0x1a2>
lea    0xce9(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x0,0x14(%rsp)
lea    0x14(%rsp),%rbx
lea    0xd14(%rip),%rbp
jmp    1367 <main+0x1c7>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x14(%rsp)
jne    1386 <main+0x1e6>
mov    %r13d,%edi
mov    $0x10,%esi
mov    %rbx,%rdx
call   1060 <ioctl@plt>
test   %rax,%rax
je     1360 <main+0x1c0>
mov    %rbp,%rdi
call   10b0 <perror@plt>
jmp    1360 <main+0x1c0>
movl   $0x0,0x14(%rsp)
mov    %r13d,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
je     13ae <main+0x20e>
lea    0xc7d(%rip),%rdi
call   10b0 <perror@plt>
mov    %r13d,%edi
call   1070 <close@plt>
lea    0xcb3(%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 = [39 x i8] c"insert channel [0-7 ; 8=all_channel]: \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 = [6 x i8] c"ioctl\00"
@.str.8 = [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 i16
%9 = alloca i32
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 0, i32* %9
%10 = load i32, i32* @O_WRONLY
%11 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %6
%15 = call i64 @ioctl(i32 %14, i8 signext 2, i8* null)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %2
%20 = load i32, i32* %6
%21 = call i64 @ioctl(i32 %20, i8 signext 8, i8* null)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* %6
%27 = bitcast i16* %8 to i8*
%28 = call i64 @ioctl(i32 %26, i8 signext 20, i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %25
br label %33
33: ; preds = %43, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%36 = call i32 (...) @getchar()
br label %37
37: ; preds = %33
%38 = load i32, i32* %7
%39 = icmp slt i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %7
%42 = icmp sgt i32 %41, 8
br label %43
43: ; preds = %40, %37
%44 = phi i1 [ true, %37 ], [ %42, %40 ]
br i1 %44, label %33, label %45
45: ; preds = %43
%46 = load i32, i32* %7
%47 = icmp eq i32 %46, 8
br i1 %47, label %48, label %69
48: ; preds = %45
store i32 0, i32* %7
br label %49
49: ; preds = %65, %48
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 8
br i1 %51, label %52, label %68
52: ; preds = %49
%53 = load i32, i32* %6
%54 = load i32, i32* %7
%55 = call i32 @write(i32 %53, i16* %8, i32 %54)
%56 = icmp sle i32 %55, -1
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %64
59: ; preds = %52
%60 = load i32, i32* %7
%61 = load i16, i16* %8
%62 = zext i16 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %60, i32 %62)
br label %64
64: ; preds = %59, %57
br label %65
65: ; preds = %64
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %49
68: ; preds = %49
br label %82
69: ; preds = %45
%70 = load i32, i32* %6
%71 = load i32, i32* %7
%72 = call i32 @write(i32 %70, i16* %8, i32 %71)
%73 = icmp sle i32 %72, -1
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %81
76: ; preds = %69
%77 = load i32, i32* %7
%78 = load i16, i16* %8
%79 = zext i16 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %77, i32 %79)
br label %81
81: ; preds = %76, %74
br label %82
82: ; preds = %81, %68
%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
store i32 0, i32* %9
br label %89
89: ; preds = %99, %88
%90 = load i32, i32* %9
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %100
92: ; preds = %89
%93 = load i32, i32* %6
%94 = bitcast i32* %9 to i8*
%95 = call i64 @ioctl(i32 %93, i8 signext 16, i8* %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %92
%98 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %99
99: ; preds = %97, %92
br label %89
100: ; preds = %89
store i32 0, i32* %9
%101 = load i32, i32* %6
%102 = call i64 @ioctl(i32 %101, i8 signext 1, i8* null)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %106
106: ; preds = %104, %100
%107 = load i32, i32* %6
%108 = call i32 @close(i32 %107)
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %108)
%110 = 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 = [39 x i8] c"insert channel [0-7 ; 8=all_channel]: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [18 x i8] c"channel %d <- %X\0A\00"
@.str.7 = [6 x i8] c"ioctl\00"
@.str.8 = [26 x i8] c"close() ha restituito %d\0A\00"
@str.9 = [23 x i8] c"Errore nella scrittura\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i16
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i16* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = load i32, i32* @O_WRONLY
%10 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i64 @ioctl(i32 %10, i8 signext 2, i8* null)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %2
%17 = tail call i64 @ioctl(i32 %10, i8 signext 8, i8* null)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = call i64 @ioctl(i32 %10, i8 signext 20, i8* %7)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
br label %27
27: ; preds = %26, %27
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%30 = call i32 (...) @getchar()
%31 = load i32, i32* %3
%32 = icmp ugt i32 %31, 8
br i1 %32, label %27, label %33
33: ; preds = %27
%34 = icmp eq i32 %31, 8
br i1 %34, label %35, label %51
35: ; preds = %33
store i32 0, i32* %3
br label %36
36: ; preds = %35, %47
%37 = phi i32 [ 0, %35 ], [ %49, %47 ]
%38 = call i32 @write(i32 %10, i16* %4, i32 %37)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
br label %47
42: ; preds = %36
%43 = load i32, i32* %3
%44 = load i16, i16* %4
%45 = zext i16 %44 to i32
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %45)
br label %47
47: ; preds = %40, %42
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
%50 = icmp slt i32 %48, 7
br i1 %50, label %36, label %61
51: ; preds = %33
%52 = call i32 @write(i32 %10, i16* %4, i32 %31)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
br label %61
56: ; preds = %51
%57 = load i32, i32* %3
%58 = load i16, i16* %4
%59 = zext i16 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %57, i32 %59)
br label %61
61: ; preds = %47, %54, %56
%62 = call i64 @ioctl(i32 %10, i8 signext 1, i8* null)
%63 = icmp eq i64 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %61
%65 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64, %61
store i32 0, i32* %5
br label %67
67: ; preds = %66, %72
%68 = call i64 @ioctl(i32 %10, i8 signext 16, i8* %8)
%69 = icmp eq i64 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %67
%71 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
%73 = load i32, i32* %5
%74 = icmp eq i32 %73, 0
br i1 %74, label %67, label %75
75: ; preds = %72
store i32 0, i32* %5
%76 = call i64 @ioctl(i32 %10, i8 signext 1, i8* null)
%77 = icmp eq i64 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %75
%79 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %80
80: ; preds = %78, %75
%81 = call i32 @close(i32 %10)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %81)
%83 = call i32 @exit(i32 0)
unreachable
}