#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 fread(unsigned char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int i, j;
  unsigned char temp;
  for (i = 0; i < 128; i++) {
    for (j = 0; j < 16; j++) {
      if (fread(&temp, 1, 1, stdin) < 1)
        return -1;
      if (j < 8) {
        fwrite(&temp, 1, 1, stdout);
        fwrite(&temp, 1, 1, stdout);
      }
    }
  }
  return 0;
}


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)
cmpl   $0x80,-0x14(%rbp)
jge    11eb <main+0xcb>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    11d8 <main+0xb8>
mov    0x2e86(%rip),%rax
mov    (%rax),%ecx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jge    1189 <main+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f2 <main+0xd2>
cmpl   $0x8,-0x18(%rbp)
jge    11c5 <main+0xa5>
mov    0x2e3e(%rip),%rax
mov    (%rax),%ecx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fwrite@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%ecx
lea    -0x19(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fwrite@plt>
jmp    11ca <main+0xaa>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <main+0x31>
jmp    11dd <main+0xbd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %r14d,%r14d
mov    0x2eb2(%rip),%r15
lea    0xf(%rsp),%rbx
mov    0x2e96(%rip),%r12
xor    %ebp,%ebp
jmp    1158 <main+0x38>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x10,%ebp
je     11b0 <main+0x90>
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
test   %eax,%eax
jle    11c1 <main+0xa1>
cmp    $0x7,%ebp
ja     1150 <main+0x30>
mov    (%r12),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    (%r12),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
jmp    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14d
cmp    $0x80,%r14d
jne    1142 <main+0x22>
xor    %eax,%eax
jmp    11c6 <main+0xa6>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %34, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 128
br i1 %11, label %12, label %37
12: ; preds = %9
store i32 0, i32* %7
br label %13
13: ; preds = %30, %12
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 16
br i1 %15, label %16, label %33
16: ; preds = %13
%17 = load i32, i32* @stdin
%18 = call i32 @fread(i8* %8, i32 1, i32 1, i32 %17)
%19 = icmp slt i32 %18, 1
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 -1, i32* %3
br label %38
21: ; preds = %16
%22 = load i32, i32* %7
%23 = icmp slt i32 %22, 8
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* @stdout
%26 = call i32 @fwrite(i8* %8, i32 1, i32 1, i32 %25)
%27 = load i32, i32* @stdout
%28 = call i32 @fwrite(i8* %8, i32 1, i32 1, i32 %27)
br label %29
29: ; preds = %24, %21
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %13
33: ; preds = %13
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %9
37: ; preds = %9
store i32 0, i32* %3
br label %38
38: ; preds = %37, %20
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
br label %4
4: ; preds = %2, %21
%5 = phi i32 [ 0, %2 ], [ %22, %21 ]
br label %6
6: ; preds = %4, %18
%7 = phi i32 [ 0, %4 ], [ %19, %18 ]
%8 = load i32, i32* @stdin
%9 = call i32 @fread(i8* %3, i32 1, i32 1, i32 %8)
%10 = icmp slt i32 %9, 1
br i1 %10, label %24, label %11
11: ; preds = %6
%12 = icmp ult i32 %7, 8
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = load i32, i32* @stdout
%15 = call i32 @fwrite(i8* %3, i32 1, i32 1, i32 %14)
%16 = load i32, i32* @stdout
%17 = call i32 @fwrite(i8* %3, i32 1, i32 1, i32 %16)
br label %18
18: ; preds = %11, %13
%19 = add nuw nsw i32 %7, 1
%20 = icmp eq i32 %19, 16
br i1 %20, label %21, label %6
21: ; preds = %18
%22 = add nuw nsw i32 %5, 1
%23 = icmp eq i32 %22, 128
br i1 %23, label %24, label %4
24: ; preds = %21, %6
%25 = phi i32 [ -1, %6 ], [ 0, %21 ]
ret i32 %25
}