#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*/ isspace(char const);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char const *);
void print_spec_indented_and_max_length(const char *str, int len, int Num) {
  int notfirsttime = 0;
  int slen = strlen(str);
  int lo = 0, hi = 0;
  while (hi < slen) {
    hi = lo + len;
    if (hi >= slen) {
      printf("        ");
      for (lo += notfirsttime; lo < slen; lo++)
        printf("%c", str[lo]);
      printf("\n");
      return;
    }
    while (!(isspace(str[hi])) && hi > lo)
      hi--;
    if (hi == lo) {
      hi = lo + len;
      while (!(isspace(str[hi])) && hi < slen)
        hi++;
    }
    printf("        ");
    for (lo += notfirsttime; lo < hi; lo++)
      printf("%c", str[lo]);
    printf("\n");
    notfirsttime = 1;
  }
}


x86 assembly (clang, -O0):
<print_spec_indented_and_max_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12fc <print_spec_indented_and_max_length+0x1cc>
mov    -0x1c(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     11e2 <print_spec_indented_and_max_length+0xb2>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11cf <print_spec_indented_and_max_length+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <print_spec_indented_and_max_length+0x6b>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12fc <print_spec_indented_and_max_length+0x1cc>
jmp    11e7 <print_spec_indented_and_max_length+0xb7>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
jne    1214 <print_spec_indented_and_max_length+0xe4>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1224 <print_spec_indented_and_max_length+0xf4>
jmp    1232 <print_spec_indented_and_max_length+0x102>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11e7 <print_spec_indented_and_max_length+0xb7>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1297 <print_spec_indented_and_max_length+0x167>
mov    -0x1c(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x22(%rbp)
jne    1274 <print_spec_indented_and_max_length+0x144>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
setl   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    1284 <print_spec_indented_and_max_length+0x154>
jmp    1292 <print_spec_indented_and_max_length+0x162>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1247 <print_spec_indented_and_max_length+0x117>
jmp    1297 <print_spec_indented_and_max_length+0x167>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12e2 <print_spec_indented_and_max_length+0x1b2>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12ae <print_spec_indented_and_max_length+0x17e>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1163 <print_spec_indented_and_max_length+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spec_indented_and_max_length>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x18(%rsp)
mov    %rdi,%r13
call   1040 <strlen@plt>
test   %eax,%eax
jle    1289 <print_spec_indented_and_max_length+0x149>
mov    %eax,%ebx
mov    %eax,%r14d
mov    0x18(%rsp),%rax
mov    %eax,%ecx
not    %ecx
mov    %ecx,0x4(%rsp)
add    $0xffffffff,%eax
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
xor    %r12d,%r12d
mov    %r14,0x10(%rsp)
mov    %ebx,0x8(%rsp)
jmp    11ad <print_spec_indented_and_max_length+0x6d>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%r12d
mov    0x8(%rsp),%ebx
cmp    %ebx,%r15d
jge    1289 <print_spec_indented_and_max_length+0x149>
mov    0x18(%rsp),%rax
add    %ebp,%eax
cmp    %ebx,%eax
jge    1298 <print_spec_indented_and_max_length+0x158>
mov    %r12d,0xc(%rsp)
movslq %eax,%r12
movslq %ebp,%r15
mov    0x4(%rsp),%r14d
mov    %r12,%rbx
nop
movsbl 0x0(%r13,%rbx,1),%edi
call   1060 <isspace@plt>
add    $0x1,%r14d
test   %eax,%eax
jne    11ef <print_spec_indented_and_max_length+0xaf>
lea    -0x1(%rbx),%rax
cmp    %r15,%rbx
mov    %rax,%rbx
jg     11d0 <print_spec_indented_and_max_length+0x90>
test   %r14d,%r14d
je     1210 <print_spec_indented_and_max_length+0xd0>
mov    %ebp,%r15d
sub    %r14d,%r15d
mov    0x10(%rsp),%r14
jmp    1240 <print_spec_indented_and_max_length+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rax
lea    (%rax,%rbp,1),%r15d
mov    0x10(%rsp),%r14
xchg   %ax,%ax
movsbl 0x0(%r13,%r12,1),%edi
call   1060 <isspace@plt>
add    $0x1,%r15d
test   %eax,%eax
jne    1240 <print_spec_indented_and_max_length+0x100>
lea    0x1(%r12),%rax
cmp    %r14,%r12
mov    %rax,%r12
jl     1220 <print_spec_indented_and_max_length+0xe0>
lea    0xdb9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    0xc(%rsp),%ebp
cmp    %r15d,%ebp
jge    1190 <print_spec_indented_and_max_length+0x50>
movslq %ebp,%rbp
movslq %r15d,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x0(%r13,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbx,%rbp
jl     1270 <print_spec_indented_and_max_length+0x130>
jmp    1190 <print_spec_indented_and_max_length+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd61(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    %r12d,%ebp
cmp    %ebx,%ebp
jge    12c4 <print_spec_indented_and_max_length+0x184>
movslq %ebp,%rbx
movsbl 0x0(%r13,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
jl     12b0 <print_spec_indented_and_max_length+0x170>
mov    $0xa,%edi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c" \00"
define void @print_spec_indented_and_max_length(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %77
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %73
%9 = phi i32 [ %74, %73 ], [ 0, %6 ]
%10 = phi i32 [ 1, %73 ], [ 0, %6 ]
%11 = add i32 %9, %1
%12 = icmp slt i32 %11, %4
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = sext i32 %11 to i64
%15 = sext i32 %9 to i64
br label %32
16: ; preds = %8
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%18 = add i32 %9, %10
%19 = icmp slt i32 %18, %4
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = sext i32 %18 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ %21, %20 ], [ %28, %22 ]
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = tail call i32 @putchar(i32 %26)
%28 = add nsw i64 %23, 1
%29 = icmp slt i64 %28, %7
br i1 %29, label %22, label %30
30: ; preds = %22, %16
%31 = tail call i32 @putchar(i32 10)
br label %77
32: ; preds = %13, %32
%33 = phi i64 [ %14, %13 ], [ %40, %32 ]
%34 = getelementptr inbounds i8, i8* %0, i64 %33
%35 = load i8, i8* %34
%36 = tail call i32 @isspace(i8 signext %35)
%37 = icmp eq i32 %36, 0
%38 = icmp sgt i64 %33, %15
%39 = select i1 %37, i1 %38, i1 false
%40 = add nsw i64 %33, -1
br i1 %39, label %32, label %41
41: ; preds = %32
%42 = trunc i64 %33 to i32
%43 = icmp eq i32 %9, %42
br i1 %43, label %44, label %55
44: ; preds = %41, %44
%45 = phi i64 [ %52, %44 ], [ %14, %41 ]
%46 = getelementptr inbounds i8, i8* %0, i64 %45
%47 = load i8, i8* %46
%48 = tail call i32 @isspace(i8 signext %47)
%49 = icmp eq i32 %48, 0
%50 = icmp slt i64 %45, %7
%51 = select i1 %49, i1 %50, i1 false
%52 = add nsw i64 %45, 1
br i1 %51, label %44, label %53
53: ; preds = %44
%54 = trunc i64 %45 to i32
br label %55
55: ; preds = %53, %41
%56 = phi i32 [ %42, %41 ], [ %54, %53 ]
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%58 = add i32 %9, %10
%59 = icmp slt i32 %58, %56
br i1 %59, label %60, label %73
60: ; preds = %55
%61 = sext i32 %58 to i64
%62 = sext i32 %56 to i64
br label %63
63: ; preds = %60, %63
%64 = phi i64 [ %61, %60 ], [ %69, %63 ]
%65 = getelementptr inbounds i8, i8* %0, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = tail call i32 @putchar(i32 %67)
%69 = add nsw i64 %64, 1
%70 = icmp slt i64 %69, %62
br i1 %70, label %63, label %71
71: ; preds = %63
%72 = trunc i64 %69 to i32
br label %73
73: ; preds = %71, %55
%74 = phi i32 [ %58, %55 ], [ %72, %71 ]
%75 = tail call i32 @putchar(i32 10)
%76 = icmp slt i32 %56, %4
br i1 %76, label %8, label %77
77: ; preds = %73, %3, %30
ret void
}