#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 */
struct sembuf {
  int sem_op;
  scalar_t__ sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int /*<<< orphan*/ IPC_PRIVATE;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ SETVAL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int getpid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int semctl(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int semget(int /*<<< orphan*/, int, int);
int semop(int, struct sembuf *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main() {
  int nbr1 = 0;
  int nbr2 = 0;
  int semaphore;
  if ((semaphore = semget(IPC_PRIVATE, 1, 0660)) == -1) {
    perror("ERROR CREATING THE SEMAPHORE");
  }
  if (semctl(semaphore, 0, SETVAL, 1) == -1) {
    perror("ERROR SETTING SEMAPHORE VALUE TO 1");
  }
  struct sembuf sem_op;
  sem_op.sem_num = 0;
  sem_op.sem_op = 1;
  sem_op.sem_flg = 0;
  struct sembuf sem_prob;
  sem_prob.sem_num = 0;
  sem_prob.sem_op = -1;
  sem_prob.sem_flg = 0;
  switch (fork()) {
  case 0: {
    if (semop(semaphore, &sem_prob, 1) == -1) {
      perror("ERROR DECREMENTING THE SEMAPHORE");
    }
    for (nbr1; nbr1 < 5; nbr1++) {
      printf("JE SUIS LE FILS DE PID %d \n", getpid());
      sleep(1);
    }
    if (semop(semaphore, &sem_op, 1) == -1) {
      perror("ERROR INREMENTING THE SEMAPHORE");
    }
    break;
  }
  case -1: {
    perror("ERROR CREATING A SON PROCESS");
    return -1;
  }
  default: {
    switch (fork()) {
    case 0: {
      if (semop(semaphore, &sem_prob, 1) == -1) {
        perror("ERROR DECREMENTING THE SEMAPHORE");
      }
      for (nbr2; nbr2 < 5; nbr2++) {
        printf("JE SUIS LE FILS DE PID %d \n", getpid());
        sleep(1);
      }
      if (semop(semaphore, &sem_op, 1) == -1) {
        perror("ERROR DECREMENTING THE SEMAPHORE");
      }
      break;
    }
    case -1: {
      perror("ERROR CREATING A SON PROCESS");
      return -1;
    }
    default: {
      wait(NULL);
      wait(NULL);
      if (semctl(semaphore, 0, IPC_RMID, NULL) == -1) {
        perror("ERROR LIBERATING SEMAPHORE");
      }
      break;
    }
    }
    break;
  }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1b0,%edx
call   1030 <semget@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    11ed <main+0x4d>
lea    0xe18(%rip),%rdi
call   1060 <perror@plt>
mov    -0x10(%rbp),%edi
mov    0x2dd9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    $0x1,%ecx
call   1070 <semctl@plt>
cmp    $0xffffffff,%eax
jne    121a <main+0x7a>
lea    0xe08(%rip),%rdi
call   1060 <perror@plt>
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0xffffffff,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
xor    %eax,%eax
call   10c0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x44(%rbp)
sub    $0xffffffff,%eax
je     12fa <main+0x15a>
jmp    1262 <main+0xc2>
mov    -0x44(%rbp),%eax
test   %eax,%eax
jne    1312 <main+0x172>
jmp    1272 <main+0xd2>
mov    -0x10(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    1298 <main+0xf8>
lea    0xdad(%rip),%rdi
call   1060 <perror@plt>
cmpl   $0x5,-0x8(%rbp)
jge    12cf <main+0x12f>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xdaf(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1298 <main+0xf8>
mov    -0x10(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    12f5 <main+0x155>
lea    0xd8d(%rip),%rdi
call   1060 <perror@plt>
jmp    1422 <main+0x282>
lea    0xd9c(%rip),%rdi
call   1060 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1429 <main+0x289>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x48(%rbp)
sub    $0xffffffff,%eax
je     13c4 <main+0x224>
jmp    132c <main+0x18c>
mov    -0x48(%rbp),%eax
test   %eax,%eax
jne    13dc <main+0x23c>
jmp    133c <main+0x19c>
mov    -0x10(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    1362 <main+0x1c2>
lea    0xce3(%rip),%rdi
call   1060 <perror@plt>
cmpl   $0x5,-0xc(%rbp)
jge    1399 <main+0x1f9>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xce5(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1362 <main+0x1c2>
mov    -0x10(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    13bf <main+0x21f>
lea    0xc86(%rip),%rdi
call   1060 <perror@plt>
jmp    141d <main+0x27d>
lea    0xcd2(%rip),%rdi
call   1060 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1429 <main+0x289>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <wait@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <wait@plt>
mov    -0x10(%rbp),%edi
mov    0x2be0(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1070 <semctl@plt>
cmp    $0xffffffff,%eax
jne    1418 <main+0x278>
lea    0xca7(%rip),%rdi
call   1060 <perror@plt>
jmp    141d <main+0x27d>
jmp    1422 <main+0x282>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1b0,%edx
call   1030 <semget@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    11d2 <main+0x32>
lea    0xe33(%rip),%rdi
call   1060 <perror@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%ecx
call   1070 <semctl@plt>
cmp    $0xffffffff,%eax
jne    11fa <main+0x5a>
lea    0xe28(%rip),%rdi
call   1060 <perror@plt>
movl   $0x1,0x20(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x28(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
movups %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10c0 <fork@plt>
cmp    $0xffffffff,%eax
je     13ec <main+0x24c>
test   %eax,%eax
jne    1305 <main+0x165>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    1251 <main+0xb1>
lea    0xdf4(%rip),%rdi
call   1060 <perror@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe02(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    1438 <main+0x298>
lea    0xd7d(%rip),%rdi
jmp    1433 <main+0x293>
xor    %eax,%eax
call   10c0 <fork@plt>
cmp    $0xffffffff,%eax
je     13ec <main+0x24c>
test   %eax,%eax
jne    1405 <main+0x265>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    133f <main+0x19f>
lea    0xd06(%rip),%rdi
call   1060 <perror@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd14(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1080 <semop@plt>
cmp    $0xffffffff,%eax
jne    1438 <main+0x298>
lea    0xc56(%rip),%rdi
jmp    1433 <main+0x293>
lea    0xcaa(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret
xor    %edi,%edi
call   10b0 <wait@plt>
xor    %edi,%edi
call   10b0 <wait@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
xor    %ecx,%ecx
call   1070 <semctl@plt>
cmp    $0xffffffff,%eax
jne    1438 <main+0x298>
lea    0xc87(%rip),%rdi
call   1060 <perror@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.sembuf = type { i32, i64, i64 }
@IPC_PRIVATE = global i32 0
@.str = [29 x i8] c"ERROR CREATING THE SEMAPHORE\00"
@SETVAL = global i32 0
@.str.1 = [35 x i8] c"ERROR SETTING SEMAPHORE VALUE TO 1\00"
@.str.2 = [33 x i8] c"ERROR DECREMENTING THE SEMAPHORE\00"
@.str.3 = [28 x i8] c"JE SUIS LE FILS DE PID %d \0A\00"
@.str.4 = [32 x i8] c"ERROR INREMENTING THE SEMAPHORE\00"
@.str.5 = [29 x i8] c"ERROR CREATING A SON PROCESS\00"
@IPC_RMID = global i32 0
@.str.6 = [27 x i8] c"ERROR LIBERATING SEMAPHORE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sembuf
%6 = alloca %struct.sembuf
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%7 = load i32, i32* @IPC_PRIVATE
%8 = call i32 @semget(i32 %7, i32 1, i32 432)
store i32 %8, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = load i32, i32* %4
%14 = load i32, i32* @SETVAL
%15 = call i32 @semctl(i32 %13, i32 0, i32 %14, i32 1)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
%20 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %5, i32 0, i32 2
store i64 0, i64* %20
%21 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %5, i32 0, i32 0
store i32 1, i32* %21
%22 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %5, i32 0, i32 1
store i64 0, i64* %22
%23 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %6, i32 0, i32 2
store i64 0, i64* %23
%24 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %6, i32 0, i32 0
store i32 -1, i32* %24
%25 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %6, i32 0, i32 1
store i64 0, i64* %25
%26 = call i32 (...) @fork()
switch i32 %26, label %54 [
i32 0, label %27
i32 -1, label %52
]
27: ; preds = %19
%28 = load i32, i32* %4
%29 = call i32 @semop(i32 %28, %struct.sembuf* %6, i32 1)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = load i32, i32* %2
br label %35
35: ; preds = %42, %33
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 5
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = call i32 (...) @getpid()
%40 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = call i32 @sleep(i32 1)
br label %42
42: ; preds = %38
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
br label %35
45: ; preds = %35
%46 = load i32, i32* %4
%47 = call i32 @semop(i32 %46, %struct.sembuf* %5, i32 1)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
br label %94
52: ; preds = %19
%53 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %96
54: ; preds = %19
%55 = call i32 (...) @fork()
switch i32 %55, label %83 [
i32 0, label %56
i32 -1, label %81
]
56: ; preds = %54
%57 = load i32, i32* %4
%58 = call i32 @semop(i32 %57, %struct.sembuf* %6, i32 1)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %56
%63 = load i32, i32* %3
br label %64
64: ; preds = %71, %62
%65 = load i32, i32* %3
%66 = icmp slt i32 %65, 5
br i1 %66, label %67, label %74
67: ; preds = %64
%68 = call i32 (...) @getpid()
%69 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%70 = call i32 @sleep(i32 1)
br label %71
71: ; preds = %67
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1
store i32 %73, i32* %3
br label %64
74: ; preds = %64
%75 = load i32, i32* %4
%76 = call i32 @semop(i32 %75, %struct.sembuf* %5, i32 1)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %80
80: ; preds = %78, %74
br label %93
81: ; preds = %54
%82 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %96
83: ; preds = %54
%84 = call i32 @wait(i32* null)
%85 = call i32 @wait(i32* null)
%86 = load i32, i32* %4
%87 = load i32, i32* @IPC_RMID
%88 = call i32 @semctl(i32 %86, i32 0, i32 %87, i32 0)
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %92
90: ; preds = %83
%91 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %92
92: ; preds = %90, %83
br label %93
93: ; preds = %92, %80
br label %94
94: ; preds = %93, %51
%95 = call i32 @exit(i32 0)
unreachable
96: ; preds = %81, %52
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i64, i64 }
@IPC_PRIVATE = global i32 0
@.str = [29 x i8] c"ERROR CREATING THE SEMAPHORE\00"
@SETVAL = global i32 0
@.str.1 = [35 x i8] c"ERROR SETTING SEMAPHORE VALUE TO 1\00"
@.str.2 = [33 x i8] c"ERROR DECREMENTING THE SEMAPHORE\00"
@.str.3 = [28 x i8] c"JE SUIS LE FILS DE PID %d \0A\00"
@.str.4 = [32 x i8] c"ERROR INREMENTING THE SEMAPHORE\00"
@.str.5 = [29 x i8] c"ERROR CREATING A SON PROCESS\00"
@IPC_RMID = global i32 0
@.str.6 = [27 x i8] c"ERROR LIBERATING SEMAPHORE\00"
define i32 @main() {
%1 = alloca %struct.sembuf
%2 = alloca %struct.sembuf
%3 = load i32, i32* @IPC_PRIVATE
%4 = tail call i32 @semget(i32 %3, i32 1, i32 432)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* @SETVAL
%10 = tail call i32 @semctl(i32 %4, i32 0, i32 %9, i32 1)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = bitcast %struct.sembuf* %1 to i8*
%16 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %1, i64 0, i32 0
store i32 1, i32* %16
%17 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %1, i64 0, i32 1
%18 = bitcast i64* %17 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %18
%19 = bitcast %struct.sembuf* %2 to i8*
%20 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 0
store i32 -1, i32* %20
%21 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 1
%22 = bitcast i64* %21 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %22
%23 = tail call i32 (...) @fork()
switch i32 %23, label %49 [
i32 0, label %24
i32 -1, label %86
]
24: ; preds = %14
%25 = call i32 @semop(i32 %4, %struct.sembuf* %2, i32 1)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = call i32 (...) @getpid()
%31 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = call i32 @sleep(i32 1)
%33 = call i32 (...) @getpid()
%34 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = call i32 @sleep(i32 1)
%36 = call i32 (...) @getpid()
%37 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = call i32 @sleep(i32 1)
%39 = call i32 (...) @getpid()
%40 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = call i32 @sleep(i32 1)
%42 = call i32 (...) @getpid()
%43 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = call i32 @sleep(i32 1)
%45 = call i32 @semop(i32 %4, %struct.sembuf* %1, i32 1)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %84
47: ; preds = %29
%48 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %84
49: ; preds = %14
%50 = tail call i32 (...) @fork()
switch i32 %50, label %76 [
i32 0, label %51
i32 -1, label %86
]
51: ; preds = %49
%52 = call i32 @semop(i32 %4, %struct.sembuf* %2, i32 1)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
%57 = call i32 (...) @getpid()
%58 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = call i32 @sleep(i32 1)
%60 = call i32 (...) @getpid()
%61 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = call i32 @sleep(i32 1)
%63 = call i32 (...) @getpid()
%64 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = call i32 @sleep(i32 1)
%66 = call i32 (...) @getpid()
%67 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %66)
%68 = call i32 @sleep(i32 1)
%69 = call i32 (...) @getpid()
%70 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = call i32 @sleep(i32 1)
%72 = call i32 @semop(i32 %4, %struct.sembuf* %1, i32 1)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %84
74: ; preds = %56
%75 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %84
76: ; preds = %49
%77 = tail call i32 @wait(i32* null)
%78 = tail call i32 @wait(i32* null)
%79 = load i32, i32* @IPC_RMID
%80 = tail call i32 @semctl(i32 %4, i32 0, i32 %79, i32 0)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %84
82: ; preds = %76
%83 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %84
84: ; preds = %74, %56, %82, %76, %29, %47
%85 = call i32 @exit(i32 0)
unreachable
86: ; preds = %49, %14
%87 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
ret i32 -1
}