#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 */

/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int LOCK_EX;
int LOCK_NB;
int LOCK_SH;
int LOCK_UN;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ flock(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(void) {
  int i, fd, flags;
  if ((fd = open("/tmp/1", O_CREAT | O_RDWR, 0644)) == -1) {
    fprintf(stderr, "Unable to open /tmp/1: %s", strerror(errno));
    exit(1);
  }
  if ((flags = fcntl(fd, F_GETFL, 0)) < 0) {
    perror("getting file flags");
    exit(1);
  }
  if (flock(fd, LOCK_SH) < 0) {
    perror("flocking");
    exit(1);
  }
  printf("Shared lock established - sleeping for 10 seconds.\n");
  for (i = 0; i < 10; i++) {
    fprintf(stderr, ".");
    sleep(1);
  }
  fprintf(stderr, "\n");
  printf("Now trying to get an exclusive lock.\n");
  for (i = 0; i < 10; i++) {
    if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
      printf("Unable to get an exclusive lock.\n");
      if (i == 9) {
        printf("Giving up all locks.\n");
        flock(fd, LOCK_UN);
        exit(1);
      }
      sleep(1);
    } else {
      printf("Exclusive lock established.\n");
      break;
    }
  }
  for (i = 0; i < 10; i++) {
    fprintf(stderr, ".");
    sleep(1);
  }
  fprintf(stderr, "\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
mov    0x2e31(%rip),%rax
or     (%rax),%esi
lea    0xe48(%rip),%rdi
mov    $0x1a4,%edx
call   1060 <open@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1206 <main+0x76>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0xc(%rbp),%edi
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    123b <main+0xab>
lea    0xdf5(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0xc(%rbp),%edi
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
call   1080 <flock@plt>
cmp    $0x0,%rax
jge    126c <main+0xdc>
lea    0xdd7(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xdca(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    12b8 <main+0x128>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    127f <main+0xef>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    0xd9d(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1380 <main+0x1f0>
mov    -0xc(%rbp),%edi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
mov    0x2c99(%rip),%rax
or     (%rax),%esi
call   1080 <flock@plt>
cmp    $0x0,%rax
jge    135c <main+0x1cc>
lea    0xd82(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x9,-0x8(%rbp)
jne    134d <main+0x1bd>
lea    0xd8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    0x2c6c(%rip),%rax
mov    (%rax),%esi
call   1080 <flock@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
jmp    136d <main+0x1dd>
lea    0xd6e(%rip),%rdi
call   1040 <printf@plt>
jmp    1380 <main+0x1f0>
jmp    1372 <main+0x1e2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12e2 <main+0x152>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    13c0 <main+0x230>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
lea    0xcd0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1387 <main+0x1f7>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
lea    0xd1c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e59(%rip),%rax
mov    0x2e3a(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe4f(%rip),%rdi
mov    $0x1a4,%edx
call   1060 <open@plt>
cmp    $0xffffffff,%eax
jne    11f4 <main+0x64>
mov    0x2df9(%rip),%rax
mov    (%rax),%ebx
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xe29(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %eax,%ebx
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1040 <fcntl@plt>
test   %eax,%eax
jns    1215 <main+0x85>
lea    0xe0e(%rip),%rdi
jmp    1231 <main+0xa1>
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1240 <main+0xb0>
lea    0xe03(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d6d(%rip),%r15
mov    (%r15),%edi
lea    0xe54(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
lea    0xcf3(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xd1a(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c74(%rip),%r14
mov    0x2c2d(%rip),%r12
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xd2a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xcfd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xcd0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xca3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xc76(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xc49(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xc1c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xbef(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xbc6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r12),%esi
or     (%r14),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
test   %rax,%rax
jns    1541 <main+0x3b1>
lea    0xb9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xbb2(%rip),%rdi
call   1030 <puts@plt>
mov    0x2a7a(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1080 <flock@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xb4f(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edi
lea    0xb5a(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    (%r15),%edi
lea    0x9f9(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"/tmp/1\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [26 x i8] c"Unable to open /tmp/1: %s\00"
@errno = global i32 0
@F_GETFL = global i32 0
@.str.2 = [19 x i8] c"getting file flags\00"
@LOCK_SH = global i32 0
@.str.3 = [9 x i8] c"flocking\00"
@.str.4 = [52 x i8] c"Shared lock established - sleeping for 10 seconds.\0A\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [38 x i8] c"Now trying to get an exclusive lock.\0A\00"
@LOCK_EX = global i32 0
@LOCK_NB = global i32 0
@.str.8 = [34 x i8] c"Unable to get an exclusive lock.\0A\00"
@.str.9 = [22 x i8] c"Giving up all locks.\0A\00"
@LOCK_UN = global i32 0
@.str.10 = [29 x i8] c"Exclusive lock established.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @O_CREAT
%6 = load i32, i32* @O_RDWR
%7 = or i32 %5, %6
%8 = call i32 @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 420)
store i32 %8, i32* %3
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = load i32, i32* %3
%18 = load i32, i32* @F_GETFL
%19 = call i32 @fcntl(i32 %17, i32 %18, i32 0)
store i32 %19, i32* %4
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %16
%25 = load i32, i32* %3
%26 = load i32, i32* @LOCK_SH
%27 = call i64 @flock(i32 %25, i32 %26)
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %34
34: ; preds = %41, %32
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 @sleep(i32 1)
br label %41
41: ; preds = %37
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %34
44: ; preds = %34
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %2
br label %48
48: ; preds = %73, %44
%49 = load i32, i32* %2
%50 = icmp slt i32 %49, 10
br i1 %50, label %51, label %76
51: ; preds = %48
%52 = load i32, i32* %3
%53 = load i32, i32* @LOCK_EX
%54 = load i32, i32* @LOCK_NB
%55 = or i32 %53, %54
%56 = call i64 @flock(i32 %52, i32 %55)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %70
58: ; preds = %51
%59 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%60 = load i32, i32* %2
%61 = icmp eq i32 %60, 9
br i1 %61, label %62, label %68
62: ; preds = %58
%63 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%64 = load i32, i32* %3
%65 = load i32, i32* @LOCK_UN
%66 = call i64 @flock(i32 %64, i32 %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %58
%69 = call i32 @sleep(i32 1)
br label %72
70: ; preds = %51
%71 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
br label %76
72: ; preds = %68
br label %73
73: ; preds = %72
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %48
76: ; preds = %70, %48
store i32 0, i32* %2
br label %77
77: ; preds = %84, %76
%78 = load i32, i32* %2
%79 = icmp slt i32 %78, 10
br i1 %79, label %80, label %87
80: ; preds = %77
%81 = load i32, i32* @stderr
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%83 = call i32 @sleep(i32 1)
br label %84
84: ; preds = %80
%85 = load i32, i32* %2
%86 = add nsw i32 %85, 1
store i32 %86, i32* %2
br label %77
87: ; preds = %77
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%90 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"/tmp/1\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [26 x i8] c"Unable to open /tmp/1: %s\00"
@errno = global i32 0
@F_GETFL = global i32 0
@.str.2 = [19 x i8] c"getting file flags\00"
@LOCK_SH = global i32 0
@.str.3 = [9 x i8] c"flocking\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [2 x i8] c"\0A\00"
@LOCK_EX = global i32 0
@LOCK_NB = global i32 0
@LOCK_UN = global i32 0
@str = [51 x i8] c"Shared lock established - sleeping for 10 seconds.\00"
@str.11 = [37 x i8] c"Now trying to get an exclusive lock.\00"
@str.12 = [28 x i8] c"Exclusive lock established.\00"
@str.13 = [33 x i8] c"Unable to get an exclusive lock.\00"
@str.14 = [21 x i8] c"Giving up all locks.\00"
define i32 @main() {
%1 = load i32, i32* @O_CREAT
%2 = load i32, i32* @O_RDWR
%3 = or i32 %2, %1
%4 = tail call i32 @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 420)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %0
%13 = load i32, i32* @F_GETFL
%14 = tail call i32 @fcntl(i32 %4, i32 %13, i32 0)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %12
%20 = load i32, i32* @LOCK_SH
%21 = tail call i64 @flock(i32 %4, i32 %20)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %19
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%30 = tail call i32 @sleep(i32 1)
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%33 = tail call i32 @sleep(i32 1)
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = tail call i32 @sleep(i32 1)
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = tail call i32 @sleep(i32 1)
%40 = load i32, i32* @stderr
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%42 = tail call i32 @sleep(i32 1)
%43 = load i32, i32* @stderr
%44 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%45 = tail call i32 @sleep(i32 1)
%46 = load i32, i32* @stderr
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%48 = tail call i32 @sleep(i32 1)
%49 = load i32, i32* @stderr
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%51 = tail call i32 @sleep(i32 1)
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%54 = tail call i32 @sleep(i32 1)
%55 = load i32, i32* @stderr
%56 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = tail call i32 @sleep(i32 1)
%58 = load i32, i32* @stderr
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.11, i64 0, i64 0))
%61 = load i32, i32* @LOCK_EX
%62 = load i32, i32* @LOCK_NB
%63 = or i32 %62, %61
%64 = tail call i64 @flock(i32 %4, i32 %63)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %144
66: ; preds = %26
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%68 = tail call i32 @sleep(i32 1)
%69 = load i32, i32* @LOCK_EX
%70 = load i32, i32* @LOCK_NB
%71 = or i32 %70, %69
%72 = tail call i64 @flock(i32 %4, i32 %71)
%73 = icmp slt i64 %72, 0
br i1 %73, label %80, label %144
74: ; preds = %136
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%76 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.14, i64 0, i64 0))
%77 = load i32, i32* @LOCK_UN
%78 = tail call i64 @flock(i32 %4, i32 %77)
%79 = tail call i32 @exit(i32 1)
unreachable
80: ; preds = %66
%81 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%82 = tail call i32 @sleep(i32 1)
%83 = load i32, i32* @LOCK_EX
%84 = load i32, i32* @LOCK_NB
%85 = or i32 %84, %83
%86 = tail call i64 @flock(i32 %4, i32 %85)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %144
88: ; preds = %80
%89 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%90 = tail call i32 @sleep(i32 1)
%91 = load i32, i32* @LOCK_EX
%92 = load i32, i32* @LOCK_NB
%93 = or i32 %92, %91
%94 = tail call i64 @flock(i32 %4, i32 %93)
%95 = icmp slt i64 %94, 0
br i1 %95, label %96, label %144
96: ; preds = %88
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%98 = tail call i32 @sleep(i32 1)
%99 = load i32, i32* @LOCK_EX
%100 = load i32, i32* @LOCK_NB
%101 = or i32 %100, %99
%102 = tail call i64 @flock(i32 %4, i32 %101)
%103 = icmp slt i64 %102, 0
br i1 %103, label %104, label %144
104: ; preds = %96
%105 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%106 = tail call i32 @sleep(i32 1)
%107 = load i32, i32* @LOCK_EX
%108 = load i32, i32* @LOCK_NB
%109 = or i32 %108, %107
%110 = tail call i64 @flock(i32 %4, i32 %109)
%111 = icmp slt i64 %110, 0
br i1 %111, label %112, label %144
112: ; preds = %104
%113 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%114 = tail call i32 @sleep(i32 1)
%115 = load i32, i32* @LOCK_EX
%116 = load i32, i32* @LOCK_NB
%117 = or i32 %116, %115
%118 = tail call i64 @flock(i32 %4, i32 %117)
%119 = icmp slt i64 %118, 0
br i1 %119, label %120, label %144
120: ; preds = %112
%121 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%122 = tail call i32 @sleep(i32 1)
%123 = load i32, i32* @LOCK_EX
%124 = load i32, i32* @LOCK_NB
%125 = or i32 %124, %123
%126 = tail call i64 @flock(i32 %4, i32 %125)
%127 = icmp slt i64 %126, 0
br i1 %127, label %128, label %144
128: ; preds = %120
%129 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%130 = tail call i32 @sleep(i32 1)
%131 = load i32, i32* @LOCK_EX
%132 = load i32, i32* @LOCK_NB
%133 = or i32 %132, %131
%134 = tail call i64 @flock(i32 %4, i32 %133)
%135 = icmp slt i64 %134, 0
br i1 %135, label %136, label %144
136: ; preds = %128
%137 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.13, i64 0, i64 0))
%138 = tail call i32 @sleep(i32 1)
%139 = load i32, i32* @LOCK_EX
%140 = load i32, i32* @LOCK_NB
%141 = or i32 %140, %139
%142 = tail call i64 @flock(i32 %4, i32 %141)
%143 = icmp slt i64 %142, 0
br i1 %143, label %74, label %144
144: ; preds = %66, %80, %88, %96, %104, %112, %120, %128, %136, %26
%145 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0))
%146 = load i32, i32* @stderr
%147 = tail call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%148 = tail call i32 @sleep(i32 1)
%149 = load i32, i32* @stderr
%150 = tail call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%151 = tail call i32 @sleep(i32 1)
%152 = load i32, i32* @stderr
%153 = tail call i32 (i32, i8*, ...) @fprintf(i32 %152, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%154 = tail call i32 @sleep(i32 1)
%155 = load i32, i32* @stderr
%156 = tail call i32 (i32, i8*, ...) @fprintf(i32 %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%157 = tail call i32 @sleep(i32 1)
%158 = load i32, i32* @stderr
%159 = tail call i32 (i32, i8*, ...) @fprintf(i32 %158, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%160 = tail call i32 @sleep(i32 1)
%161 = load i32, i32* @stderr
%162 = tail call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%163 = tail call i32 @sleep(i32 1)
%164 = load i32, i32* @stderr
%165 = tail call i32 (i32, i8*, ...) @fprintf(i32 %164, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%166 = tail call i32 @sleep(i32 1)
%167 = load i32, i32* @stderr
%168 = tail call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%169 = tail call i32 @sleep(i32 1)
%170 = load i32, i32* @stderr
%171 = tail call i32 (i32, i8*, ...) @fprintf(i32 %170, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%172 = tail call i32 @sleep(i32 1)
%173 = load i32, i32* @stderr
%174 = tail call i32 (i32, i8*, ...) @fprintf(i32 %173, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%175 = tail call i32 @sleep(i32 1)
%176 = load i32, i32* @stderr
%177 = tail call i32 (i32, i8*, ...) @fprintf(i32 %176, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%178 = tail call i32 @exit(i32 0)
unreachable
}