#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 read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char buffer[256];
  int nbc;
  write(1, "> ", 2);
  nbc = read(0, buffer, 256);
  write(1, buffer, 2);
  write(1, "...", 3);
  write(1, buffer + 2, (nbc - 2));
  write(1, "\nFIN\n", 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    $0x1,%edi
lea    0xec9(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
lea    -0x100(%rbp),%rsi
xor    %edi,%edi
mov    $0x100,%edx
call   1040 <read@plt>
mov    %eax,-0x104(%rbp)
lea    -0x100(%rbp),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    $0x1,%edi
lea    0xe87(%rip),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
lea    -0x100(%rbp),%rsi
add    $0x2,%rsi
mov    -0x104(%rbp),%edx
sub    $0x2,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
lea    0xe57(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
lea    0xed0(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1040 <read@plt>
mov    %eax,%ebp
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <write@plt>
lea    0xe97(%rip),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <write@plt>
lea    0x2(%rsp),%rsi
add    $0xfffffffe,%ebp
mov    $0x1,%edi
mov    %ebp,%edx
call   1030 <write@plt>
lea    0xe71(%rip),%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
@.str.1 = [4 x i8] c"...\00"
@.str.2 = [6 x i8] c"\0AFIN\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 256)
store i32 %5, i32* %2
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%7 = call i32 @write(i32 1, i8* %6, i32 2)
%8 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 2
%13 = call i32 @write(i32 1, i8* %10, i32 %12)
%14 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
@.str.1 = [4 x i8] c"...\00"
@.str.2 = [6 x i8] c"\0AFIN\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = call i32 @read(i32 0, i8* %2, i32 256)
%5 = call i32 @write(i32 1, i8* %2, i32 2)
%6 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 2
%8 = add nsw i32 %4, -2
%9 = call i32 @write(i32 1, i8* %7, i32 %8)
%10 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
ret i32 0
}