#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ ioctl(int, int, int *);
int open(char *, int /*<<< orphan*/);
scalar_t__ play_file(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ set_audio_config(int, int /*<<< orphan*/ *);
int main(int ac, char *av[]) {
  FILE *fd_file;
  int fd_audio;
  int i, loop, left, right;
  int vol;
  int err = 0;
  char rep[32];
  printf("Hi... \n");
  if ((ac != 3) && (ac != 4)) {
    printf("This program reconfigures the volume and plays a file\n");
    printf("main <soundfile.wav>  <left_vol> <right_vol> [nb_loops] \n");
    return 0;
  }
  left = atoi(av[2]);
  right = atoi(av[3]);
  if (ac == 5) {
    loop = atoi(av[4]);
  } else {
    loop = 1;
  }
  if ((fd_audio = open("/dev/sound/dsp", O_WRONLY)) < 0) {
    printf("Error opening /dev/sound/dsp");
    err++;
    goto _err_drv_open;
  }
  vol = (1 << 0);
  ioctl(fd_audio,
        ((int)((0x40000000 | 0x20000000) | ((sizeof(int) & 0x1fff) << 16) |
               ('M' << 8) | 0xfa)),
        &vol);
  vol = (left << 8) | right;
  ioctl(fd_audio,
        ((int)((0x40000000 | 0x20000000) | ((sizeof(int) & 0x1fff) << 16) |
               ('M' << 8) | 0)),
        &vol);
  if (vol != ((left << 8) | right))
    printf("Volume applied is %d %d\n", vol >> 8, vol & 0xFF);
  if ((fd_file = fopen(av[1], "r")) <= 0) {
    err++;
    goto _err_file_not_found;
  }
  if (set_audio_config(fd_audio, fd_file) < 0) {
    printf("Bad format for file 1. ");
    printf("Do you want to continue ? (y/n) : ");
    scanf("%s", rep);
    err++;
    if (rep[0] != 'y')
      goto _err_fmt;
  }
  for (i = 0; i < loop; i++) {
    err += play_file(fd_audio, fd_file);
  }
  printf("************** Closing the device\n");
  fclose(fd_file);
  close(fd_audio);
  if (err)
    goto _end_err;
  printf("All tests passed with success\n");
  return 0;
_err_fmt:
  close(fd_audio);
_err_drv_open:
  fclose(fd_file);
_end_err:
  printf("Encountered %d errors\n", err);
  return err;
_err_file_not_found:
  printf("Error opening the file %s \n", av[1]);
  close(fd_audio);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1207 <main+0x67>
cmpl   $0x4,-0x8(%rbp)
je     1207 <main+0x67>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <main+0x2b6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    1246 <main+0xa6>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    124d <main+0xad>
movl   $0x1,-0x24(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
lea    0xe2a(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    128a <main+0xea>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    140c <main+0x26c>
movl   $0x1,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x60044dfa,%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
mov    -0x28(%rbp),%eax
shl    $0x8,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x60044d00,%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
mov    -0x30(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x8,%ecx
or     -0x2c(%rbp),%ecx
cmp    %ecx,%eax
je     12f0 <main+0x150>
mov    -0x30(%rbp),%esi
sar    $0x8,%esi
mov    -0x30(%rbp),%edx
and    $0xff,%edx
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb0(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
ja     1320 <main+0x180>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1431 <main+0x291>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <set_audio_config@plt>
cmp    $0x0,%rax
jge    1382 <main+0x1e2>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xd8f(%rip),%rdi
call   1090 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movsbl -0x60(%rbp),%eax
cmp    $0x79,%eax
je     137d <main+0x1dd>
jmp    1404 <main+0x264>
jmp    1382 <main+0x1e2>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13bc <main+0x21c>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <play_file@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1389 <main+0x1e9>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
cmpl   $0x0,-0x34(%rbp)
je     13ea <main+0x24a>
jmp    1415 <main+0x275>
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1456 <main+0x2b6>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x34(%rbp),%esi
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1456 <main+0x2b6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
add    $0xfffffffb,%ebx
cmp    $0xfffffffd,%ebx
ja     11f4 <main+0x44>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3e(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    1364 <main+0x1b4>
mov    0x10(%r15),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    0x18(%r15),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
lea    0xdf4(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
js     1373 <main+0x1c3>
mov    %eax,%r14d
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%r12
mov    %eax,%edi
mov    $0x60044dfa,%esi
mov    %r12,%rdx
call   1080 <ioctl@plt>
shl    $0x8,%ebx
or     %ebx,%ebp
mov    %ebp,0xc(%rsp)
mov    %r14d,%edi
mov    $0x60044d00,%esi
mov    %r12,%rdx
call   1080 <ioctl@plt>
mov    0xc(%rsp),%eax
cmp    %ebp,%eax
je     127d <main+0xcd>
mov    %eax,%esi
sar    $0x8,%esi
movzbl %al,%edx
lea    0xda7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%r15),%rdi
lea    0xdae(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1321 <main+0x171>
mov    %rax,%rbp
mov    %r14d,%edi
mov    %rax,%rsi
call   1040 <set_audio_config@plt>
xor    %r15d,%r15d
test   %rax,%rax
jns    12e6 <main+0x136>
lea    0xd85(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd8f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xda4(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10a0 <scanf@plt>
mov    $0x1,%r15d
cmpb   $0x79,0x10(%rsp)
jne    133f <main+0x18f>
mov    %r14d,%edi
mov    %rbp,%rsi
call   1050 <play_file@plt>
mov    %rax,%rbx
lea    0xdb5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    %r14d,%edi
call   1090 <close@plt>
add    %r15d,%ebx
jne    1354 <main+0x1a4>
lea    0xdb6(%rip),%rdi
jmp    11e8 <main+0x38>
mov    0x8(%r15),%rsi
lea    0xd61(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
call   1090 <close@plt>
jmp    1364 <main+0x1b4>
mov    %r14d,%edi
call   1090 <close@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    $0x1,%ebx
lea    0xd1b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc86(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Hi... \0A\00"
@.str.1 = [55 x i8] c"This program reconfigures the volume and plays a file\0A\00"
@.str.2 = [58 x i8] c"main <soundfile.wav> <left_vol> <right_vol> [nb_loops] \0A\00"
@.str.3 = [15 x i8] c"/dev/sound/dsp\00"
@O_WRONLY = global i32 0
@.str.4 = [29 x i8] c"Error opening /dev/sound/dsp\00"
@.str.5 = [25 x i8] c"Volume applied is %d %d\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [24 x i8] c"Bad format for file 1. \00"
@.str.8 = [35 x i8] c"Do you want to continue ? (y/n) : \00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [35 x i8] c"************** Closing the device\0A\00"
@.str.11 = [31 x i8] c"All tests passed with success\0A\00"
@.str.12 = [23 x i8] c"Encountered %d errors\0A\00"
@.str.13 = [28 x i8] c"Error opening the file %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 i32
%14 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 4
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %141
24: ; preds = %18, %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %10
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %11
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 5
br i1 %34, label %35, label %40
35: ; preds = %24
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 4
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %9
br label %41
40: ; preds = %24
store i32 1, i32* %9
br label %41
41: ; preds = %40, %35
%42 = load i32, i32* @O_WRONLY
%43 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %42)
store i32 %43, i32* %7
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%47 = load i32, i32* %13
%48 = add nsw i32 %47, 1
store i32 %48, i32* %13
br label %127
49: ; preds = %41
store i32 1, i32* %12
%50 = load i32, i32* %7
%51 = call i32 @ioctl(i32 %50, i32 1610894842, i32* %12)
%52 = load i32, i32* %10
%53 = shl i32 %52, 8
%54 = load i32, i32* %11
%55 = or i32 %53, %54
store i32 %55, i32* %12
%56 = load i32, i32* %7
%57 = call i32 @ioctl(i32 %56, i32 1610894592, i32* %12)
%58 = load i32, i32* %12
%59 = load i32, i32* %10
%60 = shl i32 %59, 8
%61 = load i32, i32* %11
%62 = or i32 %60, %61
%63 = icmp ne i32 %58, %62
br i1 %63, label %64, label %70
64: ; preds = %49
%65 = load i32, i32* %12
%66 = ashr i32 %65, 8
%67 = load i32, i32* %12
%68 = and i32 %67, 255
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %66, i32 %68)
br label %70
70: ; preds = %64, %49
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 1
%73 = load i8*, i8** %72
%74 = call i32* @fopen(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %74, i32** %6
%75 = icmp ule i32* %74, null
br i1 %75, label %76, label %79
76: ; preds = %70
%77 = load i32, i32* %13
%78 = add nsw i32 %77, 1
store i32 %78, i32* %13
br label %134
79: ; preds = %70
%80 = load i32, i32* %7
%81 = load i32*, i32** %6
%82 = call i64 @set_audio_config(i32 %80, i32* %81)
%83 = icmp slt i64 %82, 0
br i1 %83, label %84, label %97
84: ; preds = %79
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%87 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%88 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %87)
%89 = load i32, i32* %13
%90 = add nsw i32 %89, 1
store i32 %90, i32* %13
%91 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp ne i32 %93, 121
br i1 %94, label %95, label %96
95: ; preds = %84
br label %124
96: ; preds = %84
br label %97
97: ; preds = %96, %79
store i32 0, i32* %8
br label %98
98: ; preds = %110, %97
%99 = load i32, i32* %8
%100 = load i32, i32* %9
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %113
102: ; preds = %98
%103 = load i32, i32* %7
%104 = load i32*, i32** %6
%105 = call i64 @play_file(i32 %103, i32* %104)
%106 = load i32, i32* %13
%107 = sext i32 %106 to i64
%108 = add nsw i64 %107, %105
%109 = trunc i64 %108 to i32
store i32 %109, i32* %13
br label %110
110: ; preds = %102
%111 = load i32, i32* %8
%112 = add nsw i32 %111, 1
store i32 %112, i32* %8
br label %98
113: ; preds = %98
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%115 = load i32*, i32** %6
%116 = call i32 @fclose(i32* %115)
%117 = load i32, i32* %7
%118 = call i32 @close(i32 %117)
%119 = load i32, i32* %13
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %113
br label %130
122: ; preds = %113
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %3
br label %141
124: ; preds = %95
%125 = load i32, i32* %7
%126 = call i32 @close(i32 %125)
br label %127
127: ; preds = %124, %45
%128 = load i32*, i32** %6
%129 = call i32 @fclose(i32* %128)
br label %130
130: ; preds = %127, %121
%131 = load i32, i32* %13
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 %131)
%133 = load i32, i32* %13
store i32 %133, i32* %3
br label %141
134: ; preds = %76
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 1
%137 = load i8*, i8** %136
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %137)
%139 = load i32, i32* %7
%140 = call i32 @close(i32 %139)
store i32 0, i32* %3
br label %141
141: ; preds = %134, %130, %122, %21
%142 = load i32, i32* %3
ret i32 %142
}

LLVM IR (-O2):
@.str.3 = [15 x i8] c"/dev/sound/dsp\00"
@O_WRONLY = global i32 0
@.str.4 = [29 x i8] c"Error opening /dev/sound/dsp\00"
@.str.5 = [25 x i8] c"Volume applied is %d %d\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [24 x i8] c"Bad format for file 1. \00"
@.str.8 = [35 x i8] c"Do you want to continue ? (y/n) : \00"
@.str.9 = [3 x i8] c"%s\00"
@.str.12 = [23 x i8] c"Encountered %d errors\0A\00"
@.str.13 = [28 x i8] c"Error opening the file %s \0A\00"
@str = [7 x i8] c"Hi... \00"
@str.14 = [34 x i8] c"************** Closing the device\00"
@str.15 = [30 x i8] c"All tests passed with success\00"
@str.16 = [54 x i8] c"This program reconfigures the volume and plays a file\00"
@str.17 = [57 x i8] c"main <soundfile.wav> <left_vol> <right_vol> [nb_loops] \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%8 = add i32 %0, -5
%9 = icmp ult i32 %8, -2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.16, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.17, i64 0, i64 0))
br label %71
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = load i32, i32* @O_WRONLY
%21 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
unreachable
25: ; preds = %13
store i32 1, i32* %3
%26 = call i32 @ioctl(i32 %21, i32 1610894842, i32* %3)
%27 = shl i32 %16, 8
%28 = or i32 %19, %27
store i32 %28, i32* %3
%29 = call i32 @ioctl(i32 %21, i32 1610894592, i32* %3)
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, %28
br i1 %31, label %36, label %32
32: ; preds = %25
%33 = ashr i32 %30, 8
%34 = and i32 %30, 255
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %33, i32 %34)
br label %36
36: ; preds = %32, %25
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i8*, i8** %37
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %42)
%44 = call i32 @close(i32 %21)
br label %71
45: ; preds = %36
%46 = call i64 @set_audio_config(i32 %21, i32* %39)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %6)
%52 = load i8, i8* %6
%53 = icmp eq i8 %52, 121
br i1 %53, label %54, label %65
54: ; preds = %48, %45
%55 = phi i32 [ 1, %48 ], [ 0, %45 ]
%56 = call i64 @play_file(i32 %21, i32* %39)
%57 = trunc i64 %56 to i32
%58 = add i32 %55, %57
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.14, i64 0, i64 0))
%60 = call i32 @fclose(i32* %39)
%61 = call i32 @close(i32 %21)
%62 = icmp eq i32 %58, 0
br i1 %62, label %63, label %68
63: ; preds = %54
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.15, i64 0, i64 0))
br label %71
65: ; preds = %48
%66 = call i32 @close(i32 %21)
%67 = call i32 @fclose(i32* %39)
br label %68
68: ; preds = %54, %65
%69 = phi i32 [ 1, %65 ], [ %58, %54 ]
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 %69)
br label %71
71: ; preds = %41, %68, %63, %10
%72 = phi i32 [ 0, %10 ], [ %69, %68 ], [ 0, %41 ], [ 0, %63 ]
ret i32 %72
}