#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 /*<<< orphan*/ s;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(unsigned int);
int sscanf(char *, char *, unsigned int *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char s[512];
  char *p;
  int n;
  unsigned v;
  (void)argc;
  (void)argv;
  while (fgets(s, sizeof(s), stdin)) {
    if (*s == '#' || *s == 0) {
      continue;
    }
    p = s;
    while (sscanf(p, "%2x%n", &v, &n) == 1) {
      p += n;
      putchar(v);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11f9 <main+0xc9>
movsbl -0x210(%rbp),%eax
cmp    $0x23,%eax
je     118d <main+0x5d>
movsbl -0x210(%rbp),%eax
cmp    $0x0,%eax
jne    1192 <main+0x62>
jmp    1149 <main+0x19>
lea    -0x210(%rbp),%rax
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    -0x220(%rbp),%rdx
lea    -0x21c(%rbp),%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11f4 <main+0xc4>
mov    -0x21c(%rbp),%ecx
mov    -0x218(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x218(%rbp)
mov    -0x220(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x70>
jmp    1149 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    0x2ea0(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x200,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11e9 <main+0xb9>
lea    0xe93(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%r13
jmp    1195 <main+0x65>
nopl   0x0(%rax)
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0x200,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11e9 <main+0xb9>
mov    0x10(%rsp),%al
cmp    $0x23,%al
je     1180 <main+0x50>
test   %al,%al
je     1180 <main+0x50>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1180 <main+0x50>
mov    %r14,%rbx
nopw   0x0(%rax,%rax,1)
movslq 0xc(%rsp),%rax
add    %rax,%rbx
mov    0x8(%rsp),%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11c0 <main+0x90>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [6 x i8] c"%2x%n\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [512 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = load i32, i32* @stdin
%10 = call i64 @fgets(i8* %6, i32 512, i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %30, label %12
12: ; preds = %2, %14
%13 = load i8, i8* %6
switch i8 %13, label %18 [
i8 35, label %14
i8 0, label %14
]
14: ; preds = %21, %18, %12, %12
%15 = load i32, i32* @stdin
%16 = call i64 @fgets(i8* %6, i32 512, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %30, label %12
18: ; preds = %12
%19 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %4)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %14
21: ; preds = %18, %21
%22 = phi i8* [ %25, %21 ], [ %6, %18 ]
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i32, i32* %5
%27 = call i32 @putchar(i32 %26)
%28 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %4)
%29 = icmp eq i32 %28, 1
br i1 %29, label %21, label %14
30: ; preds = %14, %2
ret i32 0
}