#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 */
char EOF;
int /*<<< orphan*/ digest();
int /*<<< orphan*/ feedByteSHA256(int /*<<< orphan*/, int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ hexChars2Byte(char, char);
int /*<<< orphan*/ initSHA256();
int main(int argc, char *argv[]) {
  char hexh;
  char hexl;
  initSHA256();
  while ((hexh = getchar()) != EOF) {
    if (hexh == '\n') {
      digest();
      continue;
    }
    hexl = getchar();
    feedByteSHA256(hexChars2Byte(hexh, hexl), 0);
  }
  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)
mov    $0x0,%al
call   1040 <initSHA256@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e67(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11cc <main+0x7c>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11a5 <main+0x55>
mov    $0x0,%al
call   1050 <digest@plt>
jmp    116d <main+0x1d>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x12(%rbp)
mov    -0x11(%rbp),%al
movsbl %al,%edi
movsbl -0x12(%rbp),%esi
call   1030 <hexChars2Byte@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1070 <feedByteSHA256@plt>
jmp    116d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initSHA256@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7f(%rip),%r14
cmp    (%r14),%al
jne    1178 <main+0x28>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1193 <main+0x43>
nopl   0x0(%rax)
call   1050 <digest@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     116e <main+0x1e>
xor    %eax,%eax
cmp    $0xa,%bl
je     1180 <main+0x30>
call   1060 <getchar@plt>
movsbl %bl,%edi
movsbl %al,%esi
call   1030 <hexChars2Byte@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1070 <feedByteSHA256@plt>
jmp    1185 <main+0x35>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @initSHA256()
br label %9
9: ; preds = %21, %19, %2
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %27
15: ; preds = %9
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (...) @digest()
br label %9
21: ; preds = %15
%22 = call signext i8 (...) @getchar()
store i8 %22, i8* %7
%23 = load i8, i8* %6
%24 = load i8, i8* %7
%25 = call i32 @hexChars2Byte(i8 signext %23, i8 signext %24)
%26 = call i32 @feedByteSHA256(i32 %25, i32 0)
br label %9
27: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initSHA256()
%4 = tail call signext i8 (...) @getchar()
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %20, label %7
7: ; preds = %2, %12
%8 = phi i8 [ %13, %12 ], [ %4, %2 ]
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = tail call i32 (...) @digest()
br label %12
12: ; preds = %10, %16
%13 = tail call signext i8 (...) @getchar()
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %20, label %7
16: ; preds = %7
%17 = tail call signext i8 (...) @getchar()
%18 = tail call i32 @hexChars2Byte(i8 signext %8, i8 signext %17)
%19 = tail call i32 @feedByteSHA256(i32 %18, i32 0)
br label %12
20: ; preds = %12, %2
ret i32 0
}