#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;
  void *sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ IPC_PRIVATE;
int /*<<< orphan*/ IPC_RMID;
void *SEM_UNDO;
int /*<<< orphan*/ SETALL;
int fork();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ semctl(int, int /*<<< orphan*/, 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 /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main() {
  int i, semID, shmID, *shared_mem, count = 0;
  int pid[8];
  struct sembuf vsema, psema;
  unsigned short anfangswert[1];
  shmID = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0644);
  shared_mem = (int *)shmat(shmID, 0, 0);
  *shared_mem = 0;
  semID = semget(IPC_PRIVATE, 1, IPC_CREAT | 0644);
  anfangswert[0] = 1;
  semctl(semID, 0, SETALL, anfangswert);
  vsema.sem_num = 0;
  vsema.sem_op = 1;
  vsema.sem_flg = SEM_UNDO;
  psema.sem_num = 0;
  psema.sem_op = -1;
  psema.sem_flg = SEM_UNDO;
  for (i = 0; i < 8; i++) {
    pid[i] = fork();
    if (pid[i] == -1) {
      printf("  %diter Kindprozess nicht erzeugbar\n", i);
      return 0;
    }
    if (pid[i] == 0) {
      while (1) {
        semop(semID, &psema, 1);
        if (*shared_mem < 100000) {
          *shared_mem += 1;
          count++;
          semop(semID, &vsema, 1);
        } else {
          semop(semID, &vsema, 1);
          break;
        }
      }
      printf("  %ites Kind erhoehte Wert um %i\n", i, count);
      shmdt(shared_mem);
      return 0;
    }
  }
  for (i = 0; i < 8; i++)
    waitpid(pid[i], NULL, 0);
  printf("  Shared Memory Inhalt = %i, MAXCOUNT = %i\n", *shared_mem, 100000);
  shmdt(shared_mem);
  shmctl(shmID, IPC_RMID, 0);
  semctl(semID, 0, IPC_RMID);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    0x2df7(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0x4,%esi
call   10a0 <shmget@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <shmat@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    0x2db8(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0x1,%esi
call   1030 <semget@plt>
mov    %eax,-0xc(%rbp)
movw   $0x1,-0x72(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2d9b(%rip),%rax
mov    (%rax),%edx
lea    -0x72(%rbp),%rcx
xor    %esi,%esi
mov    $0x0,%al
call   1080 <semctl@plt>
movq   $0x0,-0x48(%rbp)
movl   $0x1,-0x58(%rbp)
mov    0x2d9e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x60(%rbp)
movl   $0xffffffff,-0x70(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    137a <main+0x1da>
mov    $0x0,%al
call   10c0 <fork@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
cmpl   $0xffffffff,-0x40(%rbp,%rax,4)
jne    12c4 <main+0x124>
mov    -0x8(%rbp),%esi
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13fd <main+0x25d>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
jne    1367 <main+0x1c7>
jmp    12d8 <main+0x138>
mov    -0xc(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <semop@plt>
mov    -0x18(%rbp),%rax
cmpl   $0x186a0,(%rax)
jge    1323 <main+0x183>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <semop@plt>
jmp    1339 <main+0x199>
mov    -0xc(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <semop@plt>
jmp    133e <main+0x19e>
jmp    12d8 <main+0x138>
mov    -0x8(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <shmdt@plt>
movl   $0x0,-0x4(%rbp)
jmp    13fd <main+0x25d>
jmp    136c <main+0x1cc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    127d <main+0xdd>
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    13ac <main+0x20c>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1381 <main+0x1e1>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xc8f(%rip),%rdi
mov    $0x186a0,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <shmdt@plt>
mov    -0x10(%rbp),%edi
mov    0x2bf8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <shmctl@plt>
mov    -0xc(%rbp),%edi
mov    0x2be5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    $0x0,%al
call   1080 <semctl@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2e2b(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2e01(%rip),%r14
mov    $0x1a4,%ebx
mov    (%r14),%edx
or     %ebx,%edx
mov    $0x4,%esi
call   10a0 <shmget@plt>
xor    %r15d,%r15d
mov    %eax,0x14(%rsp)
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <shmat@plt>
mov    %rax,%r13
movl   $0x0,(%rax)
mov    0x0(%rbp),%edi
or     (%r14),%ebx
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <semget@plt>
mov    %eax,%r14d
movw   $0x1,0x2(%rsp)
mov    0x2db7(%rip),%rax
mov    (%rax),%edx
lea    0x2(%rsp),%rcx
mov    %r14d,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1080 <semctl@plt>
movq   $0x0,0x40(%rsp)
movl   $0x1,0x30(%rsp)
mov    0x2db4(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x38(%rsp)
movq   $0x0,0x28(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
mov    %rax,0x20(%rsp)
xor    %eax,%eax
call   10c0 <fork@plt>
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,%r12d
test   %eax,%eax
jne    1279 <main+0xd9>
mov    %r12d,%r15d
jmp    134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x1,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,%ebx
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x2,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,%ebp
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x3,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,0x10(%rsp)
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x4,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,0xc(%rsp)
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x5,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,0x8(%rsp)
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x6,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     134f <main+0x1af>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    $0x7,%r15d
cmp    $0xffffffff,%eax
je     13e4 <main+0x244>
test   %eax,%eax
jne    1406 <main+0x266>
lea    0x18(%rsp),%rsi
mov    %r14d,%edi
mov    $0x1,%edx
call   10b0 <semop@plt>
mov    0x0(%r13),%eax
xor    %ebx,%ebx
cmp    $0x1869f,%eax
jg     13b5 <main+0x215>
xor    %ebx,%ebx
lea    0x30(%rsp),%r12
lea    0x18(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
mov    %eax,0x0(%r13)
add    $0x1,%ebx
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   10b0 <semop@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   10b0 <semop@plt>
mov    0x0(%r13),%eax
cmp    $0x186a0,%eax
jl     1380 <main+0x1e0>
lea    0x30(%rsp),%rsi
mov    %r14d,%edi
mov    $0x1,%edx
call   10b0 <semop@plt>
lea    0xc58(%rip),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1040 <shmdt@plt>
jmp    13f5 <main+0x255>
lea    0xc15(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%r15d
call   1060 <waitpid@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    0x10(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    0x4(%rsp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    0x0(%r13),%esi
lea    0xbd2(%rip),%rdi
mov    $0x186a0,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1040 <shmdt@plt>
mov    0x2b3f(%rip),%rbx
mov    (%rbx),%esi
mov    0x14(%rsp),%edi
xor    %edx,%edx
call   1070 <shmctl@plt>
mov    (%rbx),%edx
mov    %r14d,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1080 <semctl@plt>
jmp    13f5 <main+0x255>

LLVM IR (-O0):
%struct.sembuf = type { i32, i8*, i64 }
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@SETALL = global i32 0
@SEM_UNDO = global i8* null
@.str = [38 x i8] c" %diter Kindprozess nicht erzeugbar\0A\00"
@.str.1 = [34 x i8] c" %ites Kind erhoehte Wert um %i\0A\00"
@.str.2 = [44 x i8] c" Shared Memory Inhalt = %i, MAXCOUNT = %i\0A\00"
@IPC_RMID = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [8 x i32]
%8 = alloca %struct.sembuf
%9 = alloca %struct.sembuf
%10 = alloca [1 x i16]
store i32 0, i32* %1
store i32 0, i32* %6
%11 = load i32, i32* @IPC_PRIVATE
%12 = load i32, i32* @IPC_CREAT
%13 = or i32 %12, 420
%14 = call i32 @shmget(i32 %11, i32 4, i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = call i64 @shmat(i32 %15, i32 0, i32 0)
%17 = inttoptr i64 %16 to i32*
store i32* %17, i32** %5
%18 = load i32*, i32** %5
store i32 0, i32* %18
%19 = load i32, i32* @IPC_PRIVATE
%20 = load i32, i32* @IPC_CREAT
%21 = or i32 %20, 420
%22 = call i32 @semget(i32 %19, i32 1, i32 %21)
store i32 %22, i32* %3
%23 = getelementptr inbounds [1 x i16], [1 x i16]* %10, i64 0, i64 0
store i16 1, i16* %23
%24 = load i32, i32* %3
%25 = load i32, i32* @SETALL
%26 = getelementptr inbounds [1 x i16], [1 x i16]* %10, i64 0, i64 0
%27 = call i32 (i32, i32, i32, ...) @semctl(i32 %24, i32 0, i32 %25, i16* %26)
%28 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %8, i32 0, i32 2
store i64 0, i64* %28
%29 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %8, i32 0, i32 0
store i32 1, i32* %29
%30 = load i8*, i8** @SEM_UNDO
%31 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %8, i32 0, i32 1
store i8* %30, i8** %31
%32 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %9, i32 0, i32 2
store i64 0, i64* %32
%33 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %9, i32 0, i32 0
store i32 -1, i32* %33
%34 = load i8*, i8** @SEM_UNDO
%35 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %9, i32 0, i32 1
store i8* %34, i8** %35
store i32 0, i32* %2
br label %36
36: ; preds = %84, %0
%37 = load i32, i32* %2
%38 = icmp slt i32 %37, 8
br i1 %38, label %39, label %87
39: ; preds = %36
%40 = call i32 (...) @fork()
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %42
store i32 %40, i32* %43
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %52
49: ; preds = %39
%50 = load i32, i32* %2
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %50)
store i32 0, i32* %1
br label %112
52: ; preds = %39
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %83
58: ; preds = %52
br label %59
59: ; preds = %58, %76
%60 = load i32, i32* %3
%61 = call i32 @semop(i32 %60, %struct.sembuf* %9, i32 1)
%62 = load i32*, i32** %5
%63 = load i32, i32* %62
%64 = icmp slt i32 %63, 100000
br i1 %64, label %65, label %73
65: ; preds = %59
%66 = load i32*, i32** %5
%67 = load i32, i32* %66
%68 = add nsw i32 %67, 1
store i32 %68, i32* %66
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
store i32 %70, i32* %6
%71 = load i32, i32* %3
%72 = call i32 @semop(i32 %71, %struct.sembuf* %8, i32 1)
br label %76
73: ; preds = %59
%74 = load i32, i32* %3
%75 = call i32 @semop(i32 %74, %struct.sembuf* %8, i32 1)
br label %77
76: ; preds = %65
br label %59
77: ; preds = %73
%78 = load i32, i32* %2
%79 = load i32, i32* %6
%80 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %78, i32 %79)
%81 = load i32*, i32** %5
%82 = call i32 @shmdt(i32* %81)
store i32 0, i32* %1
br label %112
83: ; preds = %52
br label %84
84: ; preds = %83
%85 = load i32, i32* %2
%86 = add nsw i32 %85, 1
store i32 %86, i32* %2
br label %36
87: ; preds = %36
store i32 0, i32* %2
br label %88
88: ; preds = %97, %87
%89 = load i32, i32* %2
%90 = icmp slt i32 %89, 8
br i1 %90, label %91, label %100
91: ; preds = %88
%92 = load i32, i32* %2
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = call i32 @waitpid(i32 %95, i32* null, i32 0)
br label %97
97: ; preds = %91
%98 = load i32, i32* %2
%99 = add nsw i32 %98, 1
store i32 %99, i32* %2
br label %88
100: ; preds = %88
%101 = load i32*, i32** %5
%102 = load i32, i32* %101
%103 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %102, i32 100000)
%104 = load i32*, i32** %5
%105 = call i32 @shmdt(i32* %104)
%106 = load i32, i32* %4
%107 = load i32, i32* @IPC_RMID
%108 = call i32 @shmctl(i32 %106, i32 %107, i32 0)
%109 = load i32, i32* %3
%110 = load i32, i32* @IPC_RMID
%111 = call i32 (i32, i32, i32, ...) @semctl(i32 %109, i32 0, i32 %110)
store i32 0, i32* %1
br label %112
112: ; preds = %100, %77, %49
%113 = load i32, i32* %1
ret i32 %113
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i8*, i64 }
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@SETALL = global i32 0
@SEM_UNDO = global i8* null
@.str = [38 x i8] c" %diter Kindprozess nicht erzeugbar\0A\00"
@.str.1 = [34 x i8] c" %ites Kind erhoehte Wert um %i\0A\00"
@.str.2 = [44 x i8] c" Shared Memory Inhalt = %i, MAXCOUNT = %i\0A\00"
@IPC_RMID = global i32 0
define i32 @main() {
%1 = alloca %struct.sembuf
%2 = alloca %struct.sembuf
%3 = alloca [1 x i16]
%4 = bitcast %struct.sembuf* %1 to i8*
%5 = bitcast %struct.sembuf* %2 to i8*
%6 = bitcast [1 x i16]* %3 to i8*
%7 = load i32, i32* @IPC_PRIVATE
%8 = load i32, i32* @IPC_CREAT
%9 = or i32 %8, 420
%10 = tail call i32 @shmget(i32 %7, i32 4, i32 %9)
%11 = tail call i64 @shmat(i32 %10, i32 0, i32 0)
%12 = inttoptr i64 %11 to i32*
store i32 0, i32* %12
%13 = load i32, i32* @IPC_PRIVATE
%14 = load i32, i32* @IPC_CREAT
%15 = or i32 %14, 420
%16 = tail call i32 @semget(i32 %13, i32 1, i32 %15)
%17 = getelementptr inbounds [1 x i16], [1 x i16]* %3, i64 0, i64 0
store i16 1, i16* %17
%18 = load i32, i32* @SETALL
%19 = call i32 (i32, i32, i32, ...) @semctl(i32 %16, i32 0, i32 %18, i16* %17)
%20 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %1, i64 0, i32 2
store i64 0, i64* %20
%21 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %1, i64 0, i32 0
store i32 1, i32* %21
%22 = load i8*, i8** @SEM_UNDO
%23 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %1, i64 0, i32 1
store i8* %22, i8** %23
%24 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 2
store i64 0, i64* %24
%25 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 0
store i32 -1, i32* %25
%26 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 1
store i8* %22, i8** %26
%27 = call i32 (...) @fork()
switch i32 %27, label %50 [
i32 -1, label %33
i32 0, label %28
]
28: ; preds = %62, %60, %58, %56, %54, %52, %50, %0
%29 = phi i32 [ %27, %0 ], [ 1, %50 ], [ 2, %52 ], [ 3, %54 ], [ 4, %56 ], [ 5, %58 ], [ 6, %60 ], [ 7, %62 ]
%30 = call i32 @semop(i32 %16, %struct.sembuf* %2, i32 1)
%31 = load i32, i32* %12
%32 = icmp slt i32 %31, 100000
br i1 %32, label %36, label %45
33: ; preds = %62, %60, %58, %56, %54, %52, %50, %0
%34 = phi i32 [ 0, %0 ], [ 1, %50 ], [ 2, %52 ], [ 3, %54 ], [ 4, %56 ], [ 5, %58 ], [ 6, %60 ], [ 7, %62 ]
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %34)
br label %80
36: ; preds = %28, %36
%37 = phi i32 [ %43, %36 ], [ %31, %28 ]
%38 = phi i32 [ %40, %36 ], [ 0, %28 ]
%39 = add nsw i32 %37, 1
store i32 %39, i32* %12
%40 = add nuw nsw i32 %38, 1
%41 = call i32 @semop(i32 %16, %struct.sembuf* %1, i32 1)
%42 = call i32 @semop(i32 %16, %struct.sembuf* %2, i32 1)
%43 = load i32, i32* %12
%44 = icmp slt i32 %43, 100000
br i1 %44, label %36, label %45
45: ; preds = %36, %28
%46 = phi i32 [ 0, %28 ], [ %40, %36 ]
%47 = call i32 @semop(i32 %16, %struct.sembuf* %1, i32 1)
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %46)
%49 = call i32 @shmdt(i32* %12)
br label %80
50: ; preds = %0
%51 = call i32 (...) @fork()
switch i32 %51, label %52 [
i32 -1, label %33
i32 0, label %28
]
52: ; preds = %50
%53 = call i32 (...) @fork()
switch i32 %53, label %54 [
i32 -1, label %33
i32 0, label %28
]
54: ; preds = %52
%55 = call i32 (...) @fork()
switch i32 %55, label %56 [
i32 -1, label %33
i32 0, label %28
]
56: ; preds = %54
%57 = call i32 (...) @fork()
switch i32 %57, label %58 [
i32 -1, label %33
i32 0, label %28
]
58: ; preds = %56
%59 = call i32 (...) @fork()
switch i32 %59, label %60 [
i32 -1, label %33
i32 0, label %28
]
60: ; preds = %58
%61 = call i32 (...) @fork()
switch i32 %61, label %62 [
i32 -1, label %33
i32 0, label %28
]
62: ; preds = %60
%63 = call i32 (...) @fork()
switch i32 %63, label %64 [
i32 -1, label %33
i32 0, label %28
]
64: ; preds = %62
%65 = call i32 @waitpid(i32 %27, i32* null, i32 0)
%66 = call i32 @waitpid(i32 %51, i32* null, i32 0)
%67 = call i32 @waitpid(i32 %53, i32* null, i32 0)
%68 = call i32 @waitpid(i32 %55, i32* null, i32 0)
%69 = call i32 @waitpid(i32 %57, i32* null, i32 0)
%70 = call i32 @waitpid(i32 %59, i32* null, i32 0)
%71 = call i32 @waitpid(i32 %61, i32* null, i32 0)
%72 = call i32 @waitpid(i32 %63, i32* null, i32 0)
%73 = load i32, i32* %12
%74 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %73, i32 100000)
%75 = call i32 @shmdt(i32* %12)
%76 = load i32, i32* @IPC_RMID
%77 = call i32 @shmctl(i32 %10, i32 %76, i32 0)
%78 = load i32, i32* @IPC_RMID
%79 = call i32 (i32, i32, i32, ...) @semctl(i32 %16, i32 0, i32 %78)
br label %80
80: ; preds = %64, %45, %33
ret i32 0
}