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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ *SEM_FAILED;
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getpid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sem_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ *sem_open(char *, int, int, int);
int /*<<< orphan*/ sem_post(int /*<<< orphan*/ *);
int /*<<< orphan*/ sem_unlink(char *);
int /*<<< orphan*/ sem_wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ waitpid(scalar_t__, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i, j;
  sem_t *sem;
  pid_t pid[4];
  if (argc != 2) {
    fprintf(stderr, "usage: %s semaphore\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  for (i = 0; i < 4; i++) {
    pid[i] = fork();
    if (pid[i] == 0) {
      sem = sem_open(argv[1], O_RDWR | O_CREAT, 0666, 1);
      if (sem == SEM_FAILED) {
        perror(argv[1]);
        exit(EXIT_FAILURE);
      }
      for (j = 0; j < 3; j++) {
        fprintf(stderr, "[%u] wait for semaphore\n", getpid());
        sem_wait(sem);
        fprintf(stderr, "     >> [%d] hold the semaphore\n", getpid());
        sleep(2);
        fprintf(stderr, "     << [%d] release the semaphore\n", getpid());
        sem_post(sem);
        sleep(5);
      }
      sem_close(sem);
      exit(EXIT_SUCCESS);
    }
  }
  for (i = 0; i < 4; i++)
    waitpid(pid[i], NULL, 0);
  sem_unlink(argv[1]);
  return EXIT_SUCCESS;
}


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     120c <main+0x4c>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    137d <main+0x1bd>
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
movslq -0x14(%rbp),%rax
cmpq   $0x0,-0x40(%rbp,%rax,8)
jne    136a <main+0x1aa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
mov    0x2da0(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x1,%ecx
call   1060 <sem_open@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2d60(%rip),%rcx
cmp    (%rcx),%rax
jne    129c <main+0xdc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <perror@plt>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1353 <main+0x193>
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x4c(%rbp),%edi
mov    %eax,%edx
lea    0xd49(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <sem_wait@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x48(%rbp),%edi
mov    %eax,%edx
lea    0xd33(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    0x2cb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x44(%rbp),%edi
mov    %eax,%edx
lea    0xd24(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <sem_post@plt>
mov    $0x5,%edi
call   10c0 <sleep@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a3 <main+0xe3>
mov    -0x20(%rbp),%rdi
call   1090 <sem_close@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    136f <main+0x1af>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1213 <main+0x53>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    13b0 <main+0x1f0>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1384 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <sem_unlink@plt>
mov    0x2bf4(%rip),%rax
mov    (%rax),%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
mov    %rsi,%r14
cmp    $0x2,%edi
jne    1420 <main+0x260>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
je     1268 <main+0xa8>
mov    %rax,%r15
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
je     1268 <main+0xa8>
mov    %rax,%r12
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
je     1268 <main+0xa8>
mov    %rax,%r13
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
je     1268 <main+0xa8>
mov    %rax,%rbx
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    %r12,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    %r13,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <waitpid@plt>
mov    0x8(%r14),%rdi
call   10d0 <sem_unlink@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%r14),%rdi
mov    0x2d6d(%rip),%rax
mov    0x2d7e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x1,%ecx
call   1060 <sem_open@plt>
mov    %rax,%r13
mov    0x2d41(%rip),%rax
cmp    (%rax),%r13
jne    12aa <main+0xea>
mov    0x8(%r14),%rdi
call   10a0 <perror@plt>
jmp    143a <main+0x27a>
mov    0x2d17(%rip),%rbp
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd53(%rip),%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1030 <sem_wait@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd45(%rip),%r15
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd3d(%rip),%r12
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1050 <sem_post@plt>
mov    $0x5,%edi
call   10c0 <sleep@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1030 <sem_wait@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1050 <sem_post@plt>
mov    $0x5,%edi
call   10c0 <sleep@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1030 <sem_wait@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    0x0(%rbp),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
call   1050 <sem_post@plt>
mov    $0x5,%edi
call   10c0 <sleep@plt>
mov    %r13,%rdi
call   1090 <sem_close@plt>
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2ba1(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xbcd(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s semaphore\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@SEM_FAILED = global i32* null
@.str.1 = [25 x i8] c"[%u] wait for semaphore\0A\00"
@.str.2 = [33 x i8] c" >> [%d] hold the semaphore\0A\00"
@.str.3 = [36 x i8] c" << [%d] release the semaphore\0A\00"
@EXIT_SUCCESS = 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 [4 x i64]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
store i32 0, i32* %6
br label %21
21: ; preds = %81, %20
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 4
br i1 %23, label %24, label %84
24: ; preds = %21
%25 = call i64 (...) @fork()
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i64], [4 x i64]* %9, i64 0, i64 %27
store i64 %25, i64* %28
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4 x i64], [4 x i64]* %9, i64 0, i64 %30
%32 = load i64, i64* %31
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %80
34: ; preds = %24
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i32, i32* @O_RDWR
%39 = load i32, i32* @O_CREAT
%40 = or i32 %38, %39
%41 = call i32* @sem_open(i8* %37, i32 %40, i32 438, i32 1)
store i32* %41, i32** %8
%42 = load i32*, i32** %8
%43 = load i32*, i32** @SEM_FAILED
%44 = icmp eq i32* %42, %43
br i1 %44, label %45, label %52
45: ; preds = %34
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 @perror(i8* %48)
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %34
store i32 0, i32* %7
br label %53
53: ; preds = %72, %52
%54 = load i32, i32* %7
%55 = icmp slt i32 %54, 3
br i1 %55, label %56, label %75
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = call i32 (...) @getpid()
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load i32*, i32** %8
%61 = call i32 @sem_wait(i32* %60)
%62 = load i32, i32* @stderr
%63 = call i32 (...) @getpid()
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = call i32 @sleep(i32 2)
%66 = load i32, i32* @stderr
%67 = call i32 (...) @getpid()
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%69 = load i32*, i32** %8
%70 = call i32 @sem_post(i32* %69)
%71 = call i32 @sleep(i32 5)
br label %72
72: ; preds = %56
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %53
75: ; preds = %53
%76 = load i32*, i32** %8
%77 = call i32 @sem_close(i32* %76)
%78 = load i32, i32* @EXIT_SUCCESS
%79 = call i32 @exit(i32 %78)
unreachable
80: ; preds = %24
br label %81
81: ; preds = %80
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %21
84: ; preds = %21
store i32 0, i32* %6
br label %85
85: ; preds = %94, %84
%86 = load i32, i32* %6
%87 = icmp slt i32 %86, 4
br i1 %87, label %88, label %97
88: ; preds = %85
%89 = load i32, i32* %6
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [4 x i64], [4 x i64]* %9, i64 0, i64 %90
%92 = load i64, i64* %91
%93 = call i32 @waitpid(i64 %92, i32* null, i32 0)
br label %94
94: ; preds = %88
%95 = load i32, i32* %6
%96 = add nsw i32 %95, 1
store i32 %96, i32* %6
br label %85
97: ; preds = %85
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 1
%100 = load i8*, i8** %99
%101 = call i32 @sem_unlink(i8* %100)
%102 = load i32, i32* @EXIT_SUCCESS
ret i32 %102
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s semaphore\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@SEM_FAILED = global i32* null
@.str.1 = [25 x i8] c"[%u] wait for semaphore\0A\00"
@.str.2 = [33 x i8] c" >> [%d] hold the semaphore\0A\00"
@.str.3 = [36 x i8] c" << [%d] release the semaphore\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i64 (...) @fork()
%6 = icmp eq i64 %5, 0
br i1 %6, label %31, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %4
%14 = tail call i64 (...) @fork()
%15 = icmp eq i64 %14, 0
br i1 %15, label %31, label %16
16: ; preds = %13
%17 = tail call i64 (...) @fork()
%18 = icmp eq i64 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %16
%20 = tail call i64 (...) @fork()
%21 = icmp eq i64 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = tail call i32 @waitpid(i64 %5, i32* null, i32 0)
%24 = tail call i32 @waitpid(i64 %14, i32* null, i32 0)
%25 = tail call i32 @waitpid(i64 %17, i32* null, i32 0)
%26 = tail call i32 @waitpid(i64 %20, i32* null, i32 0)
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = tail call i32 @sem_unlink(i8* %28)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
31: ; preds = %19, %16, %13, %4
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = load i8*, i8** %32
%34 = load i32, i32* @O_RDWR
%35 = load i32, i32* @O_CREAT
%36 = or i32 %35, %34
%37 = tail call i32* @sem_open(i8* %33, i32 %36, i32 438, i32 1)
%38 = load i32*, i32** @SEM_FAILED
%39 = icmp eq i32* %37, %38
br i1 %39, label %83, label %40
40: ; preds = %31
%41 = load i32, i32* @stderr
%42 = tail call i32 (...) @getpid()
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = tail call i32 @sem_wait(i32* %37)
%45 = load i32, i32* @stderr
%46 = tail call i32 (...) @getpid()
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = tail call i32 @sleep(i32 2)
%49 = load i32, i32* @stderr
%50 = tail call i32 (...) @getpid()
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = tail call i32 @sem_post(i32* %37)
%53 = tail call i32 @sleep(i32 5)
%54 = load i32, i32* @stderr
%55 = tail call i32 (...) @getpid()
%56 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = tail call i32 @sem_wait(i32* %37)
%58 = load i32, i32* @stderr
%59 = tail call i32 (...) @getpid()
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = tail call i32 @sleep(i32 2)
%62 = load i32, i32* @stderr
%63 = tail call i32 (...) @getpid()
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = tail call i32 @sem_post(i32* %37)
%66 = tail call i32 @sleep(i32 5)
%67 = load i32, i32* @stderr
%68 = tail call i32 (...) @getpid()
%69 = tail call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %68)
%70 = tail call i32 @sem_wait(i32* %37)
%71 = load i32, i32* @stderr
%72 = tail call i32 (...) @getpid()
%73 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %72)
%74 = tail call i32 @sleep(i32 2)
%75 = load i32, i32* @stderr
%76 = tail call i32 (...) @getpid()
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = tail call i32 @sem_post(i32* %37)
%79 = tail call i32 @sleep(i32 5)
%80 = tail call i32 @sem_close(i32* %37)
%81 = load i32, i32* @EXIT_SUCCESS
%82 = tail call i32 @exit(i32 %81)
unreachable
83: ; preds = %31
%84 = load i8*, i8** %32
%85 = tail call i32 @perror(i8* %84)
%86 = load i32, i32* @EXIT_FAILURE
%87 = tail call i32 @exit(i32 %86)
unreachable
}