#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*/ printf(char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
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);
  setbuf(stdout, NULL);
  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    0x2e8a(%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    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    0x2e51(%rip),%rax
mov    (%rax),%edx
mov    0x2e50(%rip),%rax
mov    (%rax),%ecx
call   1050 <setvbuf@plt>
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xdf1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xdcf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <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    0x2e83(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rsi
mov    %rcx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
mov    0x2e56(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
call   1060 <setvbuf@plt>
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    0xe60(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    0xe18(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    0xe07(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1070 <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"
@.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 = call i32 @setbuf(i32 %18, i32* null)
%20 = call i32 @sleep(i32 1)
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @sleep(i32 1)
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @sleep(i32 1)
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @sleep(i32 1)
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @sleep(i32 1)
store i32 0, i32* %1
%29 = load i8*, i8** %2
%30 = load i32, i32* %1
ret i32 %30
}

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"
@.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 = call i32 @setbuf(i32 %13, i32* null)
%15 = call i32 @sleep(i32 1)
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @sleep(i32 1)
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @sleep(i32 1)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @sleep(i32 1)
%22 = call i32 @putchar(i32 10)
%23 = call i32 @sleep(i32 1)
ret i32 0
}