#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 scalar_t__ pid_t;
typedef int key_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ ForkedFunc(int, int);
int IPC_CREAT;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ MainFunc(int, scalar_t__ *, int);
int atoi(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(scalar_t__ *);
int ftok(char *, int);
scalar_t__ getpid();
scalar_t__ *malloc(int);
int /*<<< orphan*/ msgctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int msgget(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ wait(scalar_t__ *);
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "\n\nUsage : ./decomp NB_PROCESSUS\n\n");
    return 1;
  }
  int nbProc = atoi(argv[1]);
  key_t k = ftok("d", 35);
  if (k == -1) {
    fprintf(stderr, "Problem ftok : %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  } else {
    printf("key : %d\n", k);
  }
  int mqid = -1;
  mqid = msgget(k, 0666 | IPC_CREAT);
  if (mqid == -1) {
    fprintf(stderr, "Problem msgget : %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  } else {
    printf("mqid : %d\n", mqid);
  }
  msgctl(mqid, IPC_RMID, NULL);
  mqid = msgget(k, 0666 | IPC_CREAT);
  if (mqid == -1) {
    fprintf(stderr, "Problem msgget : %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  } else {
    printf("mqid : %d\n", mqid);
  }
  pid_t *children = malloc(nbProc * sizeof(pid_t));
  pid_t mainPID = getpid();
  size_t i;
  for (i = 0; i < nbProc; i++) {
    children[i] = fork();
    if (children[i] == 0) {
      free(children);
      ForkedFunc(nbProc, mqid);
      break;
    }
  }
  if (getpid() == mainPID) {
    MainFunc(nbProc, children, mqid);
    printf("waiting for my childs\n");
    msgctl(mqid, IPC_RMID, NULL);
    for (i = 0; i < nbProc; i++) {
      wait(&children[i]);
    }
    free(children);
  } else {
    printf("Forked process exiting!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1233 <main+0x43>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14df <main+0x2ef>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    0xdd8(%rip),%rdi
mov    $0x23,%esi
call   10e0 <ftok@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    129d <main+0xad>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    %rax,%rdx
lea    0xd9c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x18(%rbp),%esi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
or     $0x1b6,%esi
call   1030 <msgget@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1315 <main+0x125>
mov    0x2d00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    %rax,%rdx
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x1c(%rbp),%esi
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   10a0 <msgctl@plt>
mov    -0x18(%rbp),%edi
mov    0x2c7b(%rip),%rax
mov    (%rax),%esi
or     $0x1b6,%esi
call   1030 <msgget@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    139b <main+0x1ab>
mov    0x2c7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xcbc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x1c(%rbp),%esi
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jae    143b <main+0x24b>
mov    $0x0,%al
call   1110 <fork@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1425 <main+0x235>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10c0 <ForkedFunc@plt>
jmp    143b <main+0x24b>
jmp    142a <main+0x23a>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    13d2 <main+0x1e2>
mov    $0x0,%al
call   1060 <getpid@plt>
cmp    -0x30(%rbp),%rax
jne    14ca <main+0x2da>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <MainFunc@plt>
lea    0xc01(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    0x2b55(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   10a0 <msgctl@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jae    14bc <main+0x2cc>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1100 <wait@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1486 <main+0x296>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
jmp    14d8 <main+0x2e8>
lea    0xba9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    130b <main+0x10b>
mov    0x8(%rsi),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r13d
lea    0xdfb(%rip),%rdi
mov    $0x23,%esi
call   10f0 <ftok@plt>
cmp    $0xffffffff,%eax
je     13fa <main+0x1fa>
mov    %eax,%r15d
lea    0xdf4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2d6c(%rip),%r12
mov    $0x1b6,%ebp
mov    (%r12),%esi
or     %ebp,%esi
mov    %r15d,%edi
call   1030 <msgget@plt>
cmp    $0xffffffff,%eax
je     13da <main+0x1da>
mov    %eax,%ebx
lea    0xddf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2d3f(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   10b0 <msgctl@plt>
or     (%r12),%ebp
mov    %r15d,%edi
mov    %ebp,%esi
call   1030 <msgget@plt>
cmp    $0xffffffff,%eax
je     13da <main+0x1da>
mov    %eax,%r15d
lea    0xda3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movslq %r13d,%r14
lea    0x0(,%r14,8),%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1070 <getpid@plt>
mov    %rax,(%rsp)
test   %r14d,%r14d
je     1340 <main+0x140>
cmp    $0x2,%r14
mov    $0x1,%ebx
cmovae %r14,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1120 <fork@plt>
mov    %rax,(%r12,%rbp,8)
test   %rax,%rax
je     132d <main+0x12d>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <main+0xf0>
jmp    1340 <main+0x140>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
lea    0xce5(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%r13d
jmp    13c8 <main+0x1c8>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %r13d,%edi
mov    %r15d,%esi
call   10d0 <ForkedFunc@plt>
mov    %r13d,%ebx
xor    %r13d,%r13d
xor    %eax,%eax
call   1070 <getpid@plt>
cmp    (%rsp),%rax
jne    13bc <main+0x1bc>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r15d,%edx
call   1060 <MainFunc@plt>
lea    0xd14(%rip),%rdi
call   1050 <puts@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%esi
xor    %r13d,%r13d
mov    %r15d,%edi
xor    %edx,%edx
call   10b0 <msgctl@plt>
test   %ebx,%ebx
je     13b2 <main+0x1b2>
cmp    $0x2,%r14
mov    $0x1,%ebp
cmovae %r14,%rbp
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1110 <wait@plt>
add    $0x8,%rbx
add    $0xffffffffffffffff,%rbp
jne    13a0 <main+0x1a0>
mov    %r12,%rdi
call   1040 <free@plt>
jmp    13c8 <main+0x1c8>
lea    0xca0(%rip),%rdi
call   1050 <puts@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bff(%rip),%rax
mov    (%rax),%ebx
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xc4a(%rip),%rsi
jmp    1418 <main+0x218>
mov    0x2bdf(%rip),%rax
mov    (%rax),%ebx
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xc0c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2ba5(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"\0A\0AUsage : ./decomp NB_PROCESSUS\0A\0A\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [20 x i8] c"Problem ftok : %s.\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [10 x i8] c"key : %d\0A\00"
@IPC_CREAT = global i32 0
@.str.4 = [22 x i8] c"Problem msgget : %s.\0A\00"
@.str.5 = [11 x i8] c"mqid : %d\0A\00"
@IPC_RMID = global i32 0
@.str.6 = [23 x i8] c"waiting for my childs\0A\00"
@.str.7 = [25 x i8] c"Forked process exiting!\0A\00"
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 i64*
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %136
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 35)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %32
25: ; preds = %17
%26 = load i32, i32* @stderr
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %17
%33 = load i32, i32* %7
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32
store i32 -1, i32* %8
%36 = load i32, i32* %7
%37 = load i32, i32* @IPC_CREAT
%38 = or i32 438, %37
%39 = call i32 @msgget(i32 %36, i32 %38)
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %49
42: ; preds = %35
%43 = load i32, i32* @stderr
%44 = load i32, i32* @errno
%45 = call i8* @strerror(i32 %44)
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %35
%50 = load i32, i32* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %49
%53 = load i32, i32* %8
%54 = load i32, i32* @IPC_RMID
%55 = call i32 @msgctl(i32 %53, i32 %54, i32* null)
%56 = load i32, i32* %7
%57 = load i32, i32* @IPC_CREAT
%58 = or i32 438, %57
%59 = call i32 @msgget(i32 %56, i32 %58)
store i32 %59, i32* %8
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %69
62: ; preds = %52
%63 = load i32, i32* @stderr
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %65)
%67 = load i32, i32* @EXIT_FAILURE
%68 = call i32 @exit(i32 %67)
unreachable
69: ; preds = %52
%70 = load i32, i32* %8
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %69
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = mul i64 %74, 8
%76 = trunc i64 %75 to i32
%77 = call i64* @malloc(i32 %76)
store i64* %77, i64** %9
%78 = call i64 (...) @getpid()
store i64 %78, i64* %10
store i64 0, i64* %11
br label %79
79: ; preds = %101, %72
%80 = load i64, i64* %11
%81 = load i32, i32* %6
%82 = sext i32 %81 to i64
%83 = icmp ult i64 %80, %82
br i1 %83, label %84, label %104
84: ; preds = %79
%85 = call i64 (...) @fork()
%86 = load i64*, i64** %9
%87 = load i64, i64* %11
%88 = getelementptr inbounds i64, i64* %86, i64 %87
store i64 %85, i64* %88
%89 = load i64*, i64** %9
%90 = load i64, i64* %11
%91 = getelementptr inbounds i64, i64* %89, i64 %90
%92 = load i64, i64* %91
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %100
94: ; preds = %84
%95 = load i64*, i64** %9
%96 = call i32 @free(i64* %95)
%97 = load i32, i32* %6
%98 = load i32, i32* %8
%99 = call i32 @ForkedFunc(i32 %97, i32 %98)
br label %104
100: ; preds = %84
br label %101
101: ; preds = %100
%102 = load i64, i64* %11
%103 = add i64 %102, 1
store i64 %103, i64* %11
br label %79
104: ; preds = %94, %79
%105 = call i64 (...) @getpid()
%106 = load i64, i64* %10
%107 = icmp eq i64 %105, %106
br i1 %107, label %108, label %133
108: ; preds = %104
%109 = load i32, i32* %6
%110 = load i64*, i64** %9
%111 = load i32, i32* %8
%112 = call i32 @MainFunc(i32 %109, i64* %110, i32 %111)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%114 = load i32, i32* %8
%115 = load i32, i32* @IPC_RMID
%116 = call i32 @msgctl(i32 %114, i32 %115, i32* null)
store i64 0, i64* %11
br label %117
117: ; preds = %127, %108
%118 = load i64, i64* %11
%119 = load i32, i32* %6
%120 = sext i32 %119 to i64
%121 = icmp ult i64 %118, %120
br i1 %121, label %122, label %130
122: ; preds = %117
%123 = load i64*, i64** %9
%124 = load i64, i64* %11
%125 = getelementptr inbounds i64, i64* %123, i64 %124
%126 = call i32 @wait(i64* %125)
br label %127
127: ; preds = %122
%128 = load i64, i64* %11
%129 = add i64 %128, 1
store i64 %129, i64* %11
br label %117
130: ; preds = %117
%131 = load i64*, i64** %9
%132 = call i32 @free(i64* %131)
br label %135
133: ; preds = %104
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %135
135: ; preds = %133, %130
store i32 0, i32* %3
br label %136
136: ; preds = %135, %14
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"\0A\0AUsage : ./decomp NB_PROCESSUS\0A\0A\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [20 x i8] c"Problem ftok : %s.\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [10 x i8] c"key : %d\0A\00"
@IPC_CREAT = global i32 0
@.str.4 = [22 x i8] c"Problem msgget : %s.\0A\00"
@.str.5 = [11 x i8] c"mqid : %d\0A\00"
@IPC_RMID = global i32 0
@str = [24 x i8] c"Forked process exiting!\00"
@str.8 = [22 x i8] c"waiting for my childs\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %88
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 35)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = tail call i8* @strerror(i32 %15)
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %7
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%22 = load i32, i32* @IPC_CREAT
%23 = or i32 %22, 438
%24 = tail call i32 @msgget(i32 %11, i32 %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = tail call i8* @strerror(i32 %28)
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %20
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %24)
%35 = load i32, i32* @IPC_RMID
%36 = tail call i32 @msgctl(i32 %24, i32 %35, i32* null)
%37 = load i32, i32* @IPC_CREAT
%38 = or i32 %37, 438
%39 = tail call i32 @msgget(i32 %11, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %48
41: ; preds = %33
%42 = load i32, i32* @stderr
%43 = load i32, i32* @errno
%44 = tail call i8* @strerror(i32 %43)
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @EXIT_FAILURE
%47 = tail call i32 @exit(i32 %46)
unreachable
48: ; preds = %33
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %39)
%50 = sext i32 %10 to i64
%51 = shl i32 %10, 3
%52 = tail call i64* @malloc(i32 %51)
%53 = tail call i64 (...) @getpid()
%54 = icmp eq i32 %10, 0
br i1 %54, label %68, label %55
55: ; preds = %48
%56 = call i64 @llvm.umax.i64(i64 %50, i64 1)
br label %59
57: ; preds = %59
%58 = icmp eq i64 %64, %56
br i1 %58, label %68, label %59
59: ; preds = %55, %57
%60 = phi i64 [ %64, %57 ], [ 0, %55 ]
%61 = tail call i64 (...) @fork()
%62 = getelementptr inbounds i64, i64* %52, i64 %60
store i64 %61, i64* %62
%63 = icmp eq i64 %61, 0
%64 = add nuw i64 %60, 1
br i1 %63, label %65, label %57
65: ; preds = %59
%66 = tail call i32 @free(i64* %52)
%67 = tail call i32 @ForkedFunc(i32 %10, i32 %39)
br label %68
68: ; preds = %57, %48, %65
%69 = tail call i64 (...) @getpid()
%70 = icmp eq i64 %69, %53
br i1 %70, label %71, label %86
71: ; preds = %68
%72 = tail call i32 @MainFunc(i32 %10, i64* %52, i32 %39)
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0))
%74 = load i32, i32* @IPC_RMID
%75 = tail call i32 @msgctl(i32 %39, i32 %74, i32* null)
br i1 %54, label %84, label %76
76: ; preds = %71
%77 = call i64 @llvm.umax.i64(i64 %50, i64 1)
br label %78
78: ; preds = %76, %78
%79 = phi i64 [ %82, %78 ], [ 0, %76 ]
%80 = getelementptr inbounds i64, i64* %52, i64 %79
%81 = tail call i32 @wait(i64* %80)
%82 = add nuw i64 %79, 1
%83 = icmp eq i64 %82, %77
br i1 %83, label %84, label %78
84: ; preds = %78, %71
%85 = tail call i32 @free(i64* %52)
br label %88
86: ; preds = %68
%87 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %88
88: ; preds = %84, %86, %4
%89 = phi i32 [ 1, %4 ], [ 0, %86 ], [ 0, %84 ]
ret i32 %89
}