#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memmove(char *, char *, int);
int wrap_write(int, char *, int);
int wrap_line(int fd, char *buff, int len) {
  static int done = 0, state = 0;
  int rc = 0, idx = 0;
  static char temp[512];
  if (!buff) {
    len = 0;
    if (state) {
      memcpy(temp + done, "\r\n", 2);
      done += 2;
    }
    state = 0;
  } else
    for (idx = 0; idx < len; idx++) {
      switch (buff[idx]) {
      case '.':
        if (!state)
          temp[done++] = '.';
        state = 1;
        goto dodo;
      case '\r':
        break;
      case '\n':
        temp[done++] = '\r';
        state = 0;
        goto dodo;
      default:
        state = 1;
      dodo:
        temp[done++] = buff[idx];
      }
      if (done + 2 < (int)sizeof temp)
        continue;
      rc = wrap_write(fd, temp, done);
      if (rc <= 0)
        goto kut;
      if (rc < done)
        memmove(temp, temp + rc, done - rc);
      done -= rc;
    }
  if (done) {
    rc = wrap_write(fd, temp, done);
    if (rc <= 0)
      goto kut;
    if (rc < done)
      memmove(temp, temp + rc, done - rc);
    done -= rc;
  }
kut:
  return rc <= 0 ? -1 : idx;
}


