#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 */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ _IOFBF;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
void fflush_t() {
  char buff[1024];
  memset(buff, '\0', sizeof(buff));
  fprintf(stdout, "\nGoing to set full buffering on\n");
  setvbuf(stdout, buff, _IOFBF, 1024);
  fprintf(stdout, "This is tutorialspoint.com\n");
  fprintf(stdout, "This output will go into buff\n");
  fflush(stdout);
  fprintf(stdout, "and this will appear when programm\n");
  fprintf(stdout, "will come after sleeping 5 seconds\n");
  sleep(5);
}


x86 assembly (clang, -O0):
<fflush_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    -0x400(%rbp),%rsi
mov    0x2e3e(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%ecx
call   1060 <setvbuf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fflush_t>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    0x2e6d(%rip),%rbx
mov    (%rbx),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rsi
mov    $0x400,%ecx
call   1060 <setvbuf@plt>
mov    (%rbx),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
mov    (%rbx),%edi
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xead(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [33 x i8] c"\0AGoing to set full buffering on\0A\00"
@_IOFBF = global i32 0
@.str.1 = [28 x i8] c"This is tutorialspoint.com\0A\00"
@.str.2 = [31 x i8] c"This output will go into buff\0A\00"
@.str.3 = [36 x i8] c"and this will appear when programm\0A\00"
@.str.4 = [36 x i8] c"will come after sleeping 5 seconds\0A\00"
define void @fflush_t() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i8 signext 0, i32 1024)
%4 = load i32, i32* @stdout
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @_IOFBF
%9 = call i32 @setvbuf(i32 %6, i8* %7, i32 %8, i32 1024)
%10 = load i32, i32* @stdout
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = call i32 @fflush(i32 %14)
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* @stdout
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @sleep(i32 5)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [33 x i8] c"\0AGoing to set full buffering on\0A\00"
@_IOFBF = global i32 0
@.str.1 = [28 x i8] c"This is tutorialspoint.com\0A\00"
@.str.2 = [31 x i8] c"This output will go into buff\0A\00"
@.str.3 = [36 x i8] c"and this will appear when programm\0A\00"
@.str.4 = [36 x i8] c"will come after sleeping 5 seconds\0A\00"
define void @fflush_t() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i8 signext 0, i32 1024)
%4 = load i32, i32* @stdout
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = load i32, i32* @_IOFBF
%8 = call i32 @setvbuf(i32 %6, i8* %2, i32 %7, i32 1024)
%9 = load i32, i32* @stdout
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
%15 = load i32, i32* @stdout
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* @stdout
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @sleep(i32 5)
ret void
}