#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ squeeze(char *, char *);
int main(void) {
  int c;
  char s[1000];
  char ss[1000];
  int pos = 0;
  ss[0] = 'a';
  ss[1] = 'b';
  ss[2] = 'c';
  ss[3] = 'd';
  ss[4] = '\0';
  while ((c = getchar()) != EOF) {
    if (c == '\n' || pos == 1000 - 1) {
      s[pos] = '\0';
      squeeze(s, ss);
      printf("%s\n", s);
      pos = 0;
    } else {
      s[pos++] = c;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x7e4(%rbp)
movb   $0x61,-0x7e0(%rbp)
movb   $0x62,-0x7df(%rbp)
movb   $0x63,-0x7de(%rbp)
movb   $0x64,-0x7dd(%rbp)
movb   $0x0,-0x7dc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e68(%rip),%rcx
cmp    (%rcx),%eax
je     120a <main+0xda>
cmpl   $0xa,-0x8(%rbp)
je     11a2 <main+0x72>
cmpl   $0x3e7,-0x7e4(%rbp)
jne    11e6 <main+0xb6>
movslq -0x7e4(%rbp),%rax
movb   $0x0,-0x3f0(%rbp,%rax,1)
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   1030 <squeeze@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x7e4(%rbp)
jmp    1205 <main+0xd5>
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    -0x7e4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7e4(%rbp)
cltq
mov    %cl,-0x3f0(%rbp,%rax,1)
jmp    116f <main+0x3f>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7e0,%rsp
movl   $0x64636261,(%rsp)
movb   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e8f(%rip),%r12
cmp    (%r12),%eax
jne    1171 <main+0x41>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x3f0(%rsp),%rbx
mov    %rsp,%r14
lea    0xe7d(%rip),%r15
xor    %ebp,%ebp
jmp    11bd <main+0x8d>
nopw   0x0(%rax,%rax,1)
movb   $0x0,0x3f0(%rsp,%rcx,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <squeeze@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     115f <main+0x2f>
movslq %ebp,%rcx
cmp    $0xa,%eax
je     1190 <main+0x60>
cmp    $0x3e7,%ebp
je     1190 <main+0x60>
add    $0x1,%ebp
mov    %al,0x3f0(%rsp,%rcx,1)
jmp    11b0 <main+0x80>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
store i8 97, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 1
store i8 98, i8* %7
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 2
store i8 99, i8* %8
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 3
store i8 100, i8* %9
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 4
store i8 0, i8* %10
br label %11
11: ; preds = %37, %0
%12 = call i32 (...) @getchar()
store i32 %12, i32* %2
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %38
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 10
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 999
br i1 %20, label %21, label %30
21: ; preds = %18, %15
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %23
store i8 0, i8* %24
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%27 = call i32 @squeeze(i8* %25, i8* %26)
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %28)
store i32 0, i32* %5
br label %37
30: ; preds = %18
%31 = load i32, i32* %2
%32 = trunc i32 %31 to i8
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %35
store i8 %32, i8* %36
br label %37
37: ; preds = %30, %21
br label %11
38: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
store i8 97, i8* %4
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 1
store i8 98, i8* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 2
store i8 99, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 3
store i8 100, i8* %7
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 4
store i8 0, i8* %8
%9 = call i32 (...) @getchar()
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %33, label %12
12: ; preds = %0, %28
%13 = phi i32 [ %30, %28 ], [ %9, %0 ]
%14 = phi i32 [ %29, %28 ], [ 0, %0 ]
%15 = icmp eq i32 %13, 10
%16 = icmp eq i32 %14, 999
%17 = select i1 %15, i1 true, i1 %16
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = sext i32 %14 to i64
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %19
store i8 0, i8* %20
%21 = call i32 @squeeze(i8* %3, i8* %4)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %28
23: ; preds = %12
%24 = trunc i32 %13 to i8
%25 = add nsw i32 %14, 1
%26 = sext i32 %14 to i64
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %26
store i8 %24, i8* %27
br label %28
28: ; preds = %23, %18
%29 = phi i32 [ 0, %18 ], [ %25, %23 ]
%30 = call i32 (...) @getchar()
%31 = load i32, i32* @EOF
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %12
33: ; preds = %28, %0
ret i32 0
}