#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 */
scalar_t__ read_input(int /*<<< orphan*/, int);
int /*<<< orphan*/ save_with_output();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ wprintf(char *);
void floodgates(void) {
  wprintf(L"opening the floodgates! paste as much data as you wish below "
          L"(Ctrl-D to stop)\n");
  while (read_input(stdin, false) == 0)
    ;
  wprintf(L"floodgates closed\n");
  save_with_output();
}


x86 assembly (clang, -O0):
<floodgates>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <wprintf@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <read_input@plt>
cmp    $0x0,%rax
jne    115f <floodgates+0x2f>
jmp    1140 <floodgates+0x10>
lea    0xfd6(%rip),%rdi
call   1040 <wprintf@plt>
mov    $0x0,%al
call   1030 <save_with_output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<floodgates>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <wprintf@plt>
mov    0x2ea4(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%edi
xor    %esi,%esi
call   1050 <read_input@plt>
test   %rax,%rax
je     1150 <floodgates+0x20>
lea    0xfd7(%rip),%rdi
call   1040 <wprintf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <save_with_output@plt>

LLVM IR (-O0):
@.str = [79 x i32] [i32 111, i32 112, i32 101, i32 110, i32 105, i32 110, i32 103, i32 32, i32 116, i32 104, i32 101, i32 32, i32 102, i32 108, i32 111, i32 111, i32 100, i32 103, i32 97, i32 116, i32 101, i32 115, i32 33, i32 32, i32 112, i32 97, i32 115, i32 116, i32 101, i32 32, i32 97, i32 115, i32 32, i32 109, i32 117, i32 99, i32 104, i32 32, i32 100, i32 97, i32 116, i32 97, i32 32, i32 97, i32 115, i32 32, i32 121, i32 111, i32 117, i32 32, i32 119, i32 105, i32 115, i32 104, i32 32, i32 98, i32 101, i32 108, i32 111, i32 119, i32 32, i32 40, i32 67, i32 116, i32 114, i32 108, i32 45, i32 68, i32 32, i32 116, i32 111, i32 32, i32 115, i32 116, i32 111, i32 112, i32 41, i32 10, i32 0]
@stdin = global i32 0
@.str.1 = [19 x i32] [i32 102, i32 108, i32 111, i32 111, i32 100, i32 103, i32 97, i32 116, i32 101, i32 115, i32 32, i32 99, i32 108, i32 111, i32 115, i32 101, i32 100, i32 10, i32 0]
define void @floodgates() {
%1 = call i32 @wprintf(i8* bitcast ([79 x i32]* @.str to i8*))
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* @stdin
%4 = call i64 @read_input(i32 %3, i32 0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
%8 = call i32 @wprintf(i8* bitcast ([19 x i32]* @.str.1 to i8*))
%9 = call i32 (...) @save_with_output()
ret void
}

LLVM IR (-O2):
@.str = [79 x i32] [i32 111, i32 112, i32 101, i32 110, i32 105, i32 110, i32 103, i32 32, i32 116, i32 104, i32 101, i32 32, i32 102, i32 108, i32 111, i32 111, i32 100, i32 103, i32 97, i32 116, i32 101, i32 115, i32 33, i32 32, i32 112, i32 97, i32 115, i32 116, i32 101, i32 32, i32 97, i32 115, i32 32, i32 109, i32 117, i32 99, i32 104, i32 32, i32 100, i32 97, i32 116, i32 97, i32 32, i32 97, i32 115, i32 32, i32 121, i32 111, i32 117, i32 32, i32 119, i32 105, i32 115, i32 104, i32 32, i32 98, i32 101, i32 108, i32 111, i32 119, i32 32, i32 40, i32 67, i32 116, i32 114, i32 108, i32 45, i32 68, i32 32, i32 116, i32 111, i32 32, i32 115, i32 116, i32 111, i32 112, i32 41, i32 10, i32 0]
@stdin = global i32 0
@.str.1 = [19 x i32] [i32 102, i32 108, i32 111, i32 111, i32 100, i32 103, i32 97, i32 116, i32 101, i32 115, i32 32, i32 99, i32 108, i32 111, i32 115, i32 101, i32 100, i32 10, i32 0]
define void @floodgates() {
%1 = tail call i32 @wprintf(i8* bitcast ([79 x i32]* @.str to i8*))
br label %2
2: ; preds = %2, %0
%3 = load i32, i32* @stdin
%4 = tail call i64 @read_input(i32 %3, i32 0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call i32 @wprintf(i8* bitcast ([19 x i32]* @.str.1 to i8*))
%8 = tail call i32 (...) @save_with_output()
ret void
}