#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 EXIT_SUCCESS;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int atoi(char *);
int /*<<< orphan*/ dup2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int fork();
int getpid();
int obtenerfifo(int, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ producir(char, int, int);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stdout;
int wait(int *);
int main(int argc, char **argv) {
  dup2(STDOUT_FILENO, STDERR_FILENO);
  char c = 'a';
  int numcli, pid, mipid, i, dfifoe, dfifos, mififo, estado;
  char nombrefifoe[50], nombrefifos[50];
  setbuf(stdout, NULL);
  if (argc < 3) {
    printf("Clientes: Formato: clientes <nombre_fifo> <numero_clientes>\n");
    exit(1);
  } else if (((numcli = atoi(argv[2])) > 10) || (numcli < 1)) {
    printf("Clientes: <numero_clientes> comprendido entre 1 y 10\n");
    exit(1);
  }
  sprintf(nombrefifoe, "%se", argv[1]);
  sprintf(nombrefifos, "%ss", argv[1]);
  if ((dfifoe = open(nombrefifoe, O_WRONLY)) == -1) {
    perror("Clientes: Problema con el archivo fifo de entrada al servidor");
    exit(1);
  }
  if ((dfifos = open(nombrefifos, O_RDWR)) == -1) {
    perror("Clientes: Problema con el archivo fifo de salida del servidor");
    exit(1);
  }
  printf("creando procesos\n");
  for (i = 1; i < numcli; i++) {
    printf("produciendo %d\n", i);
    if ((pid = fork()) == -1) {
      perror("Clientes: Problema al crear proceso cliente");
      exit(1);
    }
    if (pid == 0) {
      printf("produciendo hijo\n");
      mipid = getpid();
      printf("obtenido  pid %d\n", mipid);
      mififo = obtenerfifo(dfifoe, dfifos, mipid);
      printf("obtenido  fifo\n");
      producir(c, mififo, mipid);
      exit(EXIT_SUCCESS);
    } else {
      c++;
    }
  }
  mipid = getpid();
  mififo = obtenerfifo(dfifoe, dfifos, mipid);
  producir(c, mififo, mipid);
  while (wait(&estado) != -1)
    ;
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    0x2dd7(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
movb   $0x61,-0x11(%rbp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1238 <main+0x68>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xa,%eax
jg     125b <main+0x8b>
cmpl   $0x1,-0x18(%rbp)
jge    1273 <main+0xa3>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1278 <main+0xa8>
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xde8(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdd1(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2cfa(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    12df <main+0x10f>
lea    0xdab(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2cf3(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    1316 <main+0x146>
lea    0xdb2(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13fd <main+0x22d>
mov    -0x24(%rbp),%esi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    1371 <main+0x1a1>
lea    0xdb7(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    13e2 <main+0x212>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <obtenerfifo@plt>
mov    %eax,-0x30(%rbp)
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x11(%rbp),%al
mov    -0x30(%rbp),%esi
mov    -0x20(%rbp),%edx
movsbl %al,%edi
call   1070 <producir@plt>
mov    0x2be5(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    13ef <main+0x21f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    132b <main+0x15b>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <obtenerfifo@plt>
mov    %eax,-0x30(%rbp)
mov    -0x11(%rbp),%al
mov    -0x30(%rbp),%esi
mov    -0x20(%rbp),%edx
movsbl %al,%edi
call   1070 <producir@plt>
lea    -0x34(%rbp),%rdi
call   10e0 <wait@plt>
cmp    $0xffffffff,%eax
je     1440 <main+0x270>
jmp    1429 <main+0x259>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    0x2dca(%rip),%rax
mov    (%rax),%esi
call   1060 <dup2@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
cmp    $0x2,%ebx
jg     122b <main+0x4b>
lea    0xf0f(%rip),%rdi
jmp    1248 <main+0x68>
mov    0x10(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r12d
lea    -0xb(%r12),%eax
cmp    $0xfffffff5,%eax
ja     1257 <main+0x77>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x8(%rbp),%rdx
lea    0xd9e(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   10d0 <sprintf@plt>
mov    0x8(%rbp),%rdx
lea    0xd8a(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10d0 <sprintf@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
jne    12a3 <main+0xc3>
lea    0xd67(%rip),%rdi
jmp    12c5 <main+0xe5>
mov    %eax,%r15d
mov    0x2d33(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
jne    12d4 <main+0xf4>
lea    0xd81(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    %eax,%r14d
lea    0xdf4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x61,%r13b
cmp    $0x2,%r12d
jb     1328 <main+0x148>
lea    0x60(%r12),%r13d
mov    $0x1,%ebp
lea    0xd87(%rip),%rbx
nopl   (%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
je     135f <main+0x17f>
cmp    $0xffffffff,%eax
je     13bf <main+0x1df>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1300 <main+0x120>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
mov    %r15d,%edi
mov    %r14d,%esi
mov    %eax,%edx
call   1090 <obtenerfifo@plt>
movsbl %r13b,%edi
mov    %eax,%esi
mov    %ebx,%edx
call   1080 <producir@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1350 <main+0x170>
jmp    13b1 <main+0x1d1>
lea    0xd7d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
lea    0xd45(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebx,%edx
call   1090 <obtenerfifo@plt>
mov    %eax,%r14d
lea    0xd59(%rip),%rdi
call   1030 <puts@plt>
add    $0x60,%ebp
movsbl %bpl,%edi
mov    %r14d,%esi
mov    %ebx,%edx
call   1080 <producir@plt>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    0xcce(%rip),%rdi
jmp    12c5 <main+0xe5>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@stdout = global i32 0
@.str = [61 x i8] c"Clientes: Formato: clientes <nombre_fifo> <numero_clientes>\0A\00"
@.str.1 = [54 x i8] c"Clientes: <numero_clientes> comprendido entre 1 y 10\0A\00"
@.str.2 = [4 x i8] c"%se\00"
@.str.3 = [4 x i8] c"%ss\00"
@O_WRONLY = global i32 0
@.str.4 = [62 x i8] c"Clientes: Problema con el archivo fifo de entrada al servidor\00"
@O_RDWR = global i32 0
@.str.5 = [62 x i8] c"Clientes: Problema con el archivo fifo de salida del servidor\00"
@.str.6 = [18 x i8] c"creando procesos\0A\00"
@.str.7 = [16 x i8] c"produciendo %d\0A\00"
@.str.8 = [44 x i8] c"Clientes: Problema al crear proceso cliente\00"
@.str.9 = [18 x i8] c"produciendo hijo\0A\00"
@.str.10 = [18 x i8] c"obtenido pid %d\0A\00"
@.str.11 = [16 x i8] c"obtenido fifo\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [50 x i8]
%16 = alloca [50 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @STDOUT_FILENO
%18 = load i32, i32* @STDERR_FILENO
%19 = call i32 @dup2(i32 %17, i32 %18)
store i8 97, i8* %6
%20 = load i32, i32* @stdout
%21 = call i32 @setbuf(i32 %20, i32* null)
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %7
%32 = icmp sgt i32 %31, 10
br i1 %32, label %36, label %33
33: ; preds = %27
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 1
br i1 %35, label %36, label %39
36: ; preds = %33, %27
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %33
br label %40
40: ; preds = %39
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %15, i64 0, i64 0
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [50 x i8], [50 x i8]* %15, i64 0, i64 0
%52 = load i32, i32* @O_WRONLY
%53 = call i32 @open(i8* %51, i32 %52)
store i32 %53, i32* %11
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %40
%56 = call i32 @perror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %40
%59 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%60 = load i32, i32* @O_RDWR
%61 = call i32 @open(i8* %59, i32 %60)
store i32 %61, i32* %12
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = call i32 @perror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %10
br label %68
68: ; preds = %103, %66
%69 = load i32, i32* %10
%70 = load i32, i32* %7
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %106
72: ; preds = %68
%73 = load i32, i32* %10
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %73)
%75 = call i32 (...) @fork()
store i32 %75, i32* %8
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %72
%81 = load i32, i32* %8
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %99
83: ; preds = %80
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%85 = call i32 (...) @getpid()
store i32 %85, i32* %9
%86 = load i32, i32* %9
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %86)
%88 = load i32, i32* %11
%89 = load i32, i32* %12
%90 = load i32, i32* %9
%91 = call i32 @obtenerfifo(i32 %88, i32 %89, i32 %90)
store i32 %91, i32* %13
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
%93 = load i8, i8* %6
%94 = load i32, i32* %13
%95 = load i32, i32* %9
%96 = call i32 @producir(i8 signext %93, i32 %94, i32 %95)
%97 = load i32, i32* @EXIT_SUCCESS
%98 = call i32 @exit(i32 %97)
unreachable
99: ; preds = %80
%100 = load i8, i8* %6
%101 = add i8 %100, 1
store i8 %101, i8* %6
br label %102
102: ; preds = %99
br label %103
103: ; preds = %102
%104 = load i32, i32* %10
%105 = add nsw i32 %104, 1
store i32 %105, i32* %10
br label %68
106: ; preds = %68
%107 = call i32 (...) @getpid()
store i32 %107, i32* %9
%108 = load i32, i32* %11
%109 = load i32, i32* %12
%110 = load i32, i32* %9
%111 = call i32 @obtenerfifo(i32 %108, i32 %109, i32 %110)
store i32 %111, i32* %13
%112 = load i8, i8* %6
%113 = load i32, i32* %13
%114 = load i32, i32* %9
%115 = call i32 @producir(i8 signext %112, i32 %113, i32 %114)
br label %116
116: ; preds = %119, %106
%117 = call i32 @wait(i32* %14)
%118 = icmp ne i32 %117, -1
br i1 %118, label %119, label %120
119: ; preds = %116
br label %116
120: ; preds = %116
%121 = load i32, i32* @EXIT_SUCCESS
%122 = call i32 @exit(i32 %121)
unreachable
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@stdout = global i32 0
@.str.2 = [4 x i8] c"%se\00"
@.str.3 = [4 x i8] c"%ss\00"
@O_WRONLY = global i32 0
@.str.4 = [62 x i8] c"Clientes: Problema con el archivo fifo de entrada al servidor\00"
@O_RDWR = global i32 0
@.str.5 = [62 x i8] c"Clientes: Problema con el archivo fifo de salida del servidor\00"
@.str.7 = [16 x i8] c"produciendo %d\0A\00"
@.str.8 = [44 x i8] c"Clientes: Problema al crear proceso cliente\00"
@.str.10 = [18 x i8] c"obtenido pid %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [17 x i8] c"creando procesos\00"
@str.12 = [17 x i8] c"produciendo hijo\00"
@str.13 = [15 x i8] c"obtenido fifo\00"
@str.14 = [53 x i8] c"Clientes: <numero_clientes> comprendido entre 1 y 10\00"
@str.15 = [60 x i8] c"Clientes: Formato: clientes <nombre_fifo> <numero_clientes>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [50 x i8]
%5 = alloca [50 x i8]
%6 = load i32, i32* @STDOUT_FILENO
%7 = load i32, i32* @STDERR_FILENO
%8 = tail call i32 @dup2(i32 %6, i32 %7)
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* @stdout
%13 = tail call i32 @setbuf(i32 %12, i32* null)
%14 = icmp slt i32 %0, 3
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.15, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = add i32 %21, -11
%23 = icmp ult i32 %22, -10
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.14, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %18
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %28
%32 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @O_WRONLY
%34 = call i32 @open(i8* %10, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %27
%37 = tail call i32 @perror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %27
%40 = load i32, i32* @O_RDWR
%41 = call i32 @open(i8* %11, i32 %40)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = tail call i32 @perror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %39
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%48 = icmp ugt i32 %21, 1
br i1 %48, label %49, label %73
49: ; preds = %46
%50 = trunc i32 %21 to i8
%51 = add nuw nsw i8 %50, 96
br label %52
52: ; preds = %49, %69
%53 = phi i8 [ %70, %69 ], [ 97, %49 ]
%54 = phi i32 [ %71, %69 ], [ 1, %49 ]
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 %54)
%56 = tail call i32 (...) @fork()
switch i32 %56, label %69 [
i32 -1, label %57
i32 0, label %60
]
57: ; preds = %52
%58 = tail call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %52
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%62 = tail call i32 (...) @getpid()
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32 %62)
%64 = tail call i32 @obtenerfifo(i32 %34, i32 %41, i32 %62)
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.13, i64 0, i64 0))
%66 = tail call i32 @producir(i8 signext %53, i32 %64, i32 %62)
%67 = load i32, i32* @EXIT_SUCCESS
%68 = tail call i32 @exit(i32 %67)
unreachable
69: ; preds = %52
%70 = add i8 %53, 1
%71 = add nuw nsw i32 %54, 1
%72 = icmp eq i32 %71, %21
br i1 %72, label %73, label %52
73: ; preds = %69, %46
%74 = phi i8 [ 97, %46 ], [ %51, %69 ]
%75 = tail call i32 (...) @getpid()
%76 = tail call i32 @obtenerfifo(i32 %34, i32 %41, i32 %75)
%77 = tail call i32 @producir(i8 signext %74, i32 %76, i32 %75)
br label %78
78: ; preds = %78, %73
%79 = call i32 @wait(i32* %3)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %78
81: ; preds = %78
%82 = load i32, i32* @EXIT_SUCCESS
%83 = call i32 @exit(i32 %82)
unreachable
}