#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*/ chunk;

/* Variables and functions */
scalar_t__ EEXIST;
int /*<<< orphan*/ O_WRONLY;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
scalar_t__ errno;
int mkfifo(char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, unsigned char *, int);
int main(int argc, char **argv) {
  int i = 0;
  unsigned char chunk[8820 + 180];
  for (i = 0; i < 8820 + 180; i++) {
    chunk[i] = 0;
  }
  if (mkfifo("/tmp/silence.aac", (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
                                  S_IROTH | S_IWOTH)) == -1 &&
      errno != EEXIST) {
    perror("Error while creating FIFO");
    return 1;
  }
  int fifo = open("/tmp/silence.aac", O_WRONLY);
  for (;;) {
    write(fifo, chunk, sizeof(chunk));
    usleep(100000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2350,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2328,-0x14(%rbp)
jge    119e <main+0x4e>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x2340(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x27>
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
mov    0x2e32(%rip),%rax
or     (%rax),%esi
mov    0x2e09(%rip),%rax
or     (%rax),%esi
mov    0x2e28(%rip),%rax
or     (%rax),%esi
mov    0x2def(%rip),%rax
or     (%rax),%esi
mov    0x2dc6(%rip),%rax
or     (%rax),%esi
lea    0xe25(%rip),%rdi
call   1040 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    121d <main+0xcd>
mov    0x2dd8(%rip),%rax
mov    (%rax),%rax
mov    0x2dd6(%rip),%rcx
cmp    (%rcx),%rax
je     121d <main+0xcd>
lea    0xe07(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%eax
add    $0x2350,%rsp
pop    %rbp
ret
mov    0x2d7c(%rip),%rax
mov    (%rax),%esi
lea    0xdd3(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x2344(%rbp)
mov    -0x2344(%rbp),%edi
lea    -0x2340(%rbp),%rsi
mov    $0x2328,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1070 <usleep@plt>
jmp    1238 <main+0xe8>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2328,%rsp
mov    %rsp,%rdi
mov    $0x2328,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e30(%rip),%rax
mov    0x2e59(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e2e(%rip),%rax
or     (%rax),%esi
mov    0x2e4d(%rip),%rax
or     (%rax),%esi
mov    0x2e14(%rip),%rax
or     (%rax),%esi
mov    0x2deb(%rip),%rax
or     (%rax),%esi
lea    0xe4a(%rip),%rdi
call   1050 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    11d6 <main+0x76>
mov    0x2e01(%rip),%rax
mov    (%rax),%rax
mov    0x2dff(%rip),%rcx
cmp    (%rcx),%rax
jne    120b <main+0xab>
mov    0x2dc3(%rip),%rax
mov    (%rax),%esi
lea    0xe1a(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
mov    %rsp,%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2328,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
jmp    11f0 <main+0x90>
lea    0xdff(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%eax
add    $0x2328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/tmp/silence.aac\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.1 = [26 x i8] c"Error while creating FIFO\00"
@O_WRONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [9000 x i8]
%8 = 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* %6
br label %9
9: ; preds = %16, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 9000
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [9000 x i8], [9000 x i8]* %7, i64 0, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %9
19: ; preds = %9
%20 = load i32, i32* @S_IRUSR
%21 = load i32, i32* @S_IWUSR
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IRGRP
%24 = or i32 %22, %23
%25 = load i32, i32* @S_IWGRP
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IROTH
%28 = or i32 %26, %27
%29 = load i32, i32* @S_IWOTH
%30 = or i32 %28, %29
%31 = call i32 @mkfifo(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %39
33: ; preds = %19
%34 = load i64, i64* @errno
%35 = load i64, i64* @EEXIST
%36 = icmp ne i64 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
39: ; preds = %33, %19
%40 = load i32, i32* @O_WRONLY
%41 = call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %40)
store i32 %41, i32* %8
br label %42
42: ; preds = %42, %39
%43 = load i32, i32* %8
%44 = getelementptr inbounds [9000 x i8], [9000 x i8]* %7, i64 0, i64 0
%45 = call i32 @write(i32 %43, i8* %44, i32 9000)
%46 = call i32 @usleep(i32 100000)
br label %42
}

LLVM IR (-O2):
@.str = [17 x i8] c"/tmp/silence.aac\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.1 = [26 x i8] c"Error while creating FIFO\00"
@O_WRONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9000 x i8]
%4 = getelementptr inbounds [9000 x i8], [9000 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [9000 x i8], [9000 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* @S_IRUSR
%7 = load i32, i32* @S_IWUSR
%8 = or i32 %7, %6
%9 = load i32, i32* @S_IRGRP
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IWGRP
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IROTH
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IWOTH
%16 = or i32 %14, %15
%17 = tail call i32 @mkfifo(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i64, i64* @errno
%21 = load i64, i64* @EEXIST
%22 = icmp eq i64 %20, %21
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
25: ; preds = %19, %2
%26 = load i32, i32* @O_WRONLY
%27 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %28, %25
%29 = call i32 @write(i32 %27, i8* %5, i32 9000)
%30 = tail call i32 @usleep(i32 100000)
br label %28
}