#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*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int getchar();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ realloc(char *, int);
int soma_string(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int main() {
  char cbuff[2] = {0, 0};
  char last = 0;
  char *mem = NULL;
  int size = 0;
  int i = 0;
  mem = (char *)malloc(sizeof(char));
  do {
    sprintf(cbuff, "%c", getchar());
    if (last == '\\' && cbuff[0] == 'n') {
      for (i = 0; i < strlen(mem) - 1; i++)
        ;
      mem[i] = '\n';
      sprintf(cbuff, "%c", getchar());
    }
    if (cbuff[0] < 0)
      cbuff[0] = 0;
    last = cbuff[0];
    size += sizeof(char);
    mem = (char *)realloc(mem, size);
    strcat(mem, cbuff);
  } while (!feof(stdin) && strstr(cbuff, "\n") == NULL);
  printf("%d", soma_string(mem));
  free(mem);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x6(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1070 <memset@plt>
movb   $0x0,-0x7(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    -0x6(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1080 <getchar@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xddd(%rip),%rsi
call   10d0 <sprintf@plt>
movsbl -0x7(%rbp),%eax
cmp    $0x5c,%eax
jne    12a8 <main+0xe8>
movsbl -0x6(%rbp),%eax
cmp    $0x6e,%eax
jne    12a8 <main+0xe8>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    127b <main+0xbb>
jmp    126d <main+0xad>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1249 <main+0x89>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
lea    -0x6(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1080 <getchar@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xd5d(%rip),%rsi
call   10d0 <sprintf@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x0,%eax
jge    12b9 <main+0xf9>
movb   $0x0,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x7(%rbp)
movslq -0x14(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10b0 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x6(%rbp),%rsi
call   10c0 <strcat@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
call   1090 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x31(%rbp)
jne    131f <main+0x15f>
lea    -0x6(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   10e0 <strstr@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    1207 <main+0x47>
mov    -0x10(%rbp),%rdi
call   1040 <soma_string@plt>
mov    %eax,%esi
lea    0xcc9(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movw   $0x0,0x6(%rsp)
mov    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
lea    0x6(%rsp),%r14
mov    0x2e1d(%rip),%r12
xor    %ebp,%ebp
xor    %r15d,%r15d
mov    %ebp,%r13d
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %eax,%ebp
mov    %bpl,0x6(%rsp)
movb   $0x0,0x7(%rsp)
cmp    $0x5c,%r13b
jne    122a <main+0x8a>
movzbl %bpl,%eax
cmp    $0x6e,%eax
jne    122a <main+0x8a>
mov    $0xffffffffffffffff,%rbp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    $0xffffffff,%eax
add    $0x1,%rbp
cmp    %eax,%ebp
jl     1200 <main+0x60>
movb   $0xa,(%rbx,%rbp,1)
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %eax,%ebp
mov    %bpl,0x6(%rsp)
movb   $0x0,0x7(%rsp)
test   %bpl,%bpl
jns    1236 <main+0x96>
movb   $0x0,0x6(%rsp)
xor    %ebp,%ebp
movslq %r15d,%r15
add    $0x1,%r15
mov    %rbx,%rdi
mov    %r15d,%esi
call   10b0 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   10c0 <strcat@plt>
mov    (%r12),%edi
call   1090 <feof@plt>
test   %eax,%eax
jne    1279 <main+0xd9>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11d0 <main+0x30>
mov    %rbx,%rdi
call   1040 <soma_string@plt>
lea    0xd78(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [2 x i8]* %2 to i8*
store i8 0, i8* %3
store i8* null, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i64 @malloc(i32 1)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
br label %10
10: ; preds = %70, %0
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%12 = call i32 (...) @getchar()
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 92
br i1 %16, label %17, label %41
17: ; preds = %10
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 110
br i1 %21, label %22, label %41
22: ; preds = %17
store i32 0, i32* %6
br label %23
23: ; preds = %30, %22
%24 = load i32, i32* %6
%25 = load i8*, i8** %4
%26 = call i32 @strlen(i8* %25)
%27 = sub nsw i32 %26, 1
%28 = icmp slt i32 %24, %27
br i1 %28, label %29, label %33
29: ; preds = %23
br label %30
30: ; preds = %29
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %23
33: ; preds = %23
%34 = load i8*, i8** %4
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 10, i8* %37
%38 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%39 = call i32 (...) @getchar()
%40 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %33, %17, %10
%42 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
store i8 0, i8* %47
br label %48
48: ; preds = %46, %41
%49 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%50 = load i8, i8* %49
store i8 %50, i8* %3
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = add i64 %52, 1
%54 = trunc i64 %53 to i32
store i32 %54, i32* %5
%55 = load i8*, i8** %4
%56 = load i32, i32* %5
%57 = call i64 @realloc(i8* %55, i32 %56)
%58 = inttoptr i64 %57 to i8*
store i8* %58, i8** %4
%59 = load i8*, i8** %4
%60 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%61 = call i32 @strcat(i8* %59, i8* %60)
br label %62
62: ; preds = %48
%63 = load i32, i32* @stdin
%64 = call i32 @feof(i32 %63)
%65 = icmp ne i32 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %62
%67 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%68 = call i32* @strstr(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br label %70
70: ; preds = %66, %62
%71 = phi i1 [ false, %62 ], [ %69, %66 ]
br i1 %71, label %10, label %72
72: ; preds = %70
%73 = load i8*, i8** %4
%74 = call i32 @soma_string(i8* %73)
%75 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %74)
%76 = load i8*, i8** %4
%77 = call i32 @free(i8* %76)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
store i16 0, i16* %1
%3 = tail call i64 @malloc(i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr inbounds i8, i8* %2, i64 1
br label %6
6: ; preds = %43, %0
%7 = phi i8 [ 0, %0 ], [ %32, %43 ]
%8 = phi i8* [ %4, %0 ], [ %38, %43 ]
%9 = phi i64 [ 0, %0 ], [ %35, %43 ]
%10 = call i32 (...) @getchar()
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
store i8 0, i8* %5
%12 = icmp eq i8 %7, 92
%13 = and i32 %10, 255
%14 = icmp eq i32 %13, 110
%15 = and i1 %12, %14
br i1 %15, label %16, label %27
16: ; preds = %6, %16
%17 = phi i32 [ %21, %16 ], [ 0, %6 ]
%18 = call i32 @strlen(i8* %8)
%19 = add nsw i32 %18, -1
%20 = icmp slt i32 %17, %19
%21 = add nuw nsw i32 %17, 1
br i1 %20, label %16, label %22
22: ; preds = %16
%23 = zext i32 %17 to i64
%24 = getelementptr inbounds i8, i8* %8, i64 %23
store i8 10, i8* %24
%25 = call i32 (...) @getchar()
%26 = trunc i32 %25 to i8
store i8 %26, i8* %2
store i8 0, i8* %5
br label %27
27: ; preds = %6, %22
%28 = phi i8 [ %26, %22 ], [ %11, %6 ]
%29 = icmp slt i8 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
store i8 0, i8* %2
br label %31
31: ; preds = %30, %27
%32 = phi i8 [ 0, %30 ], [ %28, %27 ]
%33 = shl i64 %9, 32
%34 = ashr exact i64 %33, 32
%35 = add nsw i64 %34, 1
%36 = trunc i64 %35 to i32
%37 = call i64 @realloc(i8* %8, i32 %36)
%38 = inttoptr i64 %37 to i8*
%39 = call i32 @strcat(i8* %38, i8* %2)
%40 = load i32, i32* @stdin
%41 = call i32 @feof(i32 %40)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %31
%44 = call i8* @strchr(i8* %2, i32 10)
%45 = icmp eq i8* %44, null
br i1 %45, label %6, label %46
46: ; preds = %31, %43
%47 = inttoptr i64 %37 to i8*
%48 = call i32 @soma_string(i8* %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = call i32 @free(i8* %47)
ret i32 0
}