#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 strlen(char *);
char *change_newline2space(char *s) {
  char *ss = s;
  while (*ss++)
    if (*ss == '\n')
      *ss = ' ';
  if (strlen(s) > 44) {
    *(s + 44 - 3) = '.';
    *(s + 44 - 2) = '.';
    *(s + 44 - 1) = '.';
    *(s + 44) = '\0';
  }
  return s;
}


x86 assembly (clang, -O0):
<change_newline2space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     1158 <change_newline2space+0x48>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1153 <change_newline2space+0x43>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
jmp    1124 <change_newline2space+0x14>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2c,%eax
jle    118a <change_newline2space+0x7a>
mov    -0x8(%rbp),%rax
movb   $0x2e,0x29(%rax)
mov    -0x8(%rbp),%rax
movb   $0x2e,0x2a(%rax)
mov    -0x8(%rbp),%rax
movb   $0x2e,0x2b(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x2c(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_newline2space>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1137 <change_newline2space+0x27>
lea    0x1(%rbx),%rax
jmp    1128 <change_newline2space+0x18>
nop
add    $0x1,%rax
test   %cl,%cl
je     1137 <change_newline2space+0x27>
movzbl (%rax),%ecx
cmp    $0xa,%cl
jne    1120 <change_newline2space+0x10>
movb   $0x20,(%rax)
mov    $0x20,%cl
jmp    1120 <change_newline2space+0x10>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2d,%eax
jl     114b <change_newline2space+0x3b>
movl   $0x2e2e2e,0x29(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @change_newline2space(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i8*, i8** %3
store i8 32, i8* %16
br label %17
17: ; preds = %15, %10
br label %5
18: ; preds = %5
%19 = load i8*, i8** %2
%20 = call i32 @strlen(i8* %19)
%21 = icmp sgt i32 %20, 44
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 44
%25 = getelementptr inbounds i8, i8* %24, i64 -3
store i8 46, i8* %25
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 44
%28 = getelementptr inbounds i8, i8* %27, i64 -2
store i8 46, i8* %28
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 44
%31 = getelementptr inbounds i8, i8* %30, i64 -1
store i8 46, i8* %31
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 44
store i8 0, i8* %33
br label %34
34: ; preds = %22, %18
%35 = load i8*, i8** %2
ret i8* %35
}

LLVM IR (-O2):
define i8* @change_newline2space(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %10
%5 = phi i8* [ %6, %10 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 32, i8* %6
br label %10
10: ; preds = %9, %4
%11 = phi i8 [ 32, %9 ], [ %7, %4 ]
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %10, %1
%14 = tail call i32 @strlen(i8* %0)
%15 = icmp sgt i32 %14, 44
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = getelementptr inbounds i8, i8* %0, i64 44
%18 = getelementptr inbounds i8, i8* %0, i64 41
store i8 46, i8* %18
%19 = getelementptr inbounds i8, i8* %0, i64 42
store i8 46, i8* %19
%20 = getelementptr inbounds i8, i8* %0, i64 43
store i8 46, i8* %20
store i8 0, i8* %17
br label %21
21: ; preds = %16, %13
ret i8* %0
}