x86 assembly (clang, -O0):
<wrap_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11af <wrap_line+0x7f>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,0x2eeb(%rip)
je     11a0 <wrap_line+0x70>
movslq 0x2eda(%rip),%rax
lea    0x2ee3(%rip),%rdi
add    %rax,%rdi
lea    0xe79(%rip),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    0x2eb9(%rip),%eax
add    $0x2,%eax
mov    %eax,0x2eb0(%rip)
movl   $0x0,0x2eaa(%rip)
jmp    1338 <wrap_line+0x208>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1333 <wrap_line+0x203>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
sub    $0xa,%eax
je     1241 <wrap_line+0x111>
jmp    11df <wrap_line+0xaf>
mov    -0x20(%rbp),%eax
sub    $0xd,%eax
je     123c <wrap_line+0x10c>
jmp    11f0 <wrap_line+0xc0>
mov    -0x20(%rbp),%eax
sub    $0x2e,%eax
jne    126f <wrap_line+0x13f>
jmp    1201 <wrap_line+0xd1>
cmpl   $0x0,0x2e4c(%rip)
jne    122d <wrap_line+0xfd>
mov    0x2e3c(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e31(%rip)
movslq %eax,%rcx
lea    0x2e37(%rip),%rax
movb   $0x2e,(%rax,%rcx,1)
movl   $0x1,0x2e1d(%rip)
jmp    1279 <wrap_line+0x149>
jmp    12a2 <wrap_line+0x172>
mov    0x2e09(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2dfe(%rip)
movslq %eax,%rcx
lea    0x2e04(%rip),%rax
movb   $0xd,(%rax,%rcx,1)
movl   $0x0,0x2dea(%rip)
jmp    1279 <wrap_line+0x149>
movl   $0x1,0x2ddb(%rip)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    0x2dc6(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2dbb(%rip)
movslq %eax,%rcx
lea    0x2dc1(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    0x2da8(%rip),%eax
add    $0x2,%eax
cmp    $0x200,%eax
jge    12bb <wrap_line+0x18b>
jmp    1325 <wrap_line+0x1f5>
mov    -0x4(%rbp),%edi
mov    0x2d8c(%rip),%edx
lea    0x2d95(%rip),%rsi
call   1050 <wrap_write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     12e2 <wrap_line+0x1b2>
jmp    13b4 <wrap_line+0x284>
mov    -0x18(%rbp),%eax
cmp    0x2d65(%rip),%eax
jge    1314 <wrap_line+0x1e4>
movslq -0x18(%rbp),%rax
lea    0x2d64(%rip),%rsi
add    %rax,%rsi
mov    0x2d4b(%rip),%edx
sub    -0x18(%rbp),%edx
lea    0x2d51(%rip),%rdi
call   1040 <memmove@plt>
mov    -0x18(%rbp),%ecx
mov    0x2d33(%rip),%eax
sub    %ecx,%eax
mov    %eax,0x2d2b(%rip)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b6 <wrap_line+0x86>
jmp    1338 <wrap_line+0x208>
cmpl   $0x0,0x2d11(%rip)
je     13af <wrap_line+0x27f>
mov    -0x4(%rbp),%edi
mov    0x2d02(%rip),%edx
lea    0x2d0b(%rip),%rsi
call   1050 <wrap_write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     136c <wrap_line+0x23c>
jmp    13b4 <wrap_line+0x284>
mov    -0x18(%rbp),%eax
cmp    0x2cdb(%rip),%eax
jge    139e <wrap_line+0x26e>
movslq -0x18(%rbp),%rax
lea    0x2cda(%rip),%rsi
add    %rax,%rsi
mov    0x2cc1(%rip),%edx
sub    -0x18(%rbp),%edx
lea    0x2cc7(%rip),%rdi
call   1040 <memmove@plt>
mov    -0x18(%rbp),%ecx
mov    0x2ca9(%rip),%eax
sub    %ecx,%eax
mov    %eax,0x2ca1(%rip)
jmp    13b4 <wrap_line+0x284>
cmpl   $0x0,-0x18(%rbp)
jg     13cb <wrap_line+0x29b>
mov    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    13d1 <wrap_line+0x2a1>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrap_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
test   %rsi,%rsi
je     124f <wrap_line+0x11f>
test   %edx,%edx
jle    1288 <wrap_line+0x158>
mov    %rsi,%r13
mov    %edx,%r12d
xor    %ebp,%ebp
lea    0x2f02(%rip),%r15
xor    %ebx,%ebx
jmp    1185 <wrap_line+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    %ebx,%eax
mov    %eax,0x2ed8(%rip)
add    $0x1,%rbp
cmp    %rbp,%r12
je     128d <wrap_line+0x15d>
movsbl 0x0(%r13,%rbp,1),%ecx
cmp    $0xa,%ecx
je     11b0 <wrap_line+0x80>
cmp    $0xd,%ecx
je     1200 <wrap_line+0xd0>
mov    $0x1,%al
cmp    $0x2e,%ecx
jne    11c8 <wrap_line+0x98>
mov    $0x2e,%cl
mov    $0x1,%al
cmpb   $0x0,0x2ead(%rip)
je     11b4 <wrap_line+0x84>
jmp    11c8 <wrap_line+0x98>
nopl   0x0(%rax,%rax,1)
mov    $0xd,%cl
xor    %eax,%eax
movslq 0x2e95(%rip),%rdx
lea    0x1(%rdx),%esi
mov    %esi,0x2e8c(%rip)
mov    %cl,(%rdx,%r15,1)
mov    %al,0x2e86(%rip)
movzbl 0x0(%r13,%rbp,1),%eax
movslq 0x2e75(%rip),%rcx
lea    0x1(%rcx),%edx
mov    %edx,0x2e6c(%rip)
mov    %al,(%rcx,%r15,1)
cmp    $0x1fe,%edx
jl     1178 <wrap_line+0x48>
jmp    1212 <wrap_line+0xe2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2e4a(%rip),%edx
cmp    $0x1fe,%edx
jl     1178 <wrap_line+0x48>
mov    %r14d,%edi
mov    %r15,%rsi
call   1050 <wrap_write@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    12d8 <wrap_line+0x1a8>
mov    0x2e23(%rip),%eax
mov    %eax,%edx
sub    %ebx,%edx
jle    1170 <wrap_line+0x40>
mov    %ebx,%esi
add    %r15,%rsi
mov    %r15,%rdi
call   1040 <memmove@plt>
mov    0x2e06(%rip),%eax
jmp    1170 <wrap_line+0x40>
cmpb   $0x1,0x2dfe(%rip)
jne    1281 <wrap_line+0x151>
movslq 0x2df1(%rip),%rax
lea    0x2dfa(%rip),%rdi
add    %rax,%rdi
lea    0xd90(%rip),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
addl   $0x2,0x2dcf(%rip)
movb   $0x0,0x2dcc(%rip)
xor    %ebx,%ebx
xor    %r12d,%r12d
mov    0x2dbd(%rip),%edx
test   %edx,%edx
je     12db <wrap_line+0x1ab>
lea    0x2dc2(%rip),%rbp
mov    %r14d,%edi
mov    %rbp,%rsi
call   1050 <wrap_write@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    12db <wrap_line+0x1ab>
mov    0x2d9b(%rip),%eax
mov    %eax,%edx
sub    %ebx,%edx
jle    12ce <wrap_line+0x19e>
mov    %ebx,%esi
add    %rbp,%rsi
mov    %rbp,%rdi
call   1040 <memmove@plt>
mov    0x2d82(%rip),%eax
sub    %ebx,%eax
mov    %eax,0x2d7a(%rip)
jmp    12db <wrap_line+0x1ab>
mov    %ebp,%r12d
test   %ebx,%ebx
mov    $0xffffffff,%eax
cmovg  %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@wrap_line.done = internal global i32 0
@wrap_line.state = internal global i32 0
@wrap_line.temp = internal global [512 x i8] zeroinitializer
@.str = [3 x i8] c"\0D\0A\00"
define i32 @wrap_line(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %22, label %11
11: ; preds = %3
store i32 0, i32* %6
%12 = load i32, i32* @wrap_line.state
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* @wrap_line.done
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i64 %16
%18 = call i32 @memcpy(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%19 = load i32, i32* @wrap_line.done
%20 = add nsw i32 %19, 2
store i32 %20, i32* @wrap_line.done
br label %21
21: ; preds = %14, %11
store i32 0, i32* @wrap_line.state
br label %92
22: ; preds = %3
store i32 0, i32* %8
br label %23
23: ; preds = %88, %22
%24 = load i32, i32* %8
%25 = load i32, i32* %6
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %91
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
switch i32 %33, label %49 [
i32 46, label %34
i32 13, label %43
i32 10, label %44
]
34: ; preds = %27
%35 = load i32, i32* @wrap_line.state
%36 = icmp ne i32 %35, 0
br i1 %36, label %42, label %37
37: ; preds = %34
%38 = load i32, i32* @wrap_line.done
%39 = add nsw i32 %38, 1
store i32 %39, i32* @wrap_line.done
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %40
store i8 46, i8* %41
br label %42
42: ; preds = %37, %34
store i32 1, i32* @wrap_line.state
br label %50
43: ; preds = %27
br label %60
44: ; preds = %27
%45 = load i32, i32* @wrap_line.done
%46 = add nsw i32 %45, 1
store i32 %46, i32* @wrap_line.done
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %47
store i8 13, i8* %48
store i32 0, i32* @wrap_line.state
br label %50
49: ; preds = %27
store i32 1, i32* @wrap_line.state
br label %50
50: ; preds = %49, %44, %42
%51 = load i8*, i8** %5
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = load i32, i32* @wrap_line.done
%57 = add nsw i32 %56, 1
store i32 %57, i32* @wrap_line.done
%58 = sext i32 %56 to i64
%59 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %58
store i8 %55, i8* %59
br label %60
60: ; preds = %50, %43
%61 = load i32, i32* @wrap_line.done
%62 = add nsw i32 %61, 2
%63 = icmp slt i32 %62, 512
br i1 %63, label %64, label %65
64: ; preds = %60
br label %88
65: ; preds = %60
%66 = load i32, i32* %4
%67 = load i32, i32* @wrap_line.done
%68 = call i32 @wrap_write(i32 %66, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i32 %67)
store i32 %68, i32* %7
%69 = load i32, i32* %7
%70 = icmp sle i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %65
br label %119
72: ; preds = %65
%73 = load i32, i32* %7
%74 = load i32, i32* @wrap_line.done
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %84
76: ; preds = %72
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i64 %78
%80 = load i32, i32* @wrap_line.done
%81 = load i32, i32* %7
%82 = sub nsw i32 %80, %81
%83 = call i32 @memmove(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i8* %79, i32 %82)
br label %84
84: ; preds = %76, %72
%85 = load i32, i32* %7
%86 = load i32, i32* @wrap_line.done
%87 = sub nsw i32 %86, %85
store i32 %87, i32* @wrap_line.done
br label %88
88: ; preds = %84, %64
%89 = load i32, i32* %8
%90 = add nsw i32 %89, 1
store i32 %90, i32* %8
br label %23
91: ; preds = %23
br label %92
92: ; preds = %91, %21
%93 = load i32, i32* @wrap_line.done
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %118
95: ; preds = %92
%96 = load i32, i32* %4
%97 = load i32, i32* @wrap_line.done
%98 = call i32 @wrap_write(i32 %96, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i32 %97)
store i32 %98, i32* %7
%99 = load i32, i32* %7
%100 = icmp sle i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %95
br label %119
102: ; preds = %95
%103 = load i32, i32* %7
%104 = load i32, i32* @wrap_line.done
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %114
106: ; preds = %102
%107 = load i32, i32* %7
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i64 %108
%110 = load i32, i32* @wrap_line.done
%111 = load i32, i32* %7
%112 = sub nsw i32 %110, %111
%113 = call i32 @memmove(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i8* %109, i32 %112)
br label %114
114: ; preds = %106, %102
%115 = load i32, i32* %7
%116 = load i32, i32* @wrap_line.done
%117 = sub nsw i32 %116, %115
store i32 %117, i32* @wrap_line.done
br label %118
118: ; preds = %114, %92
br label %119
119: ; preds = %118, %101, %71
%120 = load i32, i32* %7
%121 = icmp sle i32 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %119
br label %125
123: ; preds = %119
%124 = load i32, i32* %8
br label %125
125: ; preds = %123, %122
%126 = phi i32 [ -1, %122 ], [ %124, %123 ]
ret i32 %126
}

LLVM IR (-O2):
@wrap_line.done = internal unnamed_addr global i32 0
@wrap_line.state = internal unnamed_addr global i1 false
@wrap_line.temp = internal global [512 x i8] zeroinitializer
@.str = [3 x i8] c"\0D\0A\00"
define i32 @wrap_line(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %65
7: ; preds = %5
%8 = zext i32 %2 to i64
br label %19
9: ; preds = %3
%10 = load i1, i1* @wrap_line.state
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = load i32, i32* @wrap_line.done
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %13
%15 = tail call i32 @memcpy(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%16 = load i32, i32* @wrap_line.done
%17 = add nsw i32 %16, 2
store i32 %17, i32* @wrap_line.done
br label %18
18: ; preds = %11, %9
store i1 false, i1* @wrap_line.state
br label %65
19: ; preds = %7, %61
%20 = phi i64 [ 0, %7 ], [ %63, %61 ]
%21 = phi i32 [ 0, %7 ], [ %62, %61 ]
%22 = getelementptr inbounds i8, i8* %1, i64 %20
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
switch i32 %24, label %34 [
i32 46, label %25
i32 13, label %41
i32 10, label %27
]
25: ; preds = %19
%26 = load i1, i1* @wrap_line.state
br i1 %26, label %34, label %27
27: ; preds = %19, %25
%28 = phi i8 [ 46, %25 ], [ 13, %19 ]
%29 = phi i1 [ true, %25 ], [ false, %19 ]
%30 = load i32, i32* @wrap_line.done
%31 = add nsw i32 %30, 1
store i32 %31, i32* @wrap_line.done
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %32
store i8 %28, i8* %33
br label %34
34: ; preds = %27, %19, %25
%35 = phi i1 [ true, %25 ], [ true, %19 ], [ %29, %27 ]
store i1 %35, i1* @wrap_line.state
%36 = load i8, i8* %22
%37 = load i32, i32* @wrap_line.done
%38 = add nsw i32 %37, 1
store i32 %38, i32* @wrap_line.done
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %39
store i8 %36, i8* %40
br label %43
41: ; preds = %19
%42 = load i32, i32* @wrap_line.done
br label %43
43: ; preds = %41, %34
%44 = phi i32 [ %42, %41 ], [ %38, %34 ]
%45 = icmp slt i32 %44, 510
br i1 %45, label %61, label %46
46: ; preds = %43
%47 = tail call i32 @wrap_write(i32 %0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i32 %44)
%48 = icmp slt i32 %47, 1
br i1 %48, label %85, label %49
49: ; preds = %46
%50 = load i32, i32* @wrap_line.done
%51 = icmp sgt i32 %50, %47
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = zext i32 %47 to i64
%54 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %53
%55 = sub nsw i32 %50, %47
%56 = tail call i32 @memmove(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i8* %54, i32 %55)
%57 = load i32, i32* @wrap_line.done
br label %58
58: ; preds = %52, %49
%59 = phi i32 [ %57, %52 ], [ %50, %49 ]
%60 = sub nsw i32 %59, %47
store i32 %60, i32* @wrap_line.done
br label %61
61: ; preds = %43, %58
%62 = phi i32 [ %21, %43 ], [ %47, %58 ]
%63 = add nuw nsw i64 %20, 1
%64 = icmp eq i64 %63, %8
br i1 %64, label %65, label %19
65: ; preds = %61, %5, %18
%66 = phi i32 [ 0, %18 ], [ 0, %5 ], [ %62, %61 ]
%67 = phi i32 [ 0, %18 ], [ 0, %5 ], [ %2, %61 ]
%68 = load i32, i32* @wrap_line.done
%69 = icmp eq i32 %68, 0
br i1 %69, label %87, label %70
70: ; preds = %65
%71 = tail call i32 @wrap_write(i32 %0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i32 %68)
%72 = icmp slt i32 %71, 1
br i1 %72, label %87, label %73
73: ; preds = %70
%74 = load i32, i32* @wrap_line.done
%75 = icmp sgt i32 %74, %71
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = zext i32 %71 to i64
%78 = getelementptr inbounds [512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 %77
%79 = sub nsw i32 %74, %71
%80 = tail call i32 @memmove(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @wrap_line.temp, i64 0, i64 0), i8* %78, i32 %79)
%81 = load i32, i32* @wrap_line.done
br label %82
82: ; preds = %76, %73
%83 = phi i32 [ %81, %76 ], [ %74, %73 ]
%84 = sub nsw i32 %83, %71
store i32 %84, i32* @wrap_line.done
br label %87
85: ; preds = %46
%86 = trunc i64 %20 to i32
br label %87
87: ; preds = %85, %65, %82, %70
%88 = phi i32 [ %71, %70 ], [ %71, %82 ], [ %66, %65 ], [ %47, %85 ]
%89 = phi i32 [ %67, %70 ], [ %67, %82 ], [ %67, %65 ], [ %86, %85 ]
%90 = icmp slt i32 %88, 1
%91 = select i1 %90, i32 -1, i32 %89
ret i32 %91
}