#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*/ free(char *);
char *indent(char const *);
int linecount(char const *);
char *savefmt(char *, char const *, char const *, char const *, char const *,
              char const *);
int strlen(char const *);
char *wrapit2(const char *pfx, const char *s, const char *mid, const char *s2,
              const char *sfx) {
  char *out;
  if (linecount(s) > 1 || linecount(s2) > 1 ||
      strlen(pfx) + strlen(s) + strlen(mid) + strlen(s2) + strlen(sfx) > 60) {
    char *ind = indent(s);
    char *ind2 = indent(s2);
    out = savefmt("%s\n%s\n%s\n%s\n%s", pfx, ind, mid, ind2, sfx);
    free(ind);
    free(ind2);
  } else {
    out = savefmt("%s %s %s %s %s", pfx, s, mid, s2, sfx);
  }
  return out;
}


x86 assembly (clang, -O0):
<wrapit2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <linecount@plt>
cmp    $0x1,%eax
jg     11ee <wrapit2+0x9e>
mov    -0x20(%rbp),%rdi
call   1030 <linecount@plt>
cmp    $0x1,%eax
jg     11ee <wrapit2+0x9e>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
cmp    $0x3c,%eax
jle    1243 <wrapit2+0xf3>
mov    -0x10(%rbp),%rdi
call   1060 <indent@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <indent@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xddd(%rip),%rdi
call   1070 <savefmt@plt>
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
jmp    1267 <wrapit2+0x117>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xdb1(%rip),%rdi
call   1070 <savefmt@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrapit2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsi,%rdi
call   1030 <linecount@plt>
cmp    $0x1,%eax
jg     11ce <wrapit2+0x7e>
mov    %r13,%rdi
call   1030 <linecount@plt>
cmp    $0x1,%eax
jg     11ce <wrapit2+0x7e>
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    (%rsp),%ebp
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r14,(%rsp)
mov    %eax,%r14d
add    %ebp,%r14d
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    (%rsp),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
add    %ebp,%eax
cmp    $0x3d,%eax
jl     1224 <wrapit2+0xd4>
mov    %rbx,%rdi
call   1060 <indent@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1060 <indent@plt>
mov    %rax,%rbp
lea    0xe15(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %rax,%r8
mov    %r14,%r9
call   1070 <savefmt@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde4(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r13,%r8
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <savefmt@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s\0A%s\0A%s\0A%s\0A%s\00"
@.str.1 = [15 x i8] c"%s %s %s %s %s\00"
define i8* @wrapit2(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%14 = load i8*, i8** %7
%15 = call i32 @linecount(i8* %14)
%16 = icmp sgt i32 %15, 1
br i1 %16, label %37, label %17
17: ; preds = %5
%18 = load i8*, i8** %9
%19 = call i32 @linecount(i8* %18)
%20 = icmp sgt i32 %19, 1
br i1 %20, label %37, label %21
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = call i32 @strlen(i8* %22)
%24 = load i8*, i8** %7
%25 = call i32 @strlen(i8* %24)
%26 = add nsw i32 %23, %25
%27 = load i8*, i8** %8
%28 = call i32 @strlen(i8* %27)
%29 = add nsw i32 %26, %28
%30 = load i8*, i8** %9
%31 = call i32 @strlen(i8* %30)
%32 = add nsw i32 %29, %31
%33 = load i8*, i8** %10
%34 = call i32 @strlen(i8* %33)
%35 = add nsw i32 %32, %34
%36 = icmp sgt i32 %35, 60
br i1 %36, label %37, label %52
37: ; preds = %21, %17, %5
%38 = load i8*, i8** %7
%39 = call i8* @indent(i8* %38)
store i8* %39, i8** %12
%40 = load i8*, i8** %9
%41 = call i8* @indent(i8* %40)
store i8* %41, i8** %13
%42 = load i8*, i8** %6
%43 = load i8*, i8** %12
%44 = load i8*, i8** %8
%45 = load i8*, i8** %13
%46 = load i8*, i8** %10
%47 = call i8* @savefmt(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %42, i8* %43, i8* %44, i8* %45, i8* %46)
store i8* %47, i8** %11
%48 = load i8*, i8** %12
%49 = call i32 @free(i8* %48)
%50 = load i8*, i8** %13
%51 = call i32 @free(i8* %50)
br label %59
52: ; preds = %21
%53 = load i8*, i8** %6
%54 = load i8*, i8** %7
%55 = load i8*, i8** %8
%56 = load i8*, i8** %9
%57 = load i8*, i8** %10
%58 = call i8* @savefmt(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %53, i8* %54, i8* %55, i8* %56, i8* %57)
store i8* %58, i8** %11
br label %59
59: ; preds = %52, %37
%60 = load i8*, i8** %11
ret i8* %60
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\0A%s\0A%s\0A%s\0A%s\00"
@.str.1 = [15 x i8] c"%s %s %s %s %s\00"
define i8* @wrapit2(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @linecount(i8* %1)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %22, label %8
8: ; preds = %5
%9 = tail call i32 @linecount(i8* %3)
%10 = icmp sgt i32 %9, 1
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = tail call i32 @strlen(i8* %0)
%13 = tail call i32 @strlen(i8* %1)
%14 = add nsw i32 %13, %12
%15 = tail call i32 @strlen(i8* %2)
%16 = add nsw i32 %14, %15
%17 = tail call i32 @strlen(i8* %3)
%18 = add nsw i32 %16, %17
%19 = tail call i32 @strlen(i8* %4)
%20 = add nsw i32 %18, %19
%21 = icmp sgt i32 %20, 60
br i1 %21, label %22, label %28
22: ; preds = %11, %8, %5
%23 = tail call i8* @indent(i8* %1)
%24 = tail call i8* @indent(i8* %3)
%25 = tail call i8* @savefmt(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %23, i8* %2, i8* %24, i8* %4)
%26 = tail call i32 @free(i8* %23)
%27 = tail call i32 @free(i8* %24)
br label %30
28: ; preds = %11
%29 = tail call i8* @savefmt(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1, i8* %2, i8* %3, i8* %4)
br label %30
30: ; preds = %28, %22
%31 = phi i8* [ %25, %22 ], [ %29, %28 ]
ret i8* %31
}