#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 */
struct timeval {
  int dummy;
};
struct pollfd {
  int fd;
  int events;
  int revents;
};
typedef int ssize_t;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ EBADF;
scalar_t__ EINTR;
scalar_t__ EINVAL;
scalar_t__ EIO;
scalar_t__ ETIMEDOUT;
int POLLERR;
int POLLHUP;
int POLLNVAL;
int POLLOUT;
int _fd_get_poll_timeout(struct timeval const *);
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
int poll(struct pollfd *, int, int);
int write(int, unsigned char const *, size_t);
ssize_t fd_timed_write_n(int fd, const void *buf, size_t n,
                         const struct timeval *when, int do_skip_first_poll) {
  const unsigned char *p;
  int msecs;
  struct pollfd pfd;
  int nfd;
  size_t nleft;
  ssize_t nwritten;
  if ((fd < 0) || (buf == NULL)) {
    errno = EINVAL;
    return (-1);
  }
  p = buf;
  nleft = n;
  pfd.fd = fd;
  pfd.events = POLLOUT;
  if (do_skip_first_poll && (nleft > 0)) {
    msecs = -1;
    goto write_me;
  }
  while (nleft > 0) {
    msecs = _fd_get_poll_timeout(when);
    nfd = poll(&pfd, 1, msecs);
    if (nfd < 0) {
      if ((errno == EINTR) || (errno == EAGAIN))
        continue;
      else
        return (-1);
    } else if (nfd == 0) {
      errno = ETIMEDOUT;
      break;
    } else if (pfd.revents & POLLHUP) {
      break;
    } else if (pfd.revents & POLLNVAL) {
      errno = EBADF;
      return (-1);
    } else if (pfd.revents & POLLERR) {
      errno = EIO;
      return (-1);
    }
    assert(pfd.revents & POLLOUT);
  write_me:
    nwritten = write(fd, p, nleft);
    if (nwritten < 0) {
      if ((errno == EINTR) || (errno == EAGAIN))
        continue;
      else
        return (-1);
    }
    nleft -= nwritten;
    p += nwritten;
    if (msecs == 0) {
      break;
    }
  }
  return (n - nleft);
}


x86 assembly (clang, -O0):
<fd_timed_write_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1170 <fd_timed_write_n+0x30>
cmpq   $0x0,-0x10(%rbp)
jne    1190 <fd_timed_write_n+0x50>
mov    0x2e29(%rip),%rax
mov    (%rax),%rcx
mov    0x2e37(%rip),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    13bf <fd_timed_write_n+0x27f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11d3 <fd_timed_write_n+0x93>
cmpq   $0x0,-0x50(%rbp)
jbe    11d3 <fd_timed_write_n+0x93>
movl   $0xffffffff,-0x34(%rbp)
jmp    131e <fd_timed_write_n+0x1de>
jmp    11d8 <fd_timed_write_n+0x98>
cmpq   $0x0,-0x50(%rbp)
jbe    13b4 <fd_timed_write_n+0x274>
mov    -0x20(%rbp),%rdi
call   1060 <_fd_get_poll_timeout@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edx
lea    -0x40(%rbp),%rdi
mov    $0x1,%esi
call   1050 <poll@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1252 <fd_timed_write_n+0x112>
mov    0x2da4(%rip),%rax
mov    (%rax),%rax
mov    0x2d8a(%rip),%rcx
cmp    (%rcx),%rax
je     1241 <fd_timed_write_n+0x101>
mov    0x2d8a(%rip),%rax
mov    (%rax),%rax
mov    0x2d50(%rip),%rcx
cmp    (%rcx),%rax
jne    1246 <fd_timed_write_n+0x106>
jmp    11d8 <fd_timed_write_n+0x98>
movl   $0xffffffff,-0x4(%rbp)
jmp    13bf <fd_timed_write_n+0x27f>
cmpl   $0x0,-0x44(%rbp)
jne    1275 <fd_timed_write_n+0x135>
mov    0x2d4d(%rip),%rax
mov    (%rax),%rcx
mov    0x2d4b(%rip),%rax
mov    %rcx,(%rax)
jmp    13b4 <fd_timed_write_n+0x274>
mov    -0x38(%rbp),%eax
mov    0x2d61(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     128f <fd_timed_write_n+0x14f>
jmp    13b4 <fd_timed_write_n+0x274>
mov    -0x38(%rbp),%eax
mov    0x2d37(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12c4 <fd_timed_write_n+0x184>
mov    0x2ced(%rip),%rax
mov    (%rax),%rcx
mov    0x2d03(%rip),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    13bf <fd_timed_write_n+0x27f>
mov    -0x38(%rbp),%eax
mov    0x2d0a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12f9 <fd_timed_write_n+0x1b9>
mov    0x2ce0(%rip),%rax
mov    (%rax),%rcx
mov    0x2cce(%rip),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    13bf <fd_timed_write_n+0x27f>
jmp    12fe <fd_timed_write_n+0x1be>
jmp    1303 <fd_timed_write_n+0x1c3>
jmp    1308 <fd_timed_write_n+0x1c8>
jmp    130d <fd_timed_write_n+0x1cd>
mov    -0x38(%rbp),%edi
mov    0x2ce1(%rip),%rax
and    (%rax),%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x50(%rbp),%rdx
call   1030 <write@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    1380 <fd_timed_write_n+0x240>
mov    0x2c76(%rip),%rax
mov    (%rax),%rax
mov    0x2c5c(%rip),%rcx
cmp    (%rcx),%rax
je     136f <fd_timed_write_n+0x22f>
mov    0x2c5c(%rip),%rax
mov    (%rax),%rax
mov    0x2c22(%rip),%rcx
cmp    (%rcx),%rax
jne    1374 <fd_timed_write_n+0x234>
jmp    11d8 <fd_timed_write_n+0x98>
movl   $0xffffffff,-0x4(%rbp)
jmp    13bf <fd_timed_write_n+0x27f>
movslq -0x54(%rbp),%rcx
mov    -0x50(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x54(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    13af <fd_timed_write_n+0x26f>
jmp    13b4 <fd_timed_write_n+0x274>
jmp    11d8 <fd_timed_write_n+0x98>
mov    -0x18(%rbp),%rax
sub    -0x50(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_timed_write_n>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
js     118c <fd_timed_write_n+0x4c>
mov    %rsi,%r13
test   %rsi,%rsi
je     118c <fd_timed_write_n+0x4c>
mov    %rcx,%r15
mov    %rdx,%r14
mov    %edi,%r12d
mov    %edi,0x8(%rsp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    $0xffffffff,%ebx
mov    %rdx,%rbp
test   %rdx,%rdx
je     11aa <fd_timed_write_n+0x6a>
test   %r8d,%r8d
jne    1219 <fd_timed_write_n+0xd9>
jmp    11aa <fd_timed_write_n+0x6a>
mov    0x2e0d(%rip),%rax
mov    (%rax),%rax
mov    0x2e1b(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffff,%eax
jmp    1296 <fd_timed_write_n+0x156>
xor    %eax,%eax
test   %rbp,%rbp
je     1290 <fd_timed_write_n+0x150>
mov    %r15,%rdi
call   1060 <_fd_get_poll_timeout@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <poll@plt>
test   %eax,%eax
js     1245 <fd_timed_write_n+0x105>
je     1279 <fd_timed_write_n+0x139>
mov    0x10(%rsp),%edi
mov    0x2dfb(%rip),%rax
test   %edi,(%rax)
jne    128d <fd_timed_write_n+0x14d>
mov    0x2ddc(%rip),%rax
test   %edi,(%rax)
jne    12a5 <fd_timed_write_n+0x165>
mov    0x2dd5(%rip),%rax
test   %edi,(%rax)
jne    12b1 <fd_timed_write_n+0x171>
mov    0x2de6(%rip),%rax
and    (%rax),%edi
call   1040 <assert@plt>
mov    %r12d,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1030 <write@plt>
test   %eax,%eax
js     1245 <fd_timed_write_n+0x105>
mov    %eax,%eax
sub    %rax,%rbp
add    %rax,%r13
test   %ebx,%ebx
je     128d <fd_timed_write_n+0x14d>
mov    %rbp,%rax
test   %rbp,%rbp
jne    11b5 <fd_timed_write_n+0x75>
jmp    1290 <fd_timed_write_n+0x150>
mov    0x2d6c(%rip),%rax
mov    (%rax),%rcx
mov    0x2d52(%rip),%rsi
mov    0x2d2b(%rip),%rax
mov    (%rax),%rdx
mov    $0xffffffff,%eax
cmp    (%rsi),%rcx
je     11aa <fd_timed_write_n+0x6a>
cmp    %rdx,%rcx
je     11aa <fd_timed_write_n+0x6a>
jmp    1296 <fd_timed_write_n+0x156>
mov    0x2d30(%rip),%rax
mov    (%rax),%rax
mov    0x2d2e(%rip),%rcx
mov    %rax,(%rcx)
mov    %rbp,%rax
sub    %eax,%r14d
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cec(%rip),%rax
jmp    1193 <fd_timed_write_n+0x53>
mov    0x2d08(%rip),%rax
jmp    1193 <fd_timed_write_n+0x53>

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.pollfd = type { i32, i32, i32 }
@EINVAL = global i64 0
@errno = global i64 0
@POLLOUT = global i32 0
@EINTR = global i64 0
@EAGAIN = global i64 0
@ETIMEDOUT = global i64 0
@POLLHUP = global i32 0
@POLLNVAL = global i32 0
@EBADF = global i64 0
@POLLERR = global i32 0
@EIO = global i64 0
define i32 @fd_timed_write_n(i32 %0, i8* %1, i64 %2, %struct.timeval* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca %struct.timeval*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca %struct.pollfd
%15 = alloca i32
%16 = alloca i64
%17 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store %struct.timeval* %3, %struct.timeval** %10
store i32 %4, i32* %11
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %5
%21 = load i8*, i8** %8
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20, %5
%24 = load i64, i64* @EINVAL
store i64 %24, i64* @errno
store i32 -1, i32* %6
br label %132
25: ; preds = %20
%26 = load i8*, i8** %8
store i8* %26, i8** %12
%27 = load i64, i64* %9
store i64 %27, i64* %16
%28 = load i32, i32* %7
%29 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 0
store i32 %28, i32* %29
%30 = load i32, i32* @POLLOUT
%31 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 1
store i32 %30, i32* %31
%32 = load i32, i32* %11
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %25
%35 = load i64, i64* %16
%36 = icmp ugt i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 -1, i32* %13
br label %97
38: ; preds = %34, %25
br label %39
39: ; preds = %126, %112, %57, %38
%40 = load i64, i64* %16
%41 = icmp ugt i64 %40, 0
br i1 %41, label %42, label %127
42: ; preds = %39
%43 = load %struct.timeval*, %struct.timeval** %10
%44 = call i32 @_fd_get_poll_timeout(%struct.timeval* %43)
store i32 %44, i32* %13
%45 = load i32, i32* %13
%46 = call i32 @poll(%struct.pollfd* %14, i32 1, i32 %45)
store i32 %46, i32* %15
%47 = load i32, i32* %15
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %59
49: ; preds = %42
%50 = load i64, i64* @errno
%51 = load i64, i64* @EINTR
%52 = icmp eq i64 %50, %51
br i1 %52, label %57, label %53
53: ; preds = %49
%54 = load i64, i64* @errno
%55 = load i64, i64* @EAGAIN
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %58
57: ; preds = %53, %49
br label %39
58: ; preds = %53
store i32 -1, i32* %6
br label %132
59: ; preds = %42
%60 = load i32, i32* %15
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = load i64, i64* @ETIMEDOUT
store i64 %63, i64* @errno
br label %127
64: ; preds = %59
%65 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 2
%66 = load i32, i32* %65
%67 = load i32, i32* @POLLHUP
%68 = and i32 %66, %67
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %64
br label %127
71: ; preds = %64
%72 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 2
%73 = load i32, i32* %72
%74 = load i32, i32* @POLLNVAL
%75 = and i32 %73, %74
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %71
%78 = load i64, i64* @EBADF
store i64 %78, i64* @errno
store i32 -1, i32* %6
br label %132
79: ; preds = %71
%80 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 2
%81 = load i32, i32* %80
%82 = load i32, i32* @POLLERR
%83 = and i32 %81, %82
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = load i64, i64* @EIO
store i64 %86, i64* @errno
store i32 -1, i32* %6
br label %132
87: ; preds = %79
br label %88
88: ; preds = %87
br label %89
89: ; preds = %88
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
%92 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %14, i32 0, i32 2
%93 = load i32, i32* %92
%94 = load i32, i32* @POLLOUT
%95 = and i32 %93, %94
%96 = call i32 @assert(i32 %95)
br label %97
97: ; preds = %91, %37
%98 = load i32, i32* %7
%99 = load i8*, i8** %12
%100 = load i64, i64* %16
%101 = call i32 @write(i32 %98, i8* %99, i64 %100)
store i32 %101, i32* %17
%102 = load i32, i32* %17
%103 = icmp slt i32 %102, 0
br i1 %103, label %104, label %114
104: ; preds = %97
%105 = load i64, i64* @errno
%106 = load i64, i64* @EINTR
%107 = icmp eq i64 %105, %106
br i1 %107, label %112, label %108
108: ; preds = %104
%109 = load i64, i64* @errno
%110 = load i64, i64* @EAGAIN
%111 = icmp eq i64 %109, %110
br i1 %111, label %112, label %113
112: ; preds = %108, %104
br label %39
113: ; preds = %108
store i32 -1, i32* %6
br label %132
114: ; preds = %97
%115 = load i32, i32* %17
%116 = sext i32 %115 to i64
%117 = load i64, i64* %16
%118 = sub i64 %117, %116
store i64 %118, i64* %16
%119 = load i32, i32* %17
%120 = load i8*, i8** %12
%121 = sext i32 %119 to i64
%122 = getelementptr inbounds i8, i8* %120, i64 %121
store i8* %122, i8** %12
%123 = load i32, i32* %13
%124 = icmp eq i32 %123, 0
br i1 %124, label %125, label %126
125: ; preds = %114
br label %127
126: ; preds = %114
br label %39
127: ; preds = %125, %70, %62, %39
%128 = load i64, i64* %9
%129 = load i64, i64* %16
%130 = sub i64 %128, %129
%131 = trunc i64 %130 to i32
store i32 %131, i32* %6
br label %132
132: ; preds = %127, %113, %85, %77, %58, %23
%133 = load i32, i32* %6
ret i32 %133
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.pollfd = type { i32, i32, i32 }
@EINVAL = global i64 0
@errno = global i64 0
@POLLOUT = global i32 0
@EINTR = global i64 0
@EAGAIN = global i64 0
@ETIMEDOUT = global i64 0
@POLLHUP = global i32 0
@POLLNVAL = global i32 0
@EBADF = global i64 0
@POLLERR = global i32 0
@EIO = global i64 0
define i32 @fd_timed_write_n(i32 %0, i8* %1, i64 %2, %struct.timeval* %3, i32 %4) {
%6 = alloca %struct.pollfd
%7 = bitcast %struct.pollfd* %6 to i8*
%8 = icmp slt i32 %0, 0
%9 = icmp eq i8* %1, null
%10 = or i1 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = load i64, i64* @EINVAL
store i64 %12, i64* @errno
br label %87
13: ; preds = %5
%14 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %6, i64 0, i32 0
store i32 %0, i32* %14
%15 = load i32, i32* @POLLOUT
%16 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %6, i64 0, i32 1
store i32 %15, i32* %16
%17 = icmp ne i32 %4, 0
%18 = icmp ne i64 %2, 0
%19 = and i1 %18, %17
br i1 %19, label %63, label %20
20: ; preds = %69, %30, %13
%21 = phi i8* [ %1, %13 ], [ %25, %30 ], [ %65, %69 ]
%22 = phi i64 [ %2, %13 ], [ %26, %30 ], [ %66, %69 ]
%23 = icmp eq i64 %22, 0
br i1 %23, label %83, label %24
24: ; preds = %76, %20
%25 = phi i8* [ %21, %20 ], [ %79, %76 ]
%26 = phi i64 [ %22, %20 ], [ %78, %76 ]
%27 = call i32 @_fd_get_poll_timeout(%struct.timeval* %3)
%28 = call i32 @poll(%struct.pollfd* %6, i32 1, i32 %27)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %24
%31 = load i64, i64* @errno
%32 = load i64, i64* @EINTR
%33 = icmp eq i64 %31, %32
%34 = load i64, i64* @EAGAIN
%35 = icmp eq i64 %31, %34
%36 = select i1 %33, i1 true, i1 %35
br i1 %36, label %20, label %87
37: ; preds = %24
%38 = icmp eq i32 %28, 0
br i1 %38, label %39, label %41
39: ; preds = %37
%40 = load i64, i64* @ETIMEDOUT
store i64 %40, i64* @errno
br label %83
41: ; preds = %37
%42 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %6, i64 0, i32 2
%43 = load i32, i32* %42
%44 = load i32, i32* @POLLHUP
%45 = and i32 %44, %43
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %83
47: ; preds = %41
%48 = load i32, i32* @POLLNVAL
%49 = and i32 %48, %43
%50 = icmp eq i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = load i64, i64* @EBADF
store i64 %52, i64* @errno
br label %87
53: ; preds = %47
%54 = load i32, i32* @POLLERR
%55 = and i32 %54, %43
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %53
%58 = load i64, i64* @EIO
store i64 %58, i64* @errno
br label %87
59: ; preds = %53
%60 = load i32, i32* @POLLOUT
%61 = and i32 %60, %43
%62 = call i32 @assert(i32 %61)
br label %63
63: ; preds = %13, %59
%64 = phi i32 [ %27, %59 ], [ -1, %13 ]
%65 = phi i8* [ %25, %59 ], [ %1, %13 ]
%66 = phi i64 [ %26, %59 ], [ %2, %13 ]
%67 = call i32 @write(i32 %0, i8* %65, i64 %66)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %63
%70 = load i64, i64* @errno
%71 = load i64, i64* @EINTR
%72 = icmp eq i64 %70, %71
%73 = load i64, i64* @EAGAIN
%74 = icmp eq i64 %70, %73
%75 = select i1 %72, i1 true, i1 %74
br i1 %75, label %20, label %87
76: ; preds = %63
%77 = zext i32 %67 to i64
%78 = sub i64 %66, %77
%79 = getelementptr inbounds i8, i8* %65, i64 %77
%80 = icmp ne i32 %64, 0
%81 = icmp ne i64 %78, 0
%82 = and i1 %80, %81
br i1 %82, label %24, label %83
83: ; preds = %76, %41, %39, %20
%84 = phi i64 [ %26, %39 ], [ %26, %41 ], [ 0, %20 ], [ %78, %76 ]
%85 = sub i64 %2, %84
%86 = trunc i64 %85 to i32
br label %87
87: ; preds = %69, %30, %83, %57, %51, %11
%88 = phi i32 [ -1, %11 ], [ %86, %83 ], [ -1, %51 ], [ -1, %57 ], [ -1, %30 ], [ -1, %69 ]
ret i32 %88
}