#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 /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ isxdigit(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(void) {
  int len = 0;
  int i = 0;
  char text[256] = {'\0'};
  fgets(text, 256, stdin);
  len = strlen(text);
  if (text[len - 1] == '\n') {
    text[len - 1] = '\0';
  }
  len = strlen(text);
  for (i = 0; i < len; i++) {
    if (!isxdigit(text[i])) {
      printf("Not Hexadecimal.\n");
      return 0;
    }
  }
  printf("Hexadecimal.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e57(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1060 <fgets@plt>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    11d5 <main+0x85>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    123c <main+0xec>
movslq -0xc(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%edi
ff
call   1070 <isxdigit@plt>
cmp    $0x0,%eax
jne    1229 <main+0xd9>
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124f <main+0xff>
jmp    122e <main+0xde>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11eb <main+0x9b>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x2e29(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    11e7 <main+0xa7>
movb   $0x0,-0x1(%rsp,%rax,1)
mov    %rsp,%rdi
call   1040 <strlen@plt>
lea    0xe0e(%rip),%r14
test   %eax,%eax
jle    122b <main+0xeb>
mov    %eax,%r15d
xor    %ebx,%ebx
lea    0xdfa(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1228 <main+0xe8>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1210 <main+0xd0>
jmp    122b <main+0xeb>
mov    %r12,%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [18 x i8] c"Not Hexadecimal.\0A\00"
@.str.1 = [14 x i8] c"Hexadecimal.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [256 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = bitcast [256 x i8]* %4 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 256, i32 %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %23
18: ; preds = %0
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %18, %0
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %2
store i32 0, i32* %3
br label %26
26: ; preds = %40, %23
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %43
30: ; preds = %26
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = call i32 @isxdigit(i8 signext %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %30
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %45
39: ; preds = %30
br label %40
40: ; preds = %39
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %26
43: ; preds = %26
%44 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %45
45: ; preds = %43, %37
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@stdin = global i32 0
@str = [13 x i8] c"Hexadecimal.\00"
@str.2 = [17 x i8] c"Not Hexadecimal.\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 256, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %0
store i8 0, i8* %8
br label %12
12: ; preds = %11, %0
%13 = call i32 @strlen(i8* %2)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = zext i32 %13 to i64
br label %19
17: ; preds = %19
%18 = icmp eq i64 %25, %16
br i1 %18, label %26, label %19
19: ; preds = %15, %17
%20 = phi i64 [ 0, %15 ], [ %25, %17 ]
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @isxdigit(i8 signext %22)
%24 = icmp eq i32 %23, 0
%25 = add nuw nsw i64 %20, 1
br i1 %24, label %26, label %17
26: ; preds = %17, %19, %12
%27 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0), %19 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %17 ]
%28 = call i32 @puts(i8* dereferenceable(1) %27)
ret i32 0
}