#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 BUFSIZ;
int /*<<< orphan*/ _IOLBF;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int main(void) {
  char buf[BUFSIZ];
  setvbuf(stdout, buf, _IOLBF, BUFSIZ);
  printf("Hello,");
  sleep(1);
  printf("Unix!");
  sleep(1);
  printf("\n");
  sleep(5);
  setvbuf(stdout, NULL, _IONBF, 0);
  sleep(1);
  printf("How ");
  sleep(1);
  printf("are ");
  sleep(1);
  printf("you?");
  sleep(1);
  printf("\n");
  sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    0x2e59(%rip),%rax
mov    (%rax),%edx
mov    0x2e58(%rip),%rax
mov    (%rax),%ecx
call   1040 <setvbuf@plt>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <sleep@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    0x2e0f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xdd4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    0x2e8b(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rsi
mov    %rcx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
mov    0x2e5e(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
call   1050 <setvbuf@plt>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
mov    (%rbx),%edi
mov    0x2e25(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@stdout = global i32 0
@_IOLBF = global i32 0
@.str = [7 x i8] c"Hello,\00"
@.str.1 = [6 x i8] c"Unix!\00"
@.str.2 = [2 x i8] c"\0A\00"
@_IONBF = global i32 0
@.str.3 = [5 x i8] c"How \00"
@.str.4 = [5 x i8] c"are \00"
@.str.5 = [5 x i8] c"you?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 0, i32* %1
%4 = load i32, i32* @BUFSIZ
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %2
%7 = alloca i8, i64 %5
store i64 %5, i64* %3
%8 = load i32, i32* @stdout
%9 = load i32, i32* @_IOLBF
%10 = load i32, i32* @BUFSIZ
%11 = call i32 @setvbuf(i32 %8, i8* %7, i32 %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @sleep(i32 1)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @sleep(i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @sleep(i32 5)
%18 = load i32, i32* @stdout
%19 = load i32, i32* @_IONBF
%20 = call i32 @setvbuf(i32 %18, i8* null, i32 %19, i32 0)
%21 = call i32 @sleep(i32 1)
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @sleep(i32 1)
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @sleep(i32 1)
%26 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @sleep(i32 1)
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @sleep(i32 1)
store i32 0, i32* %1
%30 = load i8*, i8** %2
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@stdout = global i32 0
@_IOLBF = global i32 0
@.str = [7 x i8] c"Hello,\00"
@.str.1 = [6 x i8] c"Unix!\00"
@_IONBF = global i32 0
@.str.3 = [5 x i8] c"How \00"
@.str.4 = [5 x i8] c"are \00"
@.str.5 = [5 x i8] c"you?\00"
define i32 @main() {
%1 = load i32, i32* @BUFSIZ
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = load i32, i32* @stdout
%5 = load i32, i32* @_IOLBF
%6 = call i32 @setvbuf(i32 %4, i8* %3, i32 %5, i32 %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @sleep(i32 1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @sleep(i32 1)
%11 = call i32 @putchar(i32 10)
%12 = call i32 @sleep(i32 5)
%13 = load i32, i32* @stdout
%14 = load i32, i32* @_IONBF
%15 = call i32 @setvbuf(i32 %13, i8* null, i32 %14, i32 0)
%16 = call i32 @sleep(i32 1)
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @sleep(i32 1)
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @sleep(i32 1)
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @sleep(i32 1)
%23 = call i32 @putchar(i32 10)
%24 = call i32 @sleep(i32 1)
ret i32 0
}