#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*/ assert(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ semctl(int, int, int /*<<< orphan*/, ...);
int semget(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ semop(int, struct sembuf *, int);
scalar_t__ shmat(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ shmctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ shmdt(int *);
int shmget(int /*<<< orphan*/, int, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int shmid, semid;
  int val = 0, maxval;
  int *shmaddr;
  struct sembuf P, V;
  V.sem_num = P.sem_num = 0;
  V.sem_flg = P.sem_flg = 0;
  assert(argv[1]);
  maxval = strtol(argv[1], NULL, 10);
  semid = semget(IPC_PRIVATE, 1, 0666);
  shmid = shmget(IPC_PRIVATE, sizeof(int), 0666);
  semctl(semid, 1, SETVAL, val);
  shmaddr = (int *)shmat(shmid, NULL, 0);
  if (fork() == 0) {
    printf("son\n");
    V.sem_op = P.sem_op = -1;
    while (1) {
      semop(semid, &P, 1);
      printf("son: %d\n", *shmaddr);
      (*shmaddr)++;
      semop(semid, &V, 1);
      if (*shmaddr == 0) {
        printf("son: terminating\n");
        exit(0);
      }
    }
  }
  *shmaddr = 0;
  V.sem_op = 2;
  P.sem_op = 0;
  printf("parent\n");
  while (1) {
    semop(semid, &P, 1);
    printf("parent: %d\n", *shmaddr);
    (*shmaddr)++;
    if (*shmaddr > maxval) {
      printf("parent: maxval\n");
      *shmaddr = -1;
      break;
    }
    semop(semid, &V, 1);
  }
  semop(semid, &V, 1);
  printf("parent: waiting\n");
  semop(semid, &P, 1);
  printf("parent: terminating\n");
  shmdt(shmaddr);
  shmctl(semid, IPC_RMID, NULL);
  semctl(semid, 0, IPC_RMID);
  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,-0x1c(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x20(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1b6,%edx
call   1030 <semget@plt>
mov    %eax,-0x18(%rbp)
mov    0x2da3(%rip),%rax
mov    (%rax),%edi
mov    $0x4,%esi
mov    $0x1b6,%edx
call   10b0 <shmget@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
mov    0x2d6d(%rip),%rax
mov    (%rax),%edx
mov    -0x1c(%rbp),%ecx
mov    $0x1,%esi
mov    $0x0,%al
call   1090 <semctl@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <shmat@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    131b <main+0x15b>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x40(%rbp)
movl   $0xffffffff,-0x58(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1316 <main+0x156>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
jmp    12b3 <main+0xf3>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x2,-0x58(%rbp)
movl   $0x0,-0x40(%rbp)
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
cmp    -0x20(%rbp),%eax
jle    139d <main+0x1dd>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    13b3 <main+0x1f3>
mov    -0x18(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
jmp    1341 <main+0x181>
mov    -0x18(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <semop@plt>
lea    0xc6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <shmdt@plt>
mov    -0x18(%rbp),%edi
mov    0x2bd4(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1080 <shmctl@plt>
mov    -0x18(%rbp),%edi
mov    0x2bbf(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    $0x0,%al
call   1090 <semctl@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rsp)
movups %xmm0,0x28(%rsp)
mov    0x8(%rsi),%rdi
call   1070 <assert@plt>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r14d
mov    0x2dd7(%rip),%rbx
mov    (%rbx),%edi
mov    $0x1,%esi
mov    $0x1b6,%edx
call   1030 <semget@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    $0x4,%esi
mov    $0x1b6,%edx
call   10c0 <shmget@plt>
mov    %eax,%ebx
mov    0x2d92(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %eax,%eax
call   10a0 <semctl@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   10f0 <fork@plt>
test   %rax,%rax
je     138a <main+0x1ba>
movl   $0x0,(%rbx)
movl   $0x2,0x20(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xd8a(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   10d0 <semop@plt>
mov    (%rbx),%esi
lea    0xd5f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
cmp    %r14d,%eax
jge    1306 <main+0x136>
lea    0x20(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xd3b(%rip),%r13
xchg   %ax,%ax
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   10d0 <semop@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   10d0 <semop@plt>
mov    (%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
cmp    %r14d,%eax
jl     12d0 <main+0x100>
lea    0xd0f(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,(%rbx)
lea    0x20(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   10d0 <semop@plt>
lea    0xcfb(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   10d0 <semop@plt>
lea    0xcee(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <shmdt@plt>
mov    0x2c77(%rip),%rbx
mov    (%rbx),%esi
mov    %ebp,%edi
xor    %edx,%edx
call   1090 <shmctl@plt>
mov    (%rbx),%edx
mov    %ebp,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10a0 <semctl@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcbe(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,0x8(%rsp)
ff
movl   $0xffffffff,0x20(%rsp)
ff
lea    0x8(%rsp),%r14
lea    0xc4e(%rip),%r15
lea    0x20(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   10d0 <semop@plt>
mov    (%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
addl   $0x1,(%rbx)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   10d0 <semop@plt>
cmpl   $0x0,(%rbx)
jne    13c0 <main+0x1f0>
lea    0xc5a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.sembuf = type { i32, i64, i64 }
@IPC_PRIVATE = global i32 0
@SETVAL = global i32 0
@.str = [5 x i8] c"son\0A\00"
@.str.1 = [9 x i8] c"son: %d\0A\00"
@.str.2 = [18 x i8] c"son: terminating\0A\00"
@.str.3 = [8 x i8] c"parent\0A\00"
@.str.4 = [12 x i8] c"parent: %d\0A\00"
@.str.5 = [16 x i8] c"parent: maxval\0A\00"
@.str.6 = [17 x i8] c"parent: waiting\0A\00"
@.str.7 = [21 x i8] c"parent: terminating\0A\00"
@IPC_RMID = global i32 0
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 %struct.sembuf
%12 = alloca %struct.sembuf
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%13 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %11, i32 0, i32 2
store i64 0, i64* %13
%14 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 2
store i64 0, i64* %14
%15 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %11, i32 0, i32 1
store i64 0, i64* %15
%16 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 1
store i64 0, i64* %16
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @assert(i8* %19)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strtol(i8* %23, i32* null, i32 10)
store i32 %24, i32* %9
%25 = load i32, i32* @IPC_PRIVATE
%26 = call i32 @semget(i32 %25, i32 1, i32 438)
store i32 %26, i32* %7
%27 = load i32, i32* @IPC_PRIVATE
%28 = call i32 @shmget(i32 %27, i32 4, i32 438)
store i32 %28, i32* %6
%29 = load i32, i32* %7
%30 = load i32, i32* @SETVAL
%31 = load i32, i32* %8
%32 = call i32 (i32, i32, i32, ...) @semctl(i32 %29, i32 1, i32 %30, i32 %31)
%33 = load i32, i32* %6
%34 = call i64 @shmat(i32 %33, i32* null, i32 0)
%35 = inttoptr i64 %34 to i32*
store i32* %35, i32** %10
%36 = call i64 (...) @fork()
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %60
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%40 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %11, i32 0, i32 0
store i32 -1, i32* %40
%41 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 0
store i32 -1, i32* %41
br label %42
42: ; preds = %38, %59
%43 = load i32, i32* %7
%44 = call i32 @semop(i32 %43, %struct.sembuf* %11, i32 1)
%45 = load i32*, i32** %10
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32*, i32** %10
%49 = load i32, i32* %48
%50 = add nsw i32 %49, 1
store i32 %50, i32* %48
%51 = load i32, i32* %7
%52 = call i32 @semop(i32 %51, %struct.sembuf* %12, i32 1)
%53 = load i32*, i32** %10
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %42
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 @exit(i32 0)
unreachable
59: ; preds = %42
br label %42
60: ; preds = %2
%61 = load i32*, i32** %10
store i32 0, i32* %61
%62 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 0
store i32 2, i32* %62
%63 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %11, i32 0, i32 0
store i32 0, i32* %63
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %65
65: ; preds = %60, %81
%66 = load i32, i32* %7
%67 = call i32 @semop(i32 %66, %struct.sembuf* %11, i32 1)
%68 = load i32*, i32** %10
%69 = load i32, i32* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%71 = load i32*, i32** %10
%72 = load i32, i32* %71
%73 = add nsw i32 %72, 1
store i32 %73, i32* %71
%74 = load i32*, i32** %10
%75 = load i32, i32* %74
%76 = load i32, i32* %9
%77 = icmp sgt i32 %75, %76
br i1 %77, label %78, label %81
78: ; preds = %65
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%80 = load i32*, i32** %10
store i32 -1, i32* %80
br label %84
81: ; preds = %65
%82 = load i32, i32* %7
%83 = call i32 @semop(i32 %82, %struct.sembuf* %12, i32 1)
br label %65
84: ; preds = %78
%85 = load i32, i32* %7
%86 = call i32 @semop(i32 %85, %struct.sembuf* %12, i32 1)
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%88 = load i32, i32* %7
%89 = call i32 @semop(i32 %88, %struct.sembuf* %11, i32 1)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%91 = load i32*, i32** %10
%92 = call i32 @shmdt(i32* %91)
%93 = load i32, i32* %7
%94 = load i32, i32* @IPC_RMID
%95 = call i32 @shmctl(i32 %93, i32 %94, i32* null)
%96 = load i32, i32* %7
%97 = load i32, i32* @IPC_RMID
%98 = call i32 (i32, i32, i32, ...) @semctl(i32 %96, i32 0, i32 %97)
ret i32 0
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i64, i64 }
@IPC_PRIVATE = global i32 0
@SETVAL = global i32 0
@.str.1 = [9 x i8] c"son: %d\0A\00"
@.str.4 = [12 x i8] c"parent: %d\0A\00"
@IPC_RMID = global i32 0
@str = [7 x i8] c"parent\00"
@str.8 = [15 x i8] c"parent: maxval\00"
@str.9 = [16 x i8] c"parent: waiting\00"
@str.10 = [20 x i8] c"parent: terminating\00"
@str.11 = [4 x i8] c"son\00"
@str.12 = [17 x i8] c"son: terminating\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sembuf
%4 = alloca %struct.sembuf
%5 = bitcast %struct.sembuf* %3 to i8*
%6 = bitcast %struct.sembuf* %4 to i8*
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i64 0, i32 1
%8 = bitcast i64* %7 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %8
%9 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i64 0, i32 1
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %10
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @assert(i8* %12)
%14 = load i8*, i8** %11
%15 = tail call i32 @strtol(i8* nocapture %14, i32* null, i32 10)
%16 = load i32, i32* @IPC_PRIVATE
%17 = tail call i32 @semget(i32 %16, i32 1, i32 438)
%18 = load i32, i32* @IPC_PRIVATE
%19 = tail call i32 @shmget(i32 %18, i32 4, i32 438)
%20 = load i32, i32* @SETVAL
%21 = tail call i32 (i32, i32, i32, ...) @semctl(i32 %17, i32 1, i32 %20, i32 0)
%22 = tail call i64 @shmat(i32 %19, i32* null, i32 0)
%23 = inttoptr i64 %22 to i32*
%24 = tail call i64 (...) @fork()
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %42
26: ; preds = %2
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
%28 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i64 0, i32 0
store i32 -1, i32* %28
%29 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i64 0, i32 0
store i32 -1, i32* %29
br label %30
30: ; preds = %30, %26
%31 = call i32 @semop(i32 %17, %struct.sembuf* %3, i32 1)
%32 = load i32, i32* %23
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %23
%35 = add nsw i32 %34, 1
store i32 %35, i32* %23
%36 = call i32 @semop(i32 %17, %struct.sembuf* %4, i32 1)
%37 = load i32, i32* %23
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %30
39: ; preds = %30
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%41 = call i32 @exit(i32 0)
unreachable
42: ; preds = %2
store i32 0, i32* %23
%43 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i64 0, i32 0
store i32 2, i32* %43
%44 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i64 0, i32 0
store i32 0, i32* %44
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%46 = call i32 @semop(i32 %17, %struct.sembuf* %3, i32 1)
%47 = load i32, i32* %23
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %23
%50 = add nsw i32 %49, 1
store i32 %50, i32* %23
%51 = icmp slt i32 %49, %15
br i1 %51, label %63, label %52
52: ; preds = %63, %42
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.8, i64 0, i64 0))
store i32 -1, i32* %23
%54 = call i32 @semop(i32 %17, %struct.sembuf* %4, i32 1)
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
%56 = call i32 @semop(i32 %17, %struct.sembuf* %3, i32 1)
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
%58 = call i32 @shmdt(i32* %23)
%59 = load i32, i32* @IPC_RMID
%60 = call i32 @shmctl(i32 %17, i32 %59, i32* null)
%61 = load i32, i32* @IPC_RMID
%62 = call i32 (i32, i32, i32, ...) @semctl(i32 %17, i32 0, i32 %61)
ret i32 0
63: ; preds = %42, %63
%64 = call i32 @semop(i32 %17, %struct.sembuf* %4, i32 1)
%65 = call i32 @semop(i32 %17, %struct.sembuf* %3, i32 1)
%66 = load i32, i32* %23
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %23
%69 = add nsw i32 %68, 1
store i32 %69, i32* %23
%70 = icmp slt i32 %68, %15
br i1 %70, label %63, label %52
}