#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 scalar_t__ i;

/* Variables and functions */
int /*<<< orphan*/ hline(int, int, int, unsigned int);
int /*<<< orphan*/ report(int);
int main(void) {
  unsigned i;
  *((unsigned long *)(0x97000000) + 0x1) = 0x00100000;
  for (i = 0; i < 256; i++)
    *(((unsigned long *)(0x97000000 + 0x400)) + (i)) =
        (((unsigned long)(256 - i) & 0xff) << 16) |
        (((unsigned long)(i)&0xff) << 8) |
        (((unsigned long)(128 ^ i) & 0xff) << 0);
  *((unsigned long *)(0x97000000) + 0x0) = 0xffffffff;
  for (i = 0; i < 16; i++) {
    hline(i, 0, i, i);
    hline(256 - i, 256 - i, 256 + i, i);
  }
  report(0xdeaddead);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x97000000,%eax
movq   $0x100000,0x8(%rax)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    11aa <main+0x8a>
mov    $0x100,%eax
sub    -0x8(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edx
and    $0xff,%rdx
shl    $0x10,%rdx
mov    -0x8(%rbp),%eax
and    $0xff,%rax
shl    $0x8,%rax
or     %rax,%rdx
mov    -0x8(%rbp),%eax
xor    $0x80,%eax
mov    %eax,%eax
and    $0xff,%rax
shl    $0x0,%rax
or     %rax,%rdx
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    $0x97000400,%eax
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1143 <main+0x23>
mov    $0x97000000,%eax
mov    $0xffffffff,%ecx
mov    %rcx,(%rax)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jae    1207 <main+0xe7>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
call   1040 <hline@plt>
mov    $0x100,%edi
sub    -0x8(%rbp),%edi
mov    $0x100,%esi
sub    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x100,%edx
mov    -0x8(%rbp),%ecx
call   1040 <hline@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11be <main+0x9e>
mov    $0xdeaddead,%edi
call   1030 <report@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x97000410,%eax
movq   $0x100000,-0x408(%rax)
movdqa 0xec5(%rip),%xmm5
xor    %ecx,%ecx
movdqa 0xeca(%rip),%xmm8
movdqa 0xed1(%rip),%xmm11
movdqa 0xed8(%rip),%xmm9
movdqa 0xedf(%rip),%xmm12
movdqa 0xee6(%rip),%xmm13
movdqa 0xeee(%rip),%xmm6
movdqa 0xef5(%rip),%xmm10
nopl   0x0(%rax,%rax,1)
movdqa %xmm5,%xmm0
paddq  %xmm8,%xmm0
movdqa %xmm5,%xmm7
pmuludq %xmm11,%xmm7
movdqa %xmm5,%xmm1
psrlq  $0x20,%xmm1
pmuludq %xmm11,%xmm1
psllq  $0x20,%xmm1
paddq  %xmm7,%xmm1
movdqa %xmm1,%xmm7
paddq  %xmm9,%xmm7
pand   %xmm12,%xmm1
pand   %xmm12,%xmm7
movdqa %xmm5,%xmm3
psllq  $0x8,%xmm3
movdqa %xmm0,%xmm4
psllq  $0x8,%xmm4
movdqa %xmm5,%xmm2
pand   %xmm13,%xmm2
por    %xmm3,%xmm2
por    %xmm1,%xmm2
pand   %xmm13,%xmm0
por    %xmm4,%xmm0
por    %xmm7,%xmm0
pxor   %xmm6,%xmm2
pxor   %xmm6,%xmm0
movdqa %xmm2,-0x10(%rax,%rcx,8)
movdqa %xmm0,(%rax,%rcx,8)
add    $0x4,%rcx
paddq  %xmm10,%xmm5
cmp    $0x100,%rcx
jne    1180 <main+0x60>
lea    0x68fffbef(%rax),%rcx
mov    %rcx,-0x410(%rax)
xor    %ebx,%ebx
mov    $0x100,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
call   1040 <hline@plt>
lea    0x100(%rbx),%edx
mov    %ebp,%edi
mov    %ebp,%esi
mov    %ebx,%ecx
call   1040 <hline@plt>
add    $0xffffffff,%ebp
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1230 <main+0x110>
mov    $0xdeaddead,%edi
call   1030 <report@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i64 1048576, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2533359616 to i64*), i64 1)
store i32 0, i32* %2
br label %3
3: ; preds = %26, %0
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, 256
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sub i32 256, %7
%9 = zext i32 %8 to i64
%10 = and i64 %9, 255
%11 = shl i64 %10, 16
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = and i64 %13, 255
%15 = shl i64 %14, 8
%16 = or i64 %11, %15
%17 = load i32, i32* %2
%18 = xor i32 128, %17
%19 = zext i32 %18 to i64
%20 = and i64 %19, 255
%21 = shl i64 %20, 0
%22 = or i64 %16, %21
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* inttoptr (i64 2533360640 to i64*), i64 %24
store i64 %22, i64* %25
br label %26
26: ; preds = %6
%27 = load i32, i32* %2
%28 = add i32 %27, 1
store i32 %28, i32* %2
br label %3
29: ; preds = %3
store i64 4294967295, i64* inttoptr (i64 2533359616 to i64*)
store i32 0, i32* %2
br label %30
30: ; preds = %46, %29
%31 = load i32, i32* %2
%32 = icmp ult i32 %31, 16
br i1 %32, label %33, label %49
33: ; preds = %30
%34 = load i32, i32* %2
%35 = load i32, i32* %2
%36 = load i32, i32* %2
%37 = call i32 @hline(i32 %34, i32 0, i32 %35, i32 %36)
%38 = load i32, i32* %2
%39 = sub i32 256, %38
%40 = load i32, i32* %2
%41 = sub i32 256, %40
%42 = load i32, i32* %2
%43 = add i32 256, %42
%44 = load i32, i32* %2
%45 = call i32 @hline(i32 %39, i32 %41, i32 %43, i32 %44)
br label %46
46: ; preds = %33
%47 = load i32, i32* %2
%48 = add i32 %47, 1
store i32 %48, i32* %2
br label %30
49: ; preds = %30
%50 = call i32 @report(i32 -559030611)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
store i64 1048576, i64* inttoptr (i64 2533359624 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %23, %1 ]
%3 = phi <2 x i64> [ <i64 0, i64 1>, %0 ], [ %24, %1 ]
%4 = add <2 x i64> %3, <i64 2, i64 2>
%5 = mul <2 x i64> %3, <i64 4294901760, i64 4294901760>
%6 = mul <2 x i64> %4, <i64 4294901760, i64 4294901760>
%7 = and <2 x i64> %5, <i64 16711680, i64 16711680>
%8 = and <2 x i64> %6, <i64 16711680, i64 16711680>
%9 = shl nuw nsw <2 x i64> %3, <i64 8, i64 8>
%10 = shl nuw nsw <2 x i64> %4, <i64 8, i64 8>
%11 = and <2 x i64> %3, <i64 4294967295, i64 4294967295>
%12 = and <2 x i64> %4, <i64 4294967295, i64 4294967295>
%13 = or <2 x i64> %7, %11
%14 = or <2 x i64> %8, %12
%15 = or <2 x i64> %13, %9
%16 = or <2 x i64> %14, %10
%17 = xor <2 x i64> %15, <i64 128, i64 128>
%18 = xor <2 x i64> %16, <i64 128, i64 128>
%19 = getelementptr inbounds i64, i64* inttoptr (i64 2533360640 to i64*), i64 %2
%20 = bitcast i64* %19 to <2 x i64>*
store <2 x i64> %17, <2 x i64>* %20
%21 = getelementptr inbounds i64, i64* %19, i64 2
%22 = bitcast i64* %21 to <2 x i64>*
store <2 x i64> %18, <2 x i64>* %22
%23 = add nuw i64 %2, 4
%24 = add <2 x i64> %3, <i64 4, i64 4>
%25 = icmp eq i64 %23, 256
br i1 %25, label %26, label %1
26: ; preds = %1
store i64 4294967295, i64* inttoptr (i64 2533359616 to i64*)
br label %27
27: ; preds = %26, %27
%28 = phi i32 [ 0, %26 ], [ %33, %27 ]
%29 = tail call i32 @hline(i32 %28, i32 0, i32 %28, i32 %28)
%30 = sub nuw nsw i32 256, %28
%31 = add nuw nsw i32 %28, 256
%32 = tail call i32 @hline(i32 %30, i32 %30, i32 %31, i32 %28)
%33 = add nuw nsw i32 %28, 1
%34 = icmp eq i32 %33, 16
br i1 %34, label %35, label %27
35: ; preds = %27
%36 = tail call i32 @report(i32 -559030611)
ret i32 0
}