#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 int pid_t;
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ PATH_MAX;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ ftok(char *, char);
int /*<<< orphan*/ printf(char *, char *, ...);
int rand();
char *realpath(char *, char *);
int *shmat(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int shmctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ shmdt(int *);
int shmget(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: %s [number]\n", argv[0]);
    return (-1);
  }
  char *number = argv[1];
  int shmid[2];
  int *share[2];
  key_t key[2];
  int size = sizeof(int);
  pid_t child_id[2];
  srand(atoi(number));
  for (int i = 0; i < 2; i++) {
    key[i] = ftok(".", 'a' + i);
    if ((shmid[i] = shmget(key[i], size, 0644 | IPC_CREAT)) == -1) {
      fprintf(stderr, "Error: shmget failed.");
      return (1);
    }
    if ((share[i] = shmat(shmid[i], NULL, 0)) == NULL) {
      fprintf(stderr, "%s: shmat error.\n", argv[0]);
      return (1);
    }
    share[i][0] = rand() % 100000;
    if ((child_id[i] = fork()) == -1) {
      fprintf(stderr, "Error: fork() failed.\n");
      return (1);
    }
    if (child_id[i] == 0) {
      char buf[PATH_MAX + 1];
      char *full_path = realpath("./Beta", buf);
      if (full_path == NULL) {
        fprintf(stderr, "Error: %s can not be found.\n", "./Beta");
        exit(1);
      }
      char shm_buf[21];
      sprintf(shm_buf, "%d", shmid[i]);
      execl(full_path, "./Beta", shm_buf, number, NULL);
      free(full_path);
    } else {
      printf("%s: forked process with ID %d\n", argv[0], child_id[i]);
      printf("%s: passed shm ID %d to process %d\n", argv[0], shmid[i],
             child_id[i]);
    }
  }
  for (int i = 0; i < 2; i++) {
    int status = 0;
    printf("%s: waiting on child process ID %d...\n", argv[0], child_id[i]);
    waitpid(child_id[i], &status, 0);
    printf("%s: result %d read from shared memort: ", argv[0], share[i][0]);
    if (share[i][0]) {
      printf("%s returned %d.\n", "./Beta", status);
    } else {
      printf("%s returned %d.\n", "./Beta", status);
    }
    if (shmdt(share[i])) {
      fprintf(stderr, "shmdt error\n");
      return (1);
    }
    if (shmctl(shmid[i], IPC_RMID, NULL) == -1) {
      fprintf(stderr, "shmctl error\n");
      return (1);
    }
  }
  printf("%s: exiting.\n", argv[0]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1254 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1644 <main+0x434>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jge    14bb <main+0x2ab>
mov    -0x48(%rbp),%eax
add    $0x61,%eax
lea    0xd93(%rip),%rdi
movsbl %al,%esi
call   1100 <ftok@plt>
mov    %eax,%ecx
movslq -0x48(%rbp),%rax
mov    %ecx,-0x38(%rbp,%rax,4)
movslq -0x48(%rbp),%rax
mov    -0x38(%rbp,%rax,4),%edi
mov    -0x3c(%rbp),%esi
mov    0x2d0f(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
call   10c0 <shmget@plt>
movslq -0x48(%rbp),%rcx
mov    %eax,-0x20(%rbp,%rcx,4)
cmp    $0xffffffff,%eax
jne    12fa <main+0xea>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd2d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1644 <main+0x434>
movslq -0x48(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
movslq -0x48(%rbp),%rcx
mov    %rax,-0x30(%rbp,%rcx,8)
cmp    $0x0,%rax
jne    134a <main+0x13a>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcf3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1644 <main+0x434>
mov    $0x0,%al
call   1130 <rand@plt>
mov    $0x186a0,%ecx
cltd
idiv   %ecx
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %edx,(%rax)
mov    $0x0,%al
call   1120 <fork@plt>
movslq -0x48(%rbp),%rcx
mov    %eax,-0x44(%rbp,%rcx,4)
cmp    $0xffffffff,%eax
jne    139f <main+0x18f>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1644 <main+0x434>
movslq -0x48(%rbp),%rax
cmpl   $0x0,-0x44(%rbp,%rax,4)
jne    1466 <main+0x256>
mov    0x2c3b(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x58(%rbp)
lea    0xc73(%rip),%rdi
call   1080 <realpath@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    141c <main+0x20c>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
lea    0xc56(%rip),%rsi
lea    0xc48(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x80(%rbp),%rdi
movslq -0x48(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xc48(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc0c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
call   1110 <execl@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
jmp    14a8 <main+0x298>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
movslq -0x48(%rbp),%rax
mov    -0x44(%rbp,%rax,4),%edx
lea    0xbfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
movslq -0x48(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
movslq -0x48(%rbp),%rax
mov    -0x44(%rbp,%rax,4),%ecx
lea    0xbf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14ad <main+0x29d>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    127e <main+0x6e>
movl   $0x0,-0x84(%rbp)
cmpl   $0x2,-0x84(%rbp)
jge    1628 <main+0x418>
movl   $0x0,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
movslq -0x84(%rbp),%rax
mov    -0x44(%rbp,%rax,4),%edx
lea    0xbc8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x84(%rbp),%rax
mov    -0x44(%rbp,%rax,4),%edi
lea    -0x88(%rbp),%rsi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    (%rax),%edx
lea    0xbb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
cmpl   $0x0,(%rax)
je     156d <main+0x35d>
mov    -0x88(%rbp),%edx
lea    0xbb2(%rip),%rdi
lea    0xaf2(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1588 <main+0x378>
mov    -0x88(%rbp),%edx
lea    0xb92(%rip),%rdi
lea    0xad2(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x84(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1040 <shmdt@plt>
cmp    $0x0,%rax
je     15c6 <main+0x3b6>
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
lea    0xb6a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1644 <main+0x434>
movslq -0x84(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
mov    0x29f8(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   10a0 <shmctl@plt>
cmp    $0xffffffff,%eax
jne    160f <main+0x3ff>
mov    0x29e5(%rip),%rax
mov    (%rax),%edi
lea    0xb2e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1644 <main+0x434>
jmp    1614 <main+0x404>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    14c5 <main+0x2b5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xb02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r13
cmp    $0x2,%edi
jne    130e <main+0xfe>
mov    0x8(%r13),%rbx
mov    %rbx,%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xde1(%rip),%rdi
mov    $0x61,%esi
call   1100 <ftok@plt>
mov    0x2d70(%rip),%r15
mov    $0x1a4,%edx
or     (%r15),%edx
mov    %eax,%edi
mov    $0x4,%esi
call   10c0 <shmget@plt>
cmp    $0xffffffff,%eax
je     14c1 <main+0x2b1>
mov    %eax,%r14d
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
test   %rax,%rax
je     14d6 <main+0x2c6>
mov    %rax,%r12
mov    %rbx,-0x68(%rbp)
xor    %eax,%eax
call   1130 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r12)
xor    %eax,%eax
call   1120 <fork@plt>
test   %eax,%eax
je     132a <main+0x11a>
cmp    $0xffffffff,%eax
je     14f6 <main+0x2e6>
mov    0x0(%r13),%rsi
lea    0xd9f(%rip),%rdi
mov    %eax,%edx
mov    %r15,%rbx
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%rsi
lea    0xda4(%rip),%rdi
mov    %r14d,%edx
mov    %r15d,-0x34(%rbp)
mov    %r15d,%ecx
mov    %rbx,%r15
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13a9 <main+0x199>
mov    0x0(%r13),%rsi
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
jmp    15ba <main+0x3aa>
mov    %eax,-0x34(%rbp)
mov    %r12,-0x40(%rbp)
mov    %rsp,-0x30(%rbp)
mov    0x2cb4(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rsi
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
lea    0xcfa(%rip),%rdi
call   1080 <realpath@plt>
test   %rax,%rax
je     1694 <main+0x484>
mov    %rax,%rbx
lea    0xd06(%rip),%rsi
lea    -0x60(%rbp),%r12
mov    %r12,%rdi
mov    %r14d,%edx
call   10e0 <sprintf@plt>
lea    0xccc(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    -0x68(%rbp),%rcx
xor    %r8d,%r8d
call   1110 <execl@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rsp
mov    -0x40(%rbp),%r12
lea    0xc78(%rip),%rdi
mov    $0x62,%esi
call   1100 <ftok@plt>
mov    $0x1a4,%edx
or     (%r15),%edx
mov    %eax,%edi
mov    $0x4,%esi
call   10c0 <shmget@plt>
cmp    $0xffffffff,%eax
je     14c1 <main+0x2b1>
mov    %eax,%ebx
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <shmat@plt>
test   %rax,%rax
je     14d6 <main+0x2c6>
mov    %rax,%r15
mov    %ebx,-0x30(%rbp)
xor    %eax,%eax
call   1130 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2d,%rcx
add    %edx,%ecx
imul   $0x186a0,%ecx,%ecx
sub    %ecx,%eax
mov    %r15,-0x78(%rbp)
mov    %eax,(%r15)
xor    %eax,%eax
call   1120 <fork@plt>
cmp    $0xffffffff,%eax
mov    -0x34(%rbp),%r15d
je     14f6 <main+0x2e6>
mov    %eax,%ebx
test   %eax,%eax
jne    150b <main+0x2fb>
mov    %ebx,-0x44(%rbp)
mov    %r12,-0x40(%rbp)
mov    %rsp,-0x70(%rbp)
mov    0x2ba1(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rsi
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
lea    0xbe7(%rip),%rdi
call   1080 <realpath@plt>
test   %rax,%rax
je     1694 <main+0x484>
mov    %rax,%r12
lea    0xbf3(%rip),%rsi
lea    -0x60(%rbp),%rbx
mov    %rbx,%rdi
mov    -0x30(%rbp),%edx
call   10e0 <sprintf@plt>
lea    0xbb9(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    -0x68(%rbp),%rcx
xor    %r8d,%r8d
call   1110 <execl@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rsp
mov    -0x40(%rbp),%r12
mov    -0x44(%rbp),%ebx
jmp    1536 <main+0x326>
mov    0x2b10(%rip),%rax
mov    (%rax),%edi
lea    0xb43(%rip),%rsi
jmp    15ae <main+0x39e>
mov    0x2afb(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xb40(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    15b5 <main+0x3a5>
mov    0x2adb(%rip),%rax
mov    (%rax),%edi
lea    0xb36(%rip),%rsi
jmp    15ae <main+0x39e>
mov    0x0(%r13),%rsi
lea    0xb64(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%rsi
lea    0xb6f(%rip),%rdi
mov    -0x30(%rbp),%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    0x0(%r13),%rsi
lea    0xb75(%rip),%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
mov    %r15d,%edi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    0x0(%r13),%rsi
mov    (%r12),%edx
lea    0xb75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x60(%rbp),%edx
lea    0xb8c(%rip),%rdi
lea    0xacc(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
call   1040 <shmdt@plt>
lea    0xb80(%rip),%r15
test   %rax,%rax
je     15cb <main+0x3bb>
mov    0x2a2f(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29fe(%rip),%r12
mov    (%r12),%esi
mov    %r14d,%edi
xor    %edx,%edx
call   10a0 <shmctl@plt>
lea    0xb43(%rip),%r14
cmp    $0xffffffff,%eax
je     168c <main+0x47c>
movl   $0x0,-0x60(%rbp)
mov    0x0(%r13),%rsi
lea    0xabb(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1090 <waitpid@plt>
mov    0x0(%r13),%rsi
mov    -0x78(%rbp),%rbx
mov    (%rbx),%edx
lea    0xabb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x60(%rbp),%edx
lea    0xad2(%rip),%rdi
lea    0xa12(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <shmdt@plt>
test   %rax,%rax
jne    15a2 <main+0x392>
mov    (%r12),%esi
xor    %ebx,%ebx
mov    -0x30(%rbp),%edi
xor    %edx,%edx
call   10a0 <shmctl@plt>
mov    %r14,%r15
cmp    $0xffffffff,%eax
je     15a2 <main+0x392>
mov    0x0(%r13),%rsi
lea    0xab8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    15ba <main+0x3aa>
mov    %r14,%r15
jmp    15a2 <main+0x392>
mov    0x293d(%rip),%rax
mov    (%rax),%edi
lea    0x9b6(%rip),%rsi
lea    0x9a8(%rip),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: %s [number]\0A\00"
@.str.1 = [2 x i8] c".\00"
@IPC_CREAT = global i32 0
@stderr = global i32 0
@.str.2 = [22 x i8] c"Error: shmget failed.\00"
@.str.3 = [18 x i8] c"%s: shmat error.\0A\00"
@.str.4 = [23 x i8] c"Error: fork() failed.\0A\00"
@PATH_MAX = global i32 0
@.str.5 = [7 x i8] c"./Beta\00"
@.str.6 = [29 x i8] c"Error: %s can not be found.\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [31 x i8] c"%s: forked process with ID %d\0A\00"
@.str.9 = [36 x i8] c"%s: passed shm ID %d to process %d\0A\00"
@.str.10 = [39 x i8] c"%s: waiting on child process ID %d...\0A\00"
@.str.11 = [40 x i8] c"%s: result %d read from shared memort: \00"
@.str.12 = [17 x i8] c"%s returned %d.\0A\00"
@.str.13 = [13 x i8] c"shmdt error\0A\00"
@IPC_RMID = global i32 0
@.str.14 = [14 x i8] c"shmctl error\0A\00"
@.str.15 = [14 x i8] c"%s: exiting.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [2 x i32]
%8 = alloca [2 x i32*]
%9 = alloca [2 x i32]
%10 = alloca i32
%11 = alloca [2 x i32]
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca [21 x i8]
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %26
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 -1, i32* %3
br label %220
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %6
store i32 4, i32* %10
%30 = load i8*, i8** %6
%31 = call i32 @atoi(i8* %30)
%32 = call i32 @srand(i32 %31)
store i32 0, i32* %12
br label %33
33: ; preds = %146, %26
%34 = load i32, i32* %12
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %149
36: ; preds = %33
%37 = load i32, i32* %12
%38 = add nsw i32 97, %37
%39 = trunc i32 %38 to i8
%40 = call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8 signext %39)
%41 = load i32, i32* %12
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 %42
store i32 %40, i32* %43
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %10
%49 = load i32, i32* @IPC_CREAT
%50 = or i32 420, %49
%51 = call i32 @shmget(i32 %47, i32 %48, i32 %50)
%52 = load i32, i32* %12
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %53
store i32 %51, i32* %54
%55 = icmp eq i32 %51, -1
br i1 %55, label %56, label %59
56: ; preds = %36
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %220
59: ; preds = %36
%60 = load i32, i32* %12
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32* @shmat(i32 %63, i32* null, i32 0)
%65 = load i32, i32* %12
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %66
store i32* %64, i32** %67
%68 = icmp eq i32* %64, null
br i1 %68, label %69, label %75
69: ; preds = %59
%70 = load i32, i32* @stderr
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 0
%73 = load i8*, i8** %72
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %73)
store i32 1, i32* %3
br label %220
75: ; preds = %59
%76 = call i32 (...) @rand()
%77 = srem i32 %76, 100000
%78 = load i32, i32* %12
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %79
%81 = load i32*, i32** %80
%82 = getelementptr inbounds i32, i32* %81, i64 0
store i32 %77, i32* %82
%83 = call i32 (...) @fork()
%84 = load i32, i32* %12
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %85
store i32 %83, i32* %86
%87 = icmp eq i32 %83, -1
br i1 %87, label %88, label %91
88: ; preds = %75
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %220
91: ; preds = %75
%92 = load i32, i32* %12
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %124
97: ; preds = %91
%98 = load i32, i32* @PATH_MAX
%99 = add nsw i32 %98, 1
%100 = zext i32 %99 to i64
%101 = call i8* @llvm.stacksave()
store i8* %101, i8** %13
%102 = alloca i8, i64 %100
store i64 %100, i64* %14
%103 = call i8* @realpath(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %102)
store i8* %103, i8** %15
%104 = load i8*, i8** %15
%105 = icmp eq i8* %104, null
br i1 %105, label %106, label %110
106: ; preds = %97
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %97
%111 = getelementptr inbounds [21 x i8], [21 x i8]* %16, i64 0, i64 0
%112 = load i32, i32* %12
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = call i32 @sprintf(i8* %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %115)
%117 = load i8*, i8** %15
%118 = getelementptr inbounds [21 x i8], [21 x i8]* %16, i64 0, i64 0
%119 = load i8*, i8** %6
%120 = call i32 @execl(i8* %117, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %118, i8* %119, i32* null)
%121 = load i8*, i8** %15
%122 = call i32 @free(i8* %121)
%123 = load i8*, i8** %13
br label %145
124: ; preds = %91
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 0
%127 = load i8*, i8** %126
%128 = load i32, i32* %12
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %129
%131 = load i32, i32* %130
%132 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %127, i32 %131)
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 0
%135 = load i8*, i8** %134
%136 = load i32, i32* %12
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %137
%139 = load i32, i32* %138
%140 = load i32, i32* %12
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %141
%143 = load i32, i32* %142
%144 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %135, i32 %139, i32 %143)
br label %145
145: ; preds = %124, %110
br label %146
146: ; preds = %145
%147 = load i32, i32* %12
%148 = add nsw i32 %147, 1
store i32 %148, i32* %12
br label %33
149: ; preds = %33
store i32 0, i32* %17
br label %150
150: ; preds = %212, %149
%151 = load i32, i32* %17
%152 = icmp slt i32 %151, 2
br i1 %152, label %153, label %215
153: ; preds = %150
store i32 0, i32* %18
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 0
%156 = load i8*, i8** %155
%157 = load i32, i32* %17
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %158
%160 = load i32, i32* %159
%161 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i8* %156, i32 %160)
%162 = load i32, i32* %17
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 %163
%165 = load i32, i32* %164
%166 = call i32 @waitpid(i32 %165, i32* %18, i32 0)
%167 = load i8**, i8*** %5
%168 = getelementptr inbounds i8*, i8** %167, i64 0
%169 = load i8*, i8** %168
%170 = load i32, i32* %17
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %171
%173 = load i32*, i32** %172
%174 = getelementptr inbounds i32, i32* %173, i64 0
%175 = load i32, i32* %174
%176 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i8* %169, i32 %175)
%177 = load i32, i32* %17
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %178
%180 = load i32*, i32** %179
%181 = getelementptr inbounds i32, i32* %180, i64 0
%182 = load i32, i32* %181
%183 = icmp ne i32 %182, 0
br i1 %183, label %184, label %187
184: ; preds = %153
%185 = load i32, i32* %18
%186 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %185)
br label %190
187: ; preds = %153
%188 = load i32, i32* %18
%189 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %188)
br label %190
190: ; preds = %187, %184
%191 = load i32, i32* %17
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %192
%194 = load i32*, i32** %193
%195 = call i64 @shmdt(i32* %194)
%196 = icmp ne i64 %195, 0
br i1 %196, label %197, label %200
197: ; preds = %190
%198 = load i32, i32* @stderr
%199 = call i32 (i32, i8*, ...) @fprintf(i32 %198, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %220
200: ; preds = %190
%201 = load i32, i32* %17
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %202
%204 = load i32, i32* %203
%205 = load i32, i32* @IPC_RMID
%206 = call i32 @shmctl(i32 %204, i32 %205, i32* null)
%207 = icmp eq i32 %206, -1
br i1 %207, label %208, label %211
208: ; preds = %200
%209 = load i32, i32* @stderr
%210 = call i32 (i32, i8*, ...) @fprintf(i32 %209, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
store i32 1, i32* %3
br label %220
211: ; preds = %200
br label %212
212: ; preds = %211
%213 = load i32, i32* %17
%214 = add nsw i32 %213, 1
store i32 %214, i32* %17
br label %150
215: ; preds = %150
%216 = load i8**, i8*** %5
%217 = getelementptr inbounds i8*, i8** %216, i64 0
%218 = load i8*, i8** %217
%219 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %218)
store i32 0, i32* %3
br label %220
220: ; preds = %215, %208, %197, %88, %69, %56, %21
%221 = load i32, i32* %3
ret i32 %221
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: %s [number]\0A\00"
@.str.1 = [2 x i8] c".\00"
@IPC_CREAT = global i32 0
@stderr = global i32 0
@.str.2 = [22 x i8] c"Error: shmget failed.\00"
@.str.3 = [18 x i8] c"%s: shmat error.\0A\00"
@.str.4 = [23 x i8] c"Error: fork() failed.\0A\00"
@PATH_MAX = global i32 0
@.str.5 = [7 x i8] c"./Beta\00"
@.str.6 = [29 x i8] c"Error: %s can not be found.\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [31 x i8] c"%s: forked process with ID %d\0A\00"
@.str.9 = [36 x i8] c"%s: passed shm ID %d to process %d\0A\00"
@.str.10 = [39 x i8] c"%s: waiting on child process ID %d...\0A\00"
@.str.11 = [40 x i8] c"%s: result %d read from shared memort: \00"
@.str.12 = [17 x i8] c"%s returned %d.\0A\00"
@.str.13 = [13 x i8] c"shmdt error\0A\00"
@IPC_RMID = global i32 0
@.str.14 = [14 x i8] c"shmctl error\0A\00"
@.str.15 = [14 x i8] c"%s: exiting.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [21 x i8]
%4 = alloca i32
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %126
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @srand(i32 %12)
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%15 = call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8 signext 97)
%16 = load i32, i32* @IPC_CREAT
%17 = or i32 %16, 420
%18 = call i32 @shmget(i32 %15, i32 4, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %58, %9
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %126
23: ; preds = %9
%24 = call i32* @shmat(i32 %18, i32* null, i32 0)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %30
26: ; preds = %64, %23
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %1
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %28)
br label %126
30: ; preds = %23
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 100000
store i32 %32, i32* %24
%33 = call i32 (...) @fork()
switch i32 %33, label %53 [
i32 -1, label %34
i32 0, label %37
]
34: ; preds = %67, %30
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %126
37: ; preds = %30
%38 = load i32, i32* @PATH_MAX
%39 = add nsw i32 %38, 1
%40 = zext i32 %39 to i64
%41 = call i8* @llvm.stacksave()
%42 = alloca i8, i64 %40
%43 = call i8* @realpath(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %42)
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %49
45: ; preds = %71, %37
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %37
%50 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%51 = call i32 @execl(i8* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %14, i8* %11, i32* null)
%52 = call i32 @free(i8* %43)
br label %58
53: ; preds = %30
%54 = load i8*, i8** %1
%55 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %54, i32 %33)
%56 = load i8*, i8** %1
%57 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %56, i32 %18, i32 %33)
br label %58
58: ; preds = %49, %53
%59 = call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8 signext 98)
%60 = load i32, i32* @IPC_CREAT
%61 = or i32 %60, 420
%62 = call i32 @shmget(i32 %59, i32 4, i32 %61)
%63 = icmp eq i32 %62, -1
br i1 %63, label %20, label %64
64: ; preds = %58
%65 = call i32* @shmat(i32 %62, i32* null, i32 0)
%66 = icmp eq i32* %65, null
br i1 %66, label %26, label %67
67: ; preds = %64
%68 = call i32 (...) @rand()
%69 = srem i32 %68, 100000
store i32 %69, i32* %65
%70 = call i32 (...) @fork()
switch i32 %70, label %83 [
i32 -1, label %34
i32 0, label %71
]
71: ; preds = %67
%72 = load i32, i32* @PATH_MAX
%73 = add nsw i32 %72, 1
%74 = zext i32 %73 to i64
%75 = call i8* @llvm.stacksave()
%76 = alloca i8, i64 %74
%77 = call i8* @realpath(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %76)
%78 = icmp eq i8* %77, null
br i1 %78, label %45, label %79
79: ; preds = %71
%80 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %62)
%81 = call i32 @execl(i8* %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %14, i8* %11, i32* null)
%82 = call i32 @free(i8* %77)
br label %88
83: ; preds = %67
%84 = load i8*, i8** %1
%85 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %84, i32 %70)
%86 = load i8*, i8** %1
%87 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %86, i32 %62, i32 %70)
br label %88
88: ; preds = %83, %79
%89 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%90 = load i8*, i8** %1
%91 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i8* %90, i32 %33)
%92 = call i32 @waitpid(i32 %33, i32* %4, i32 0)
%93 = load i8*, i8** %1
%94 = load i32, i32* %24
%95 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i8* %93, i32 %94)
%96 = load i32, i32* %4
%97 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %96)
%98 = call i64 @shmdt(i32* %24)
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %88
%101 = load i32, i32* @IPC_RMID
%102 = call i32 @shmctl(i32 %18, i32 %101, i32* null)
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %108
104: ; preds = %100, %119, %88, %108
%105 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), %108 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), %88 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), %119 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), %100 ]
%106 = load i32, i32* @stderr
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* %105)
br label %126
108: ; preds = %100
store i32 0, i32* %4
%109 = load i8*, i8** %1
%110 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i8* %109, i32 %70)
%111 = call i32 @waitpid(i32 %70, i32* %4, i32 0)
%112 = load i8*, i8** %1
%113 = load i32, i32* %65
%114 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i8* %112, i32 %113)
%115 = load i32, i32* %4
%116 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %115)
%117 = call i64 @shmdt(i32* %65)
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %104
119: ; preds = %108
%120 = load i32, i32* @IPC_RMID
%121 = call i32 @shmctl(i32 %62, i32 %120, i32* null)
%122 = icmp eq i32 %121, -1
br i1 %122, label %104, label %123
123: ; preds = %119
%124 = load i8*, i8** %1
%125 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %124)
br label %126
126: ; preds = %123, %104, %34, %26, %20, %6
%127 = phi i32 [ -1, %6 ], [ 0, %123 ], [ 1, %104 ], [ 1, %34 ], [ 1, %26 ], [ 1, %20 ]
ret i32 %127
}