#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*/ _IOLBF;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stdin;
int main() {
  char buff[10];
  char stuff[100];
  setvbuf(stdin, buff, _IOLBF, 10);
  fgets(stuff, 100, stdin);
  printf("\n##############################\n");
  printf("%s\n", stuff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    -0xe(%rbp),%rsi
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%ecx
call   1050 <setvbuf@plt>
lea    -0x80(%rbp),%rdi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    0x2ea9(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    0x6(%rsp),%rsi
mov    $0xa,%ecx
call   1050 <setvbuf@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@_IOLBF = global i32 0
@.str = [33 x i8] c"\0A##############################\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = load i32, i32* @stdin
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @_IOLBF
%7 = call i32 @setvbuf(i32 %4, i8* %5, i32 %6, i32 10)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 100, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@_IOLBF = global i32 0
@str = [32 x i8] c"\0A##############################\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = load i32, i32* @_IOLBF
%7 = call i32 @setvbuf(i32 %5, i8* %3, i32 %6, i32 10)
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 100, i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%11 = call i32 @puts(i8* %4)
ret i32 0
}