#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ time_t;
struct stat {
  int st_mode;
  scalar_t__ st_dev;
  scalar_t__ st_ino;
  int st_nlink;
  scalar_t__ st_ctime;
};
struct group {
  scalar_t__ gr_gid;
};

/* Variables and functions */
scalar_t__ EACCES;
int /*<<< orphan*/ EX_CANTCREAT;
scalar_t__ EX_NOPERM;
int EX_OK;
scalar_t__ EX_USAGE;
int /*<<< orphan*/ LOG_MAIL;
int /*<<< orphan*/ LOG_PID;
int O_CREAT;
int O_EXCL;
int O_WRONLY;
int S_IFMT;
int S_IFREG;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ die(char *, scalar_t__);
scalar_t__ errno;
scalar_t__ fstat(int /*<<< orphan*/, struct stat *);
scalar_t__ getegid();
struct group *getgrnam(char *);
int /*<<< orphan*/ gethostname(char *, int);
scalar_t__ getpid();
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ link(char *, char *);
scalar_t__ lstat(char *, struct stat *);
scalar_t__ malloc(size_t);
int open(char *, int, int);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ stat(char *, struct stat *);
size_t strlen(char *);
scalar_t__ time(int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int ld;
  int tries = 5 * 60 - 1;
  size_t len;
  char *s, *lock, *hitch, tmp[1024];
  time_t t;
  struct stat sb, fsb;
  struct group *grp = getgrnam("mail");
  openlog(argv[0], LOG_PID, LOG_MAIL);
  if (!grp || (grp->gr_gid != getegid()))
    die("not setgid mail", EX_USAGE);
  if (argc != 3)
    die("invalid arguments", EX_USAGE);
  for (s = argv[1]; *s; s++)
    if (!isdigit(*s))
      die("invalid fd", EX_USAGE);
  len = strlen(argv[2]);
  lock = (char *)malloc(len + 6);
  hitch = (char *)malloc(len + 6 + 40 + 256);
  if (!lock || !hitch)
    die("malloc failure", errno);
  if (fstat(atoi(argv[1]), &fsb))
    die("fstat failure", errno);
  if ((fsb.st_mode & S_IFMT) != S_IFREG)
    die("fd not regular file", EX_USAGE);
  if (lstat(argv[2], &sb))
    die("lstat failure", errno);
  if ((sb.st_mode & S_IFMT) != S_IFREG)
    die("name not regular file", EX_USAGE);
  if ((sb.st_dev != fsb.st_dev) || (sb.st_ino != fsb.st_ino))
    die("fd and name different", EX_USAGE);
  sprintf(lock, "%s.lock", argv[2]);
  if (!lstat(lock, &sb) && ((sb.st_mode & S_IFMT) != S_IFREG))
    die("existing lock not regular file", EX_NOPERM);
  do {
    t = time(0);
    sprintf(hitch, "%s.%lu.%lu.", lock, (unsigned long)time(0),
            (unsigned long)getpid());
    len = strlen(hitch);
    gethostname(hitch + len, 256);
    if ((ld = open(hitch, O_WRONLY | O_CREAT | O_EXCL, 0775)) >= 0) {
      chmod(hitch, 0775);
      close(ld);
      link(hitch, lock);
      stat(hitch, &sb);
      unlink(hitch);
      if ((ld = (sb.st_nlink != 2) ? -1 : 0) && (!stat(lock, &sb)) &&
          (t > sb.st_ctime + 5 * 60))
        unlink(lock);
    } else if (errno == EACCES)
      tries = 0;
    if (ld < 0) {
      if (tries--)
        sleep(1);
      else {
        write(1, "-", 1);
        _exit(EX_CANTCREAT);
      }
    }
  } while (ld < 0);
  write(1, "+", 1);
  read(0, tmp, 1);
  unlink(lock);
  return EX_OK;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x12b,-0x18(%rbp)
lea    0xd64(%rip),%rdi
call   10d0 <getgrnam@plt>
mov    %rax,-0x4a0(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
mov    0x2cb6(%rip),%rax
mov    (%rax),%edx
call   1150 <openlog@plt>
cmpq   $0x0,-0x4a0(%rbp)
je     130a <main+0x8a>
mov    -0x4a0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4a8(%rbp)
mov    $0x0,%al
call   1100 <getegid@plt>
mov    %rax,%rcx
mov    -0x4a8(%rbp),%rax
cmp    %rcx,%rax
je     1320 <main+0xa0>
mov    0x2cbf(%rip),%rax
mov    (%rax),%rsi
lea    0xce5(%rip),%rdi
call   1130 <die@plt>
cmpl   $0x3,-0x8(%rbp)
je     1340 <main+0xc0>
mov    0x2c9f(%rip),%rax
mov    (%rax),%rsi
lea    0xcd5(%rip),%rdi
call   1130 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     139a <main+0x11a>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    1384 <main+0x104>
mov    0x2c5b(%rip),%rax
mov    (%rax),%rsi
lea    0xca3(%rip),%rdi
call   1130 <die@plt>
jmp    1389 <main+0x109>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    134c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x6,%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x6,%rdi
add    $0x28,%rdi
add    $0x100,%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     13ee <main+0x16e>
cmpq   $0x0,-0x38(%rbp)
jne    1404 <main+0x184>
mov    0x2bab(%rip),%rax
mov    (%rax),%rsi
lea    0xc2e(%rip),%rdi
call   1130 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1140 <atoi@plt>
mov    %eax,%edi
lea    -0x498(%rbp),%rsi
call   11a0 <fstat@plt>
cmp    $0x0,%rax
je     143f <main+0x1bf>
mov    0x2b70(%rip),%rax
mov    (%rax),%rsi
lea    0xc02(%rip),%rdi
call   1130 <die@plt>
mov    -0x498(%rbp),%eax
mov    0x2b6c(%rip),%rcx
and    (%rcx),%eax
mov    0x2b83(%rip),%rcx
cmp    (%rcx),%eax
je     1473 <main+0x1f3>
mov    0x2b6c(%rip),%rax
mov    (%rax),%rsi
lea    0xbdc(%rip),%rdi
call   1130 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x470(%rbp),%rsi
call   10b0 <lstat@plt>
cmp    $0x0,%rax
je     14a7 <main+0x227>
mov    0x2b08(%rip),%rax
mov    (%rax),%rsi
lea    0xbbc(%rip),%rdi
call   1130 <die@plt>
mov    -0x470(%rbp),%eax
mov    0x2b04(%rip),%rcx
and    (%rcx),%eax
mov    0x2b1b(%rip),%rcx
cmp    (%rcx),%eax
je     14db <main+0x25b>
mov    0x2b04(%rip),%rax
mov    (%rax),%rsi
lea    0xb96(%rip),%rdi
call   1130 <die@plt>
mov    -0x468(%rbp),%rax
cmp    -0x490(%rbp),%rax
jne    1503 <main+0x283>
mov    -0x460(%rbp),%rax
cmp    -0x488(%rbp),%rax
je     1519 <main+0x299>
mov    0x2ac6(%rip),%rax
mov    (%rax),%rsi
lea    0xb6e(%rip),%rdi
call   1130 <die@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xb6c(%rip),%rsi
mov    $0x0,%al
call   1170 <sprintf@plt>
mov    -0x30(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   10b0 <lstat@plt>
cmp    $0x0,%rax
jne    1581 <main+0x301>
mov    -0x470(%rbp),%eax
mov    0x2a5e(%rip),%rcx
and    (%rcx),%eax
mov    0x2a75(%rip),%rcx
cmp    (%rcx),%eax
je     1581 <main+0x301>
mov    0x2a6e(%rip),%rax
mov    (%rax),%rsi
lea    0xb24(%rip),%rdi
call   1130 <die@plt>
jmp    1586 <main+0x306>
xor    %edi,%edi
call   10e0 <time@plt>
mov    %rax,-0x448(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x4c0(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x4b8(%rbp)
xor    %edi,%edi
call   10e0 <time@plt>
mov    %rax,-0x4b0(%rbp)
mov    $0x0,%al
call   1070 <getpid@plt>
mov    -0x4c0(%rbp),%rdi
mov    -0x4b8(%rbp),%rdx
mov    -0x4b0(%rbp),%rcx
mov    %rax,%r8
lea    0xae1(%rip),%rsi
mov    $0x0,%al
call   1170 <sprintf@plt>
mov    -0x38(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1160 <gethostname@plt>
mov    -0x38(%rbp),%rdi
mov    0x2979(%rip),%rax
mov    (%rax),%esi
mov    0x29e0(%rip),%rax
or     (%rax),%esi
mov    0x2987(%rip),%rax
or     (%rax),%esi
mov    $0x1fd,%edx
call   1120 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     16d9 <main+0x459>
mov    -0x38(%rbp),%rdi
mov    $0x1fd,%esi
call   1110 <chmod@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1180 <link@plt>
mov    -0x38(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   10c0 <stat@plt>
mov    -0x38(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x458(%rbp),%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x2,%edx
cmovne %ecx,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     16d4 <main+0x454>
mov    -0x30(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%eax
jne    16d4 <main+0x454>
mov    -0x448(%rbp),%rax
mov    -0x450(%rbp),%rcx
add    $0x12c,%rcx
cmp    %rcx,%rax
jle    16d4 <main+0x454>
mov    -0x30(%rbp),%rdi
call   1030 <unlink@plt>
jmp    16ff <main+0x47f>
mov    0x28c0(%rip),%rax
mov    (%rax),%rax
mov    0x28de(%rip),%rcx
cmp    (%rcx),%rax
jne    16fa <main+0x47a>
movl   $0x0,-0x18(%rbp)
jmp    16ff <main+0x47f>
cmpl   $0x0,-0x14(%rbp)
jge    1752 <main+0x4d2>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     172c <main+0x4ac>
mov    $0x1,%edi
call   1190 <sleep@plt>
jmp    174d <main+0x4cd>
mov    $0x1,%edx
lea    0x993(%rip),%rsi
mov    %edx,%edi
call   1060 <write@plt>
mov    0x2832(%rip),%rax
mov    (%rax),%edi
call   1050 <_exit@plt>
jmp    1752 <main+0x4d2>
jmp    1757 <main+0x4d7>
cmpl   $0x0,-0x14(%rbp)
jl     1586 <main+0x306>
mov    $0x1,%edx
lea    0x960(%rip),%rsi
mov    %edx,%edi
call   1060 <write@plt>
lea    -0x440(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   10a0 <read@plt>
mov    -0x30(%rbp),%rdi
call   1030 <unlink@plt>
mov    0x2801(%rip),%rax
mov    (%rax),%eax
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xd6e(%rip),%rdi
call   10d0 <getgrnam@plt>
mov    %rax,%rbx
mov    (%r15),%rdi
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
mov    0x2cc8(%rip),%rax
mov    (%rax),%edx
call   1150 <openlog@plt>
test   %rbx,%rbx
je     12d3 <main+0x53>
mov    (%rbx),%rbx
xor    %eax,%eax
call   1100 <getegid@plt>
cmp    %rax,%rbx
je     12e9 <main+0x69>
mov    0x2cf6(%rip),%rax
mov    (%rax),%rsi
lea    0xd1c(%rip),%rdi
call   1130 <die@plt>
cmp    $0x3,%ebp
je     1304 <main+0x84>
mov    0x2cdb(%rip),%rax
mov    (%rax),%rsi
lea    0xd11(%rip),%rdi
call   1130 <die@plt>
mov    0x8(%r15),%rbp
mov    0x0(%rbp),%al
test   %al,%al
je     1355 <main+0xd5>
add    $0x1,%rbp
mov    0x2cb6(%rip),%r14
lea    0xd01(%rip),%rbx
jmp    133c <main+0xbc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     1355 <main+0xd5>
movsbl %al,%edi
call   1040 <isdigit@plt>
test   %eax,%eax
jne    1330 <main+0xb0>
mov    (%r14),%rsi
mov    %rbx,%rdi
call   1130 <die@plt>
jmp    1330 <main+0xb0>
mov    0x10(%r15),%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
lea    0x6(%rax),%rdi
call   10f0 <malloc@plt>
mov    %rax,%r14
add    $0x12e,%rbx
mov    %rbx,%rdi
call   10f0 <malloc@plt>
mov    %rax,%rbx
test   %r14,%r14
je     1389 <main+0x109>
test   %rbx,%rbx
jne    139f <main+0x11f>
mov    0x2c10(%rip),%rax
mov    (%rax),%rsi
lea    0xc93(%rip),%rdi
call   1130 <die@plt>
mov    0x8(%r15),%rdi
call   1140 <atoi@plt>
lea    0x28(%rsp),%rsi
mov    %eax,%edi
call   11a0 <fstat@plt>
test   %rax,%rax
je     13cf <main+0x14f>
mov    0x2be0(%rip),%rax
mov    (%rax),%rsi
lea    0xc72(%rip),%rdi
call   1130 <die@plt>
mov    0x2be2(%rip),%r12
mov    (%r12),%eax
and    0x28(%rsp),%eax
mov    0x2bf3(%rip),%rbp
cmp    0x0(%rbp),%eax
je     1400 <main+0x180>
mov    0x2bdf(%rip),%rax
mov    (%rax),%rsi
lea    0xc4f(%rip),%rdi
call   1130 <die@plt>
mov    0x10(%r15),%rdi
mov    %rsp,%rsi
call   10b0 <lstat@plt>
test   %rax,%rax
je     1427 <main+0x1a7>
mov    0x2b88(%rip),%rax
mov    (%rax),%rsi
lea    0xc3c(%rip),%rdi
call   1130 <die@plt>
mov    (%r12),%eax
and    (%rsp),%eax
cmp    0x0(%rbp),%eax
je     1449 <main+0x1c9>
mov    0x2b96(%rip),%rax
mov    (%rax),%rsi
lea    0xc28(%rip),%rdi
call   1130 <die@plt>
mov    0x8(%rsp),%rax
cmp    0x30(%rsp),%rax
jne    1461 <main+0x1e1>
mov    0x10(%rsp),%rax
cmp    0x38(%rsp),%rax
je     1477 <main+0x1f7>
mov    0x2b68(%rip),%rax
mov    (%rax),%rsi
lea    0xc10(%rip),%rdi
call   1130 <die@plt>
mov    0x10(%r15),%rdx
lea    0xc16(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1170 <sprintf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   10b0 <lstat@plt>
test   %rax,%rax
jne    14be <main+0x23e>
mov    (%r12),%eax
and    (%rsp),%eax
cmp    0x0(%rbp),%eax
je     14be <main+0x23e>
mov    0x2b31(%rip),%rax
mov    (%rax),%rsi
lea    0xbe7(%rip),%rdi
call   1130 <die@plt>
mov    $0xfffffed5,%r15d
mov    %rsp,%r12
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
call   10e0 <time@plt>
mov    %rax,%r13
xor    %edi,%edi
call   10e0 <time@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1070 <getpid@plt>
mov    %rbx,%rdi
lea    0xbca(%rip),%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1170 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <strlen@plt>
lea    (%rax,%rbx,1),%rdi
mov    $0x100,%esi
call   1160 <gethostname@plt>
mov    0x2ad6(%rip),%rax
mov    (%rax),%esi
mov    0x2a5d(%rip),%rax
or     (%rax),%esi
mov    0x2a74(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
mov    $0x1fd,%edx
call   1120 <open@plt>
test   %eax,%eax
js     15b0 <main+0x330>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x1fd,%esi
call   1110 <chmod@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1180 <link@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10c0 <stat@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
cmpl   $0x2,0x18(%rsp)
je     15de <main+0x35e>
mov    %r14,%rdi
mov    %r12,%rsi
call   10c0 <stat@plt>
test   %eax,%eax
jne    15c6 <main+0x346>
mov    0x20(%rsp),%rax
mov    $0x12c,%ecx
add    %rcx,%rax
cmp    %rax,%r13
jle    15c6 <main+0x346>
mov    %r14,%rdi
call   1030 <unlink@plt>
jmp    15c6 <main+0x346>
nopl   (%rax)
mov    0x29e9(%rip),%rax
mov    (%rax),%rax
mov    0x2a07(%rip),%rcx
cmp    (%rcx),%rax
je     1628 <main+0x3a8>
test   %r15d,%r15d
je     1628 <main+0x3a8>
mov    $0x1,%edi
call   1190 <sleep@plt>
add    $0x1,%r15d
jmp    14d0 <main+0x250>
lea    0xae8(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1060 <write@plt>
lea    0x50(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   10a0 <read@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
mov    0x2984(%rip),%rax
mov    (%rax),%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa9c(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1060 <write@plt>
mov    0x2933(%rip),%rax
mov    (%rax),%edi
call   1050 <_exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i64, i64, i32, i64 }
%struct.group = type { i64 }
@.str = [5 x i8] c"mail\00"
@LOG_PID = global i32 0
@LOG_MAIL = global i32 0
@.str.1 = [16 x i8] c"not setgid mail\00"
@EX_USAGE = global i64 0
@.str.2 = [18 x i8] c"invalid arguments\00"
@.str.3 = [11 x i8] c"invalid fd\00"
@.str.4 = [15 x i8] c"malloc failure\00"
@errno = global i64 0
@.str.5 = [14 x i8] c"fstat failure\00"
@S_IFMT = global i32 0
@S_IFREG = global i32 0
@.str.6 = [20 x i8] c"fd not regular file\00"
@.str.7 = [14 x i8] c"lstat failure\00"
@.str.8 = [22 x i8] c"name not regular file\00"
@.str.9 = [22 x i8] c"fd and name different\00"
@.str.10 = [8 x i8] c"%s.lock\00"
@.str.11 = [31 x i8] c"existing lock not regular file\00"
@EX_NOPERM = global i64 0
@.str.12 = [12 x i8] c"%s.%lu.%lu.\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@EACCES = global i64 0
@.str.13 = [2 x i8] c"-\00"
@EX_CANTCREAT = global i32 0
@.str.14 = [2 x i8] c"+\00"
@EX_OK = 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 i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [1024 x i8]
%13 = alloca i64
%14 = alloca %struct.stat
%15 = alloca %struct.stat
%16 = alloca %struct.group*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 299, i32* %7
%17 = call %struct.group* @getgrnam(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store %struct.group* %17, %struct.group** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = load i32, i32* @LOG_PID
%22 = load i32, i32* @LOG_MAIL
%23 = call i32 @openlog(i8* %20, i32 %21, i32 %22)
%24 = load %struct.group*, %struct.group** %16
%25 = icmp ne %struct.group* %24, null
br i1 %25, label %26, label %32
26: ; preds = %2
%27 = load %struct.group*, %struct.group** %16
%28 = getelementptr inbounds %struct.group, %struct.group* %27, i32 0, i32 0
%29 = load i64, i64* %28
%30 = call i64 (...) @getegid()
%31 = icmp ne i64 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %26, %2
%33 = load i64, i64* @EX_USAGE
%34 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %33)
br label %35
35: ; preds = %32, %26
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 3
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i64, i64* @EX_USAGE
%40 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %39)
br label %41
41: ; preds = %38, %35
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
store i8* %44, i8** %9
br label %45
45: ; preds = %58, %41
%46 = load i8*, i8** %9
%47 = load i8, i8* %46
%48 = icmp ne i8 %47, 0
br i1 %48, label %49, label %61
49: ; preds = %45
%50 = load i8*, i8** %9
%51 = load i8, i8* %50
%52 = call i32 @isdigit(i8 signext %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %49
%55 = load i64, i64* @EX_USAGE
%56 = call i32 @die(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %55)
br label %57
57: ; preds = %54, %49
br label %58
58: ; preds = %57
%59 = load i8*, i8** %9
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %9
br label %45
61: ; preds = %45
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 2
%64 = load i8*, i8** %63
%65 = call i64 @strlen(i8* %64)
store i64 %65, i64* %8
%66 = load i64, i64* %8
%67 = add i64 %66, 6
%68 = call i64 @malloc(i64 %67)
%69 = inttoptr i64 %68 to i8*
store i8* %69, i8** %10
%70 = load i64, i64* %8
%71 = add i64 %70, 6
%72 = add i64 %71, 40
%73 = add i64 %72, 256
%74 = call i64 @malloc(i64 %73)
%75 = inttoptr i64 %74 to i8*
store i8* %75, i8** %11
%76 = load i8*, i8** %10
%77 = icmp ne i8* %76, null
br i1 %77, label %78, label %81
78: ; preds = %61
%79 = load i8*, i8** %11
%80 = icmp ne i8* %79, null
br i1 %80, label %84, label %81
81: ; preds = %78, %61
%82 = load i64, i64* @errno
%83 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i64 %82)
br label %84
84: ; preds = %81, %78
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = call i32 @atoi(i8* %87)
%89 = call i64 @fstat(i32 %88, %struct.stat* %15)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %84
%92 = load i64, i64* @errno
%93 = call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %92)
br label %94
94: ; preds = %91, %84
%95 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%96 = load i32, i32* %95
%97 = load i32, i32* @S_IFMT
%98 = and i32 %96, %97
%99 = load i32, i32* @S_IFREG
%100 = icmp ne i32 %98, %99
br i1 %100, label %101, label %104
101: ; preds = %94
%102 = load i64, i64* @EX_USAGE
%103 = call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 %102)
br label %104
104: ; preds = %101, %94
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 2
%107 = load i8*, i8** %106
%108 = call i64 @lstat(i8* %107, %struct.stat* %14)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %104
%111 = load i64, i64* @errno
%112 = call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 %111)
br label %113
113: ; preds = %110, %104
%114 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%115 = load i32, i32* %114
%116 = load i32, i32* @S_IFMT
%117 = and i32 %115, %116
%118 = load i32, i32* @S_IFREG
%119 = icmp ne i32 %117, %118
br i1 %119, label %120, label %123
120: ; preds = %113
%121 = load i64, i64* @EX_USAGE
%122 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i64 %121)
br label %123
123: ; preds = %120, %113
%124 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 1
%125 = load i64, i64* %124
%126 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 1
%127 = load i64, i64* %126
%128 = icmp ne i64 %125, %127
br i1 %128, label %135, label %129
129: ; preds = %123
%130 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 2
%131 = load i64, i64* %130
%132 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 2
%133 = load i64, i64* %132
%134 = icmp ne i64 %131, %133
br i1 %134, label %135, label %138
135: ; preds = %129, %123
%136 = load i64, i64* @EX_USAGE
%137 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i64 %136)
br label %138
138: ; preds = %135, %129
%139 = load i8*, i8** %10
%140 = load i8**, i8*** %5
%141 = getelementptr inbounds i8*, i8** %140, i64 2
%142 = load i8*, i8** %141
%143 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %139, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %142)
%144 = load i8*, i8** %10
%145 = call i64 @lstat(i8* %144, %struct.stat* %14)
%146 = icmp ne i64 %145, 0
br i1 %146, label %157, label %147
147: ; preds = %138
%148 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%149 = load i32, i32* %148
%150 = load i32, i32* @S_IFMT
%151 = and i32 %149, %150
%152 = load i32, i32* @S_IFREG
%153 = icmp ne i32 %151, %152
br i1 %153, label %154, label %157
154: ; preds = %147
%155 = load i64, i64* @EX_NOPERM
%156 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i64 %155)
br label %157
157: ; preds = %154, %147, %138
br label %158
158: ; preds = %232, %157
%159 = call i64 @time(i32 0)
store i64 %159, i64* %13
%160 = load i8*, i8** %11
%161 = load i8*, i8** %10
%162 = call i64 @time(i32 0)
%163 = call i64 (...) @getpid()
%164 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %160, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %161, i64 %162, i64 %163)
%165 = load i8*, i8** %11
%166 = call i64 @strlen(i8* %165)
store i64 %166, i64* %8
%167 = load i8*, i8** %11
%168 = load i64, i64* %8
%169 = getelementptr inbounds i8, i8* %167, i64 %168
%170 = call i32 @gethostname(i8* %169, i32 256)
%171 = load i8*, i8** %11
%172 = load i32, i32* @O_WRONLY
%173 = load i32, i32* @O_CREAT
%174 = or i32 %172, %173
%175 = load i32, i32* @O_EXCL
%176 = or i32 %174, %175
%177 = call i32 @open(i8* %171, i32 %176, i32 509)
store i32 %177, i32* %6
%178 = icmp sge i32 %177, 0
br i1 %178, label %179, label %211
179: ; preds = %158
%180 = load i8*, i8** %11
%181 = call i32 @chmod(i8* %180, i32 509)
%182 = load i32, i32* %6
%183 = call i32 @close(i32 %182)
%184 = load i8*, i8** %11
%185 = load i8*, i8** %10
%186 = call i32 @link(i8* %184, i8* %185)
%187 = load i8*, i8** %11
%188 = call i32 @stat(i8* %187, %struct.stat* %14)
%189 = load i8*, i8** %11
%190 = call i32 @unlink(i8* %189)
%191 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 3
%192 = load i32, i32* %191
%193 = icmp ne i32 %192, 2
%194 = zext i1 %193 to i64
%195 = select i1 %193, i32 -1, i32 0
store i32 %195, i32* %6
%196 = icmp ne i32 %195, 0
br i1 %196, label %197, label %210
197: ; preds = %179
%198 = load i8*, i8** %10
%199 = call i32 @stat(i8* %198, %struct.stat* %14)
%200 = icmp ne i32 %199, 0
br i1 %200, label %210, label %201
201: ; preds = %197
%202 = load i64, i64* %13
%203 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 4
%204 = load i64, i64* %203
%205 = add nsw i64 %204, 300
%206 = icmp sgt i64 %202, %205
br i1 %206, label %207, label %210
207: ; preds = %201
%208 = load i8*, i8** %10
%209 = call i32 @unlink(i8* %208)
br label %210
210: ; preds = %207, %201, %197, %179
br label %217
211: ; preds = %158
%212 = load i64, i64* @errno
%213 = load i64, i64* @EACCES
%214 = icmp eq i64 %212, %213
br i1 %214, label %215, label %216
215: ; preds = %211
store i32 0, i32* %7
br label %216
216: ; preds = %215, %211
br label %217
217: ; preds = %216, %210
%218 = load i32, i32* %6
%219 = icmp slt i32 %218, 0
br i1 %219, label %220, label %231
220: ; preds = %217
%221 = load i32, i32* %7
%222 = add nsw i32 %221, -1
store i32 %222, i32* %7
%223 = icmp ne i32 %221, 0
br i1 %223, label %224, label %226
224: ; preds = %220
%225 = call i32 @sleep(i32 1)
br label %230
226: ; preds = %220
%227 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 1)
%228 = load i32, i32* @EX_CANTCREAT
%229 = call i32 @_exit(i32 %228)
unreachable
230: ; preds = %224
br label %231
231: ; preds = %230, %217
br label %232
232: ; preds = %231
%233 = load i32, i32* %6
%234 = icmp slt i32 %233, 0
br i1 %234, label %158, label %235
235: ; preds = %232
%236 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32 1)
%237 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%238 = call i32 @read(i32 0, i8* %237, i32 1)
%239 = load i8*, i8** %10
%240 = call i32 @unlink(i8* %239)
%241 = load i32, i32* @EX_OK
ret i32 %241
}

LLVM IR (-O2):
%struct.stat = type { i32, i64, i64, i32, i64 }
%struct.group = type { i64 }
@.str = [5 x i8] c"mail\00"
@LOG_PID = global i32 0
@LOG_MAIL = global i32 0
@.str.1 = [16 x i8] c"not setgid mail\00"
@EX_USAGE = global i64 0
@.str.2 = [18 x i8] c"invalid arguments\00"
@.str.3 = [11 x i8] c"invalid fd\00"
@.str.4 = [15 x i8] c"malloc failure\00"
@errno = global i64 0
@.str.5 = [14 x i8] c"fstat failure\00"
@S_IFMT = global i32 0
@S_IFREG = global i32 0
@.str.6 = [20 x i8] c"fd not regular file\00"
@.str.7 = [14 x i8] c"lstat failure\00"
@.str.8 = [22 x i8] c"name not regular file\00"
@.str.9 = [22 x i8] c"fd and name different\00"
@.str.10 = [8 x i8] c"%s.lock\00"
@.str.11 = [31 x i8] c"existing lock not regular file\00"
@EX_NOPERM = global i64 0
@.str.12 = [12 x i8] c"%s.%lu.%lu.\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@EACCES = global i64 0
@.str.13 = [2 x i8] c"-\00"
@EX_CANTCREAT = global i32 0
@.str.14 = [2 x i8] c"+\00"
@EX_OK = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.stat
%5 = alloca %struct.stat
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.stat* %4 to i8*
%8 = bitcast %struct.stat* %5 to i8*
%9 = tail call %struct.group* @getgrnam(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %1
%11 = load i32, i32* @LOG_PID
%12 = load i32, i32* @LOG_MAIL
%13 = tail call i32 @openlog(i8* %10, i32 %11, i32 %12)
%14 = icmp eq %struct.group* %9, null
br i1 %14, label %20, label %15
15: ; preds = %2
%16 = getelementptr inbounds %struct.group, %struct.group* %9, i64 0, i32 0
%17 = load i64, i64* %16
%18 = tail call i64 (...) @getegid()
%19 = icmp eq i64 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %15, %2
%21 = load i64, i64* @EX_USAGE
%22 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %21)
br label %23
23: ; preds = %20, %15
%24 = icmp eq i32 %0, 3
br i1 %24, label %28, label %25
25: ; preds = %23
%26 = load i64, i64* @EX_USAGE
%27 = tail call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %26)
br label %28
28: ; preds = %25, %23
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
br i1 %32, label %45, label %33
33: ; preds = %28, %41
%34 = phi i8 [ %43, %41 ], [ %31, %28 ]
%35 = phi i8* [ %42, %41 ], [ %30, %28 ]
%36 = tail call i32 @isdigit(i8 signext %34)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i64, i64* @EX_USAGE
%40 = tail call i32 @die(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %39)
br label %41
41: ; preds = %33, %38
%42 = getelementptr inbounds i8, i8* %35, i64 1
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 0
br i1 %44, label %45, label %33
45: ; preds = %41, %28
%46 = getelementptr inbounds i8*, i8** %1, i64 2
%47 = load i8*, i8** %46
%48 = tail call i64 @strlen(i8* dereferenceable(1) %47)
%49 = add i64 %48, 6
%50 = tail call i64 @malloc(i64 %49)
%51 = inttoptr i64 %50 to i8*
%52 = add i64 %48, 302
%53 = tail call i64 @malloc(i64 %52)
%54 = inttoptr i64 %53 to i8*
%55 = icmp ne i64 %50, 0
%56 = icmp ne i64 %53, 0
%57 = select i1 %55, i1 %56, i1 false
br i1 %57, label %61, label %58
58: ; preds = %45
%59 = load i64, i64* @errno
%60 = tail call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i64 %59)
br label %61
61: ; preds = %45, %58
%62 = load i8*, i8** %29
%63 = tail call i32 @atoi(i8* %62)
%64 = call i64 @fstat(i32 %63, %struct.stat* %5)
%65 = icmp eq i64 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %61
%67 = load i64, i64* @errno
%68 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %67)
br label %69
69: ; preds = %66, %61
%70 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%71 = load i32, i32* %70
%72 = load i32, i32* @S_IFMT
%73 = and i32 %72, %71
%74 = load i32, i32* @S_IFREG
%75 = icmp eq i32 %73, %74
br i1 %75, label %79, label %76
76: ; preds = %69
%77 = load i64, i64* @EX_USAGE
%78 = tail call i32 @die(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 %77)
br label %79
79: ; preds = %76, %69
%80 = load i8*, i8** %46
%81 = call i64 @lstat(i8* %80, %struct.stat* %4)
%82 = icmp eq i64 %81, 0
br i1 %82, label %86, label %83
83: ; preds = %79
%84 = load i64, i64* @errno
%85 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 %84)
br label %86
86: ; preds = %83, %79
%87 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%88 = load i32, i32* %87
%89 = load i32, i32* @S_IFMT
%90 = and i32 %89, %88
%91 = load i32, i32* @S_IFREG
%92 = icmp eq i32 %90, %91
br i1 %92, label %96, label %93
93: ; preds = %86
%94 = load i64, i64* @EX_USAGE
%95 = tail call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i64 %94)
br label %96
96: ; preds = %93, %86
%97 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%98 = load i64, i64* %97
%99 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 1
%100 = load i64, i64* %99
%101 = icmp eq i64 %98, %100
br i1 %101, label %102, label %108
102: ; preds = %96
%103 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 2
%104 = load i64, i64* %103
%105 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 2
%106 = load i64, i64* %105
%107 = icmp eq i64 %104, %106
br i1 %107, label %111, label %108
108: ; preds = %102, %96
%109 = load i64, i64* @EX_USAGE
%110 = tail call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i64 %109)
br label %111
111: ; preds = %108, %102
%112 = load i8*, i8** %46
%113 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %51, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %112)
%114 = call i64 @lstat(i8* %51, %struct.stat* %4)
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %125
116: ; preds = %111
%117 = load i32, i32* %87
%118 = load i32, i32* @S_IFMT
%119 = and i32 %118, %117
%120 = load i32, i32* @S_IFREG
%121 = icmp eq i32 %119, %120
br i1 %121, label %125, label %122
122: ; preds = %116
%123 = load i64, i64* @EX_NOPERM
%124 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i64 %123)
br label %125
125: ; preds = %122, %116, %111
%126 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 3
%127 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 4
br label %128
128: ; preds = %173, %125
%129 = phi i32 [ 299, %125 ], [ %174, %173 ]
%130 = tail call i64 @time(i32 0)
%131 = tail call i64 @time(i32 0)
%132 = tail call i64 (...) @getpid()
%133 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %54, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %51, i64 %131, i64 %132)
%134 = tail call i64 @strlen(i8* dereferenceable(1) %54)
%135 = getelementptr inbounds i8, i8* %54, i64 %134
%136 = tail call i32 @gethostname(i8* %135, i32 256)
%137 = load i32, i32* @O_WRONLY
%138 = load i32, i32* @O_CREAT
%139 = or i32 %138, %137
%140 = load i32, i32* @O_EXCL
%141 = or i32 %139, %140
%142 = tail call i32 @open(i8* %54, i32 %141, i32 509)
%143 = icmp sgt i32 %142, -1
br i1 %143, label %144, label %161
144: ; preds = %128
%145 = tail call i32 @chmod(i8* %54, i32 509)
%146 = tail call i32 @close(i32 %142)
%147 = tail call i32 @link(i8* %54, i8* %51)
%148 = call i32 @stat(i8* %54, %struct.stat* %4)
%149 = tail call i32 @unlink(i8* %54)
%150 = load i32, i32* %126
%151 = icmp eq i32 %150, 2
br i1 %151, label %176, label %152
152: ; preds = %144
%153 = call i32 @stat(i8* %51, %struct.stat* %4)
%154 = icmp eq i32 %153, 0
br i1 %154, label %155, label %167
155: ; preds = %152
%156 = load i64, i64* %127
%157 = add nsw i64 %156, 300
%158 = icmp sgt i64 %130, %157
br i1 %158, label %159, label %167
159: ; preds = %155
%160 = tail call i32 @unlink(i8* %51)
br label %167
161: ; preds = %128
%162 = load i64, i64* @errno
%163 = load i64, i64* @EACCES
%164 = icmp eq i64 %162, %163
%165 = icmp eq i32 %129, 0
%166 = select i1 %164, i1 true, i1 %165
br i1 %166, label %169, label %173
167: ; preds = %159, %155, %152
%168 = icmp eq i32 %129, 0
br i1 %168, label %169, label %173
169: ; preds = %161, %167
%170 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 1)
%171 = load i32, i32* @EX_CANTCREAT
%172 = tail call i32 @_exit(i32 %171)
unreachable
173: ; preds = %161, %167
%174 = add nsw i32 %129, -1
%175 = tail call i32 @sleep(i32 1)
br label %128
176: ; preds = %144
%177 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32 1)
%178 = call i32 @read(i32 0, i8* %6, i32 1)
%179 = tail call i32 @unlink(i8* %51)
%180 = load i32, i32* @EX_OK
ret i32 %180
}