#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 int __u16;

/* Variables and functions */
int EOF;
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int fromhex(int);
int getchar();
int /*<<< orphan*/ identify(int *);
scalar_t__ ishex(int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
char *strerror(int);
void identify_from_stdin(void) {
  __u16 sbuf[512];
  int err, wc = 0;
  do {
    int digit;
    int d[4];
    if (ishex(d[digit = 0] = getchar()) && ishex(d[++digit] = getchar()) &&
        ishex(d[++digit] = getchar()) && ishex(d[++digit] = getchar())) {
      sbuf[wc] = (fromhex(d[0]) << 12) | (fromhex(d[1]) << 8) |
                 (fromhex(d[2]) << 4) | fromhex(d[3]);
      ++wc;
    } else if (d[digit] == EOF) {
      goto eof;
    } else if (wc == 0) {
      while (d[digit] != '\n') {
        if (d[digit] == EOF)
          goto eof;
        d[digit = 0] = getchar();
      };
    }
  } while (wc < 256);
  putchar('\n');
  identify(sbuf);
  return;
eof:
  err = errno;
  fprintf(stderr, "read only %u/256 IDENTIFY words from stdin: %s\n", wc,
          strerror(err));
  exit(err);
}


x86 assembly (clang, -O0):
<identify_from_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
movl   $0x0,-0x808(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%edi
movl   $0x0,-0x80c(%rbp)
mov    %edi,-0x820(%rbp)
call   1040 <ishex@plt>
cmp    $0x0,%rax
je     12d2 <identify_from_stdin+0x152>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%edi
mov    -0x80c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80c(%rbp)
cltq
mov    %edi,-0x820(%rbp,%rax,4)
call   1040 <ishex@plt>
cmp    $0x0,%rax
je     12d2 <identify_from_stdin+0x152>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%edi
mov    -0x80c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80c(%rbp)
cltq
mov    %edi,-0x820(%rbp,%rax,4)
call   1040 <ishex@plt>
cmp    $0x0,%rax
je     12d2 <identify_from_stdin+0x152>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%edi
mov    -0x80c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80c(%rbp)
cltq
mov    %edi,-0x820(%rbp,%rax,4)
call   1040 <ishex@plt>
cmp    $0x0,%rax
je     12d2 <identify_from_stdin+0x152>
mov    -0x820(%rbp),%edi
call   1050 <fromhex@plt>
shl    $0xc,%eax
mov    %eax,-0x82c(%rbp)
mov    -0x81c(%rbp),%edi
call   1050 <fromhex@plt>
mov    %eax,%ecx
mov    -0x82c(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x828(%rbp)
mov    -0x818(%rbp),%edi
call   1050 <fromhex@plt>
mov    %eax,%ecx
mov    -0x828(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x824(%rbp)
mov    -0x814(%rbp),%edi
call   1050 <fromhex@plt>
mov    -0x824(%rbp),%ecx
or     %eax,%ecx
movslq -0x808(%rbp),%rax
mov    %ecx,-0x800(%rbp,%rax,4)
mov    -0x808(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x808(%rbp)
jmp    1368 <identify_from_stdin+0x1e8>
movslq -0x80c(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%eax
mov    0x2d01(%rip),%rcx
cmp    (%rcx),%eax
jne    12f4 <identify_from_stdin+0x174>
jmp    139c <identify_from_stdin+0x21c>
cmpl   $0x0,-0x808(%rbp)
jne    135e <identify_from_stdin+0x1de>
jmp    1306 <identify_from_stdin+0x186>
movslq -0x80c(%rbp),%rax
cmpl   $0xa,-0x820(%rbp,%rax,4)
0a
je     1359 <identify_from_stdin+0x1d9>
movslq -0x80c(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%eax
mov    0x2cb8(%rip),%rcx
cmp    (%rcx),%eax
jne    133d <identify_from_stdin+0x1bd>
jmp    139c <identify_from_stdin+0x21c>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x0,-0x80c(%rbp)
mov    %eax,-0x820(%rbp)
jmp    1306 <identify_from_stdin+0x186>
jmp    135e <identify_from_stdin+0x1de>
jmp    1363 <identify_from_stdin+0x1e3>
jmp    1368 <identify_from_stdin+0x1e8>
jmp    136d <identify_from_stdin+0x1ed>
cmpl   $0x100,-0x808(%rbp)
jl     1195 <identify_from_stdin+0x15>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x800(%rbp),%rdi
call   1080 <identify@plt>
add    $0x840,%rsp
pop    %rbp
ret
mov    0x2c2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x804(%rbp)
mov    0x2c26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x834(%rbp)
mov    -0x808(%rbp),%eax
mov    %eax,-0x830(%rbp)
mov    -0x804(%rbp),%edi
call   10a0 <strerror@plt>
mov    -0x834(%rbp),%edi
mov    -0x830(%rbp),%edx
mov    %rax,%rcx
lea    0xc19(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x804(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<identify_from_stdin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    0x2e50(%rip),%r12
xor    %ebx,%ebx
jmp    11fc <identify_from_stdin+0x7c>
mov    %ebp,%edi
call   1050 <fromhex@plt>
mov    %r13d,0xc(%rsp)
mov    %eax,%r13d
shl    $0xc,%r13d
mov    %r14d,%edi
call   1050 <fromhex@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r13d,%ebp
mov    %r15d,%edi
call   1050 <fromhex@plt>
mov    %eax,%r14d
shl    $0x4,%r14d
mov    0xc(%rsp),%edi
call   1050 <fromhex@plt>
or     %r14d,%eax
or     %ebp,%eax
movslq %ebx,%rbx
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
cmp    $0x100,%ebx
jge    12df <identify_from_stdin+0x15f>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <ishex@plt>
test   %rax,%rax
je     1270 <identify_from_stdin+0xf0>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1040 <ishex@plt>
test   %rax,%rax
je     1260 <identify_from_stdin+0xe0>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r15d
mov    %eax,%edi
call   1040 <ishex@plt>
test   %rax,%rax
je     1265 <identify_from_stdin+0xe5>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r13d
mov    %eax,%edi
call   1040 <ishex@plt>
test   %rax,%rax
jne    119c <identify_from_stdin+0x1c>
mov    %r13d,%ebp
jmp    1270 <identify_from_stdin+0xf0>
nopl   0x0(%rax)
mov    %r14d,%ebp
jmp    1270 <identify_from_stdin+0xf0>
mov    %r15d,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r12),%eax
cmp    %eax,%ebp
je     12aa <identify_from_stdin+0x12a>
test   %ebx,%ebx
jne    11f0 <identify_from_stdin+0x70>
xor    %ebx,%ebx
cmp    $0xa,%ebp
je     11f0 <identify_from_stdin+0x70>
cmp    %eax,%ebp
je     12a8 <identify_from_stdin+0x128>
nop
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%eax
je     11f0 <identify_from_stdin+0x70>
cmp    (%r12),%eax
jne    1290 <identify_from_stdin+0x110>
xor    %ebx,%ebx
mov    0x2d1f(%rip),%rax
mov    (%rax),%ebp
mov    0x2d1e(%rip),%rax
mov    (%rax),%r14d
mov    %ebp,%edi
call   10a0 <strerror@plt>
lea    0xd35(%rip),%rsi
mov    %r14d,%edi
mov    %ebx,%edx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    %ebp,%edi
call   1090 <exit@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
call   1080 <identify@plt>
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@errno = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"read only %u/256 IDENTIFY words from stdin: %s\0A\00"
define void @identify_from_stdin() {
%1 = alloca [512 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i32]
store i32 0, i32* %3
br label %6
6: ; preds = %92, %0
%7 = call i32 (...) @getchar()
store i32 0, i32* %4
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32 %7, i32* %8
%9 = call i64 @ishex(i32 %7)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %59
11: ; preds = %6
%12 = call i32 (...) @getchar()
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %15
store i32 %12, i32* %16
%17 = call i64 @ishex(i32 %12)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %59
19: ; preds = %11
%20 = call i32 (...) @getchar()
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %23
store i32 %20, i32* %24
%25 = call i64 @ishex(i32 %20)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %59
27: ; preds = %19
%28 = call i32 (...) @getchar()
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %31
store i32 %28, i32* %32
%33 = call i64 @ishex(i32 %28)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %59
35: ; preds = %27
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%37 = load i32, i32* %36
%38 = call i32 @fromhex(i32 %37)
%39 = shl i32 %38, 12
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
%41 = load i32, i32* %40
%42 = call i32 @fromhex(i32 %41)
%43 = shl i32 %42, 8
%44 = or i32 %39, %43
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
%46 = load i32, i32* %45
%47 = call i32 @fromhex(i32 %46)
%48 = shl i32 %47, 4
%49 = or i32 %44, %48
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
%51 = load i32, i32* %50
%52 = call i32 @fromhex(i32 %51)
%53 = or i32 %49, %52
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 %55
store i32 %53, i32* %56
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %91
59: ; preds = %27, %19, %11, %6
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %63, %64
br i1 %65, label %66, label %67
66: ; preds = %59
br label %99
67: ; preds = %59
%68 = load i32, i32* %3
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %89
70: ; preds = %67
br label %71
71: ; preds = %85, %70
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = icmp ne i32 %75, 10
br i1 %76, label %77, label %88
77: ; preds = %71
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = load i32, i32* @EOF
%83 = icmp eq i32 %81, %82
br i1 %83, label %84, label %85
84: ; preds = %77
br label %99
85: ; preds = %77
%86 = call i32 (...) @getchar()
store i32 0, i32* %4
%87 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32 %86, i32* %87
br label %71
88: ; preds = %71
br label %89
89: ; preds = %88, %67
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90, %35
br label %92
92: ; preds = %91
%93 = load i32, i32* %3
%94 = icmp slt i32 %93, 256
br i1 %94, label %6, label %95
95: ; preds = %92
%96 = call i32 @putchar(i8 signext 10)
%97 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 0
%98 = call i32 @identify(i32* %97)
ret void
99: ; preds = %84, %66
%100 = load i32, i32* @errno
store i32 %100, i32* %2
%101 = load i32, i32* @stderr
%102 = load i32, i32* %3
%103 = load i32, i32* %2
%104 = call i8* @strerror(i32 %103)
%105 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %102, i8* %104)
%106 = load i32, i32* %2
%107 = call i32 @exit(i32 %106)
unreachable
}

LLVM IR (-O2):
@EOF = global i32 0
@errno = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"read only %u/256 IDENTIFY words from stdin: %s\0A\00"
define void @identify_from_stdin() {
%1 = alloca [512 x i32]
%2 = bitcast [512 x i32]* %1 to i8*
br label %3
3: ; preds = %50, %0
%4 = phi i32 [ 0, %0 ], [ %51, %50 ]
%5 = tail call i32 (...) @getchar()
%6 = tail call i64 @ishex(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %34, label %8
8: ; preds = %3
%9 = tail call i32 (...) @getchar()
%10 = tail call i64 @ishex(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %34, label %12
12: ; preds = %8
%13 = tail call i32 (...) @getchar()
%14 = tail call i64 @ishex(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %34, label %16
16: ; preds = %12
%17 = tail call i32 (...) @getchar()
%18 = tail call i64 @ishex(i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %34, label %20
20: ; preds = %16
%21 = tail call i32 @fromhex(i32 %5)
%22 = shl i32 %21, 12
%23 = tail call i32 @fromhex(i32 %9)
%24 = shl i32 %23, 8
%25 = or i32 %24, %22
%26 = tail call i32 @fromhex(i32 %13)
%27 = shl i32 %26, 4
%28 = or i32 %25, %27
%29 = tail call i32 @fromhex(i32 %17)
%30 = or i32 %28, %29
%31 = sext i32 %4 to i64
%32 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 %31
store i32 %30, i32* %32
%33 = add nsw i32 %4, 1
br label %50
34: ; preds = %16, %12, %8, %3
%35 = phi i32 [ %17, %16 ], [ %13, %12 ], [ %9, %8 ], [ %5, %3 ]
%36 = load i32, i32* @EOF
%37 = icmp eq i32 %35, %36
br i1 %37, label %57, label %38
38: ; preds = %34
%39 = icmp eq i32 %4, 0
br i1 %39, label %40, label %50
40: ; preds = %38
%41 = icmp eq i32 %35, 10
br i1 %41, label %50, label %42
42: ; preds = %40
%43 = icmp eq i32 %35, %36
br i1 %43, label %57, label %44
44: ; preds = %42, %47
%45 = tail call i32 (...) @getchar()
%46 = icmp eq i32 %45, 10
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* @EOF
%49 = icmp eq i32 %45, %48
br i1 %49, label %57, label %44
50: ; preds = %44, %40, %38, %20
%51 = phi i32 [ %4, %38 ], [ %33, %20 ], [ 0, %40 ], [ 0, %44 ]
%52 = icmp slt i32 %51, 256
br i1 %52, label %3, label %53
53: ; preds = %50
%54 = tail call i32 @putchar(i8 signext 10)
%55 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 0
%56 = call i32 @identify(i32* %55)
ret void
57: ; preds = %34, %42, %47
%58 = phi i32 [ 0, %47 ], [ %4, %34 ], [ 0, %42 ]
%59 = load i32, i32* @errno
%60 = load i32, i32* @stderr
%61 = tail call i8* @strerror(i32 %59)
%62 = tail call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %58, i8* %61)
%63 = tail call i32 @exit(i32 %59)
unreachable
}