#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 char uint32_t;
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ errno;
scalar_t__ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int rv = 0;
  uint32_t a = 0xbb48e941;
  uint32_t b = 0;
  for (;;) {
    a += '\0';
    a += (a << 10);
    a ^= (a >> 6);
    b = a + (a << 3);
    b ^= (b >> 11);
    b += (b << 15);
    if (fwrite(&b, sizeof(b), 1, stdout) != 1) {
      if (feof(stdout)) {
        fprintf(stderr, "*** Error: fwrite: Unexpected EOF.\n");
      } else {
        fprintf(stderr, "*** Error: fwrite: %s\n", strerror(errno));
      }
      rv = 1;
      break;
    }
  }
  return rv;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x41,-0x15(%rbp)
movb   $0x0,-0x16(%rbp)
movsbl -0x15(%rbp),%eax
add    $0x0,%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%ecx
shl    $0xa,%ecx
movsbl -0x15(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%ecx
sar    $0x6,%ecx
movsbl -0x15(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
movsbl -0x15(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    %al,-0x16(%rbp)
movsbl -0x16(%rbp),%ecx
sar    $0xb,%ecx
movsbl -0x16(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x16(%rbp)
movsbl -0x16(%rbp),%ecx
shl    $0xf,%ecx
movsbl -0x16(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x16(%rbp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%ecx
lea    -0x16(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <fwrite@plt>
cmp    $0x1,%eax
je     124f <main+0x10f>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1215 <main+0xd5>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
lea    0xdf7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1243 <main+0x103>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xde8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1254 <main+0x114>
jmp    1165 <main+0x25>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x41,%ebp
mov    0x2e7c(%rip),%r14
lea    0xf(%rsp),%rbx
nopl   0x0(%rax)
mov    %ebp,%eax
sar    $0x6,%eax
xor    %eax,%ebp
mov    %ebp,%eax
shl    $0x18,%eax
lea    (%rax,%rax,8),%eax
mov    %eax,%ecx
sar    $0x1f,%ecx
shr    $0x18,%eax
xor    %ecx,%eax
mov    %al,0xf(%rsp)
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
cmp    $0x1,%eax
je     1160 <main+0x20>
mov    (%r14),%edi
call   1040 <feof@plt>
mov    0x2e3a(%rip),%rcx
mov    (%rcx),%ebx
test   %rax,%rax
je     11bf <main+0x7f>
lea    0xe4c(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11e0 <main+0xa0>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe50(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"*** Error: fwrite: Unexpected EOF.\0A\00"
@.str.1 = [23 x i8] c"*** Error: fwrite: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8 65, i8* %7
store i8 0, i8* %8
br label %9
9: ; preds = %65, %2
%10 = load i8, i8* %7
%11 = sext i8 %10 to i32
%12 = add nsw i32 %11, 0
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = sext i8 %14 to i32
%16 = shl i32 %15, 10
%17 = load i8, i8* %7
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, %16
%20 = trunc i32 %19 to i8
store i8 %20, i8* %7
%21 = load i8, i8* %7
%22 = sext i8 %21 to i32
%23 = ashr i32 %22, 6
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = xor i32 %25, %23
%27 = trunc i32 %26 to i8
store i8 %27, i8* %7
%28 = load i8, i8* %7
%29 = sext i8 %28 to i32
%30 = load i8, i8* %7
%31 = sext i8 %30 to i32
%32 = shl i32 %31, 3
%33 = add nsw i32 %29, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %8
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = ashr i32 %36, 11
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = xor i32 %39, %37
%41 = trunc i32 %40 to i8
store i8 %41, i8* %8
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = shl i32 %43, 15
%45 = load i8, i8* %8
%46 = sext i8 %45 to i32
%47 = add nsw i32 %46, %44
%48 = trunc i32 %47 to i8
store i8 %48, i8* %8
%49 = load i32, i32* @stdout
%50 = call i32 @fwrite(i8* %8, i32 1, i32 1, i32 %49)
%51 = icmp ne i32 %50, 1
br i1 %51, label %52, label %65
52: ; preds = %9
%53 = load i32, i32* @stdout
%54 = call i64 @feof(i32 %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %64
59: ; preds = %52
%60 = load i32, i32* @stderr
%61 = load i32, i32* @errno
%62 = call i8* @strerror(i32 %61)
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %59, %56
store i32 1, i32* %6
br label %66
65: ; preds = %9
br label %9
66: ; preds = %64
%67 = load i32, i32* %6
ret i32 %67
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"*** Error: fwrite: Unexpected EOF.\0A\00"
@.str.1 = [23 x i8] c"*** Error: fwrite: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 65, %2 ], [ %7, %4 ]
%6 = ashr i32 %5, 6
%7 = xor i32 %6, %5
%8 = mul i32 %7, 150994944
%9 = ashr i32 %8, 31
%10 = lshr exact i32 %8, 24
%11 = xor i32 %9, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
%13 = load i32, i32* @stdout
%14 = call i32 @fwrite(i8* %3, i32 1, i32 1, i32 %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %4, label %16
16: ; preds = %4
%17 = load i32, i32* @stdout
%18 = call i64 @feof(i32 %17)
%19 = icmp eq i64 %18, 0
%20 = load i32, i32* @stderr
br i1 %19, label %23, label %21
21: ; preds = %16
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %27
23: ; preds = %16
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %23, %21
ret i32 1
}