#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*/ strcat(char *, char const *);
int strlen(char const *);
void strPut(char *buf, int buflen, const char *p) {
  if ((strlen(buf) + strlen(p)) < (unsigned)(buflen - 3)) {
    if (strlen(buf) > 0) {
      if ((strlen(buf) + strlen(p)) > 75)
        strcat(buf, ",\n");
      else
        strcat(buf, ", ");
    }
    strcat(buf, p);
  }
}


x86 assembly (clang, -O0):
<strPut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jae    11cb <strPut+0xab>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jle    11be <strPut+0x9e>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
cmp    $0x4b,%eax
jle    11a9 <strPut+0x89>
mov    -0x8(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1040 <strcat@plt>
jmp    11b9 <strPut+0x99>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcat@plt>
jmp    11be <strPut+0x9e>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strPut>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %ebx,%eax
add    $0xfffffffd,%ebp
cmp    %ebp,%eax
jae    1199 <strPut+0x79>
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1184 <strPut+0x64>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %ebx,%eax
cmp    $0x4c,%eax
lea    0xe8f(%rip),%rax
lea    0xe8b(%rip),%rsi
cmovge %rax,%rsi
mov    %r15,%rdi
call   1040 <strcat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <strcat@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c",\0A\00"
@.str.1 = [3 x i8] c", \00"
define void @strPut(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 3
%14 = icmp ult i32 %11, %13
br i1 %14, label %15, label %37
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = call i32 @strlen(i8* %20)
%22 = load i8*, i8** %6
%23 = call i32 @strlen(i8* %22)
%24 = add nsw i32 %21, %23
%25 = icmp sgt i32 %24, 75
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i8*, i8** %4
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %32
29: ; preds = %19
%30 = load i8*, i8** %4
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %29, %26
br label %33
33: ; preds = %32, %15
%34 = load i8*, i8** %4
%35 = load i8*, i8** %6
%36 = call i32 @strcat(i8* %34, i8* %35)
br label %37
37: ; preds = %33, %3
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c",\0A\00"
@.str.1 = [3 x i8] c", \00"
define void @strPut(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %2)
%6 = add nsw i32 %5, %4
%7 = add nsw i32 %1, -3
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %21
9: ; preds = %3
%10 = tail call i32 @strlen(i8* %0)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = tail call i32 @strlen(i8* %0)
%14 = tail call i32 @strlen(i8* %2)
%15 = add nsw i32 %14, %13
%16 = icmp sgt i32 %15, 75
%17 = select i1 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%18 = tail call i32 @strcat(i8* %0, i8* %17)
br label %19
19: ; preds = %12, %9
%20 = tail call i32 @strcat(i8* %0, i8* %2)
br label %21
21: ; preds = %19, %3
ret void
}