#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 /*<<< orphan*/ sem_t;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
          int /*<<< orphan*/);
int open(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ sem_init(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ sem_post(int /*<<< orphan*/ *);
int /*<<< orphan*/ sem_wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, int *, int);
int main(int argc, char **argv) {
  int fd, i, count = 0, nloop = 10, zero = 0, *ptr;
  sem_t mutex;
  fd = open("log.txt", O_RDWR | O_CREAT, S_IRWXU);
  write(fd, &zero, sizeof(int));
  ptr = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  printf("%d\n", *ptr);
  close(fd);
  if (sem_init(&mutex, 1, 1) < 0) {
    perror("semaphore initilization");
    exit(0);
  }
  if (fork() == 0) {
    for (i = 0; i < nloop; i++) {
      sem_wait(&mutex);
      printf("child: %d\n", ptr++);
      sem_post(&mutex);
    }
    exit(0);
  }
  for (i = 0; i < nloop; i++) {
    sem_wait(&mutex);
    printf("parent: %d\n", ptr++);
    sem_post(&mutex);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
mov    0x2e0d(%rip),%rax
or     (%rax),%esi
mov    0x2ddc(%rip),%rax
mov    (%rax),%edx
lea    0xe03(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edx
mov    0x2d92(%rip),%rax
or     (%rax),%edx
mov    0x2db1(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x4,%esi
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
lea    0xdd0(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    -0x34(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1090 <sem_init@plt>
cmp    $0x0,%rax
jge    1291 <main+0xe1>
lea    0xd83(%rip),%rdi
call   10b0 <perror@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    $0x0,%al
call   10d0 <fork@plt>
cmp    $0x0,%rax
jne    12f9 <main+0x149>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12f2 <main+0x142>
lea    -0x34(%rbp),%rdi
call   1030 <sem_wait@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x30(%rbp)
mov    %eax,%esi
lea    0xd4a(%rip),%rdi
call   1060 <printf@plt>
lea    -0x34(%rbp),%rdi
call   1080 <sem_post@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a9 <main+0xf9>
xor    %edi,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1349 <main+0x199>
lea    -0x34(%rbp),%rdi
call   1030 <sem_wait@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x30(%rbp)
mov    %eax,%esi
lea    0xcfe(%rip),%rdi
call   1060 <printf@plt>
lea    -0x34(%rbp),%rdi
call   1080 <sem_post@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1300 <main+0x150>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2dfe(%rip),%rax
mov    0x2e27(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2df4(%rip),%rax
mov    (%rax),%edx
lea    0xe1b(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
lea    0x4(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <write@plt>
mov    0x2dec(%rip),%rax
mov    0x2dad(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2dca(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    $0x4,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%r12
mov    (%rax),%esi
lea    0xdf1(%rip),%rdi
call   1060 <printf@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1090 <sem_init@plt>
test   %rax,%rax
jns    126c <main+0xbc>
lea    0xda8(%rip),%rdi
call   10b0 <perror@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
xor    %eax,%eax
call   10d0 <fork@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
call   1030 <sem_wait@plt>
mov    %r12,%r13
add    $0x4,%r13
test   %rbx,%rbx
jne    1293 <main+0xe3>
lea    0xd8f(%rip),%r14
jmp    129a <main+0xea>
lea    0xd91(%rip),%r14
mov    %r14,%rdi
mov    %r12d,%esi
call   1060 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x8(%r12),%ebx
mov    %r14,%rdi
mov    %r13d,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0xc(%r12),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x10(%r12),%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x14(%r12),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x18(%r12),%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x1c(%r12),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x20(%r12),%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
lea    0x24(%r12),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
mov    %r15,%rdi
call   1030 <sem_wait@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <sem_post@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"log.txt\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"semaphore initilization\00"
@.str.3 = [11 x i8] c"child: %d\0A\00"
@.str.4 = [12 x i8] c"parent: %d\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 i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 10, i32* %9
store i32 0, i32* %10
%13 = load i32, i32* @O_RDWR
%14 = load i32, i32* @O_CREAT
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IRWXU
%17 = call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @write(i32 %18, i32* %10, i32 4)
%20 = load i32, i32* @PROT_READ
%21 = load i32, i32* @PROT_WRITE
%22 = or i32 %20, %21
%23 = load i32, i32* @MAP_SHARED
%24 = load i32, i32* %6
%25 = call i32* @mmap(i32* null, i32 4, i32 %22, i32 %23, i32 %24, i32 0)
store i32* %25, i32** %11
%26 = load i32*, i32** %11
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %6
%30 = call i32 @close(i32 %29)
%31 = call i64 @sem_init(i32* %12, i32 1, i32 1)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %2
%34 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @exit(i32 0)
unreachable
36: ; preds = %2
%37 = call i64 (...) @fork()
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %56
39: ; preds = %36
store i32 0, i32* %7
br label %40
40: ; preds = %51, %39
%41 = load i32, i32* %7
%42 = load i32, i32* %9
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = call i32 @sem_wait(i32* %12)
%46 = load i32*, i32** %11
%47 = getelementptr inbounds i32, i32* %46, i32 1
store i32* %47, i32** %11
%48 = ptrtoint i32* %46 to i32
%49 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = call i32 @sem_post(i32* %12)
br label %51
51: ; preds = %44
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %40
54: ; preds = %40
%55 = call i32 @exit(i32 0)
unreachable
56: ; preds = %36
store i32 0, i32* %7
br label %57
57: ; preds = %68, %56
%58 = load i32, i32* %7
%59 = load i32, i32* %9
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %71
61: ; preds = %57
%62 = call i32 @sem_wait(i32* %12)
%63 = load i32*, i32** %11
%64 = getelementptr inbounds i32, i32* %63, i32 1
store i32* %64, i32** %11
%65 = ptrtoint i32* %63 to i32
%66 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %65)
%67 = call i32 @sem_post(i32* %12)
br label %68
68: ; preds = %61
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %57
71: ; preds = %57
%72 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"log.txt\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"semaphore initilization\00"
@.str.3 = [11 x i8] c"child: %d\0A\00"
@.str.4 = [12 x i8] c"parent: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
%7 = load i32, i32* @O_RDWR
%8 = load i32, i32* @O_CREAT
%9 = or i32 %8, %7
%10 = load i32, i32* @S_IRWXU
%11 = tail call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = call i32 @write(i32 %11, i32* %3, i32 4)
%13 = load i32, i32* @PROT_READ
%14 = load i32, i32* @PROT_WRITE
%15 = or i32 %14, %13
%16 = load i32, i32* @MAP_SHARED
%17 = tail call i32* @mmap(i32* null, i32 4, i32 %15, i32 %16, i32 %11, i32 0)
%18 = load i32, i32* %17
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = tail call i32 @close(i32 %11)
%21 = call i64 @sem_init(i32* %4, i32 1, i32 1)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %2
%24 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %2
%27 = call i64 (...) @fork()
%28 = icmp eq i64 %27, 0
%29 = call i32 @sem_wait(i32* %4)
%30 = getelementptr inbounds i32, i32* %17, i64 1
%31 = ptrtoint i32* %17 to i64
%32 = trunc i64 %31 to i32
br i1 %28, label %90, label %33
33: ; preds = %26
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%35 = call i32 @sem_post(i32* %4)
%36 = call i32 @sem_wait(i32* %4)
%37 = getelementptr inbounds i32, i32* %17, i64 2
%38 = ptrtoint i32* %30 to i64
%39 = trunc i64 %38 to i32
%40 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = call i32 @sem_post(i32* %4)
%42 = call i32 @sem_wait(i32* %4)
%43 = getelementptr inbounds i32, i32* %17, i64 3
%44 = ptrtoint i32* %37 to i64
%45 = trunc i64 %44 to i32
%46 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = call i32 @sem_post(i32* %4)
%48 = call i32 @sem_wait(i32* %4)
%49 = getelementptr inbounds i32, i32* %17, i64 4
%50 = ptrtoint i32* %43 to i64
%51 = trunc i64 %50 to i32
%52 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %51)
%53 = call i32 @sem_post(i32* %4)
%54 = call i32 @sem_wait(i32* %4)
%55 = getelementptr inbounds i32, i32* %17, i64 5
%56 = ptrtoint i32* %49 to i64
%57 = trunc i64 %56 to i32
%58 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %57)
%59 = call i32 @sem_post(i32* %4)
%60 = call i32 @sem_wait(i32* %4)
%61 = getelementptr inbounds i32, i32* %17, i64 6
%62 = ptrtoint i32* %55 to i64
%63 = trunc i64 %62 to i32
%64 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %63)
%65 = call i32 @sem_post(i32* %4)
%66 = call i32 @sem_wait(i32* %4)
%67 = getelementptr inbounds i32, i32* %17, i64 7
%68 = ptrtoint i32* %61 to i64
%69 = trunc i64 %68 to i32
%70 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%71 = call i32 @sem_post(i32* %4)
%72 = call i32 @sem_wait(i32* %4)
%73 = getelementptr inbounds i32, i32* %17, i64 8
%74 = ptrtoint i32* %67 to i64
%75 = trunc i64 %74 to i32
%76 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %75)
%77 = call i32 @sem_post(i32* %4)
%78 = call i32 @sem_wait(i32* %4)
%79 = getelementptr inbounds i32, i32* %17, i64 9
%80 = ptrtoint i32* %73 to i64
%81 = trunc i64 %80 to i32
%82 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %81)
%83 = call i32 @sem_post(i32* %4)
%84 = call i32 @sem_wait(i32* %4)
%85 = ptrtoint i32* %79 to i64
%86 = trunc i64 %85 to i32
%87 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %86)
%88 = call i32 @sem_post(i32* %4)
%89 = call i32 @exit(i32 0)
unreachable
90: ; preds = %26
%91 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%92 = call i32 @sem_post(i32* %4)
%93 = call i32 @sem_wait(i32* %4)
%94 = getelementptr inbounds i32, i32* %17, i64 2
%95 = ptrtoint i32* %30 to i64
%96 = trunc i64 %95 to i32
%97 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %96)
%98 = call i32 @sem_post(i32* %4)
%99 = call i32 @sem_wait(i32* %4)
%100 = getelementptr inbounds i32, i32* %17, i64 3
%101 = ptrtoint i32* %94 to i64
%102 = trunc i64 %101 to i32
%103 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %102)
%104 = call i32 @sem_post(i32* %4)
%105 = call i32 @sem_wait(i32* %4)
%106 = getelementptr inbounds i32, i32* %17, i64 4
%107 = ptrtoint i32* %100 to i64
%108 = trunc i64 %107 to i32
%109 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %108)
%110 = call i32 @sem_post(i32* %4)
%111 = call i32 @sem_wait(i32* %4)
%112 = getelementptr inbounds i32, i32* %17, i64 5
%113 = ptrtoint i32* %106 to i64
%114 = trunc i64 %113 to i32
%115 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %114)
%116 = call i32 @sem_post(i32* %4)
%117 = call i32 @sem_wait(i32* %4)
%118 = getelementptr inbounds i32, i32* %17, i64 6
%119 = ptrtoint i32* %112 to i64
%120 = trunc i64 %119 to i32
%121 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %120)
%122 = call i32 @sem_post(i32* %4)
%123 = call i32 @sem_wait(i32* %4)
%124 = getelementptr inbounds i32, i32* %17, i64 7
%125 = ptrtoint i32* %118 to i64
%126 = trunc i64 %125 to i32
%127 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %126)
%128 = call i32 @sem_post(i32* %4)
%129 = call i32 @sem_wait(i32* %4)
%130 = getelementptr inbounds i32, i32* %17, i64 8
%131 = ptrtoint i32* %124 to i64
%132 = trunc i64 %131 to i32
%133 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %132)
%134 = call i32 @sem_post(i32* %4)
%135 = call i32 @sem_wait(i32* %4)
%136 = getelementptr inbounds i32, i32* %17, i64 9
%137 = ptrtoint i32* %130 to i64
%138 = trunc i64 %137 to i32
%139 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %138)
%140 = call i32 @sem_post(i32* %4)
%141 = call i32 @sem_wait(i32* %4)
%142 = ptrtoint i32* %136 to i64
%143 = trunc i64 %142 to i32
%144 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %143)
%145 = call i32 @sem_post(i32* %4)
%146 = call i32 @exit(i32 0)
unreachable
}