#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*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  int l, h;
  int first = 1;
  printf("uint8_t ary[] = { ");
  while (!feof(stdin)) {
    if (scanf("%d", &h) != 1)
      break;
    if (scanf("%d", &l) != 1)
      l = 0;
    if (!first)
      printf(", ");
    printf("0x%02x", (l & 0x0f) | ((h << 4) & 0xf0));
    first = 0;
  }
  printf("};\n");
}


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   $0x1,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117e <main+0x4e>
jmp    1201 <main+0xd1>
lea    0xe8e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     119c <main+0x6c>
jmp    1201 <main+0xd1>
lea    0xe70(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11bc <main+0x8c>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11d4 <main+0xa4>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
and    $0xf,%esi
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
and    $0xf0,%eax
or     %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
jmp    115b <main+0x2b>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e88(%rip),%rbp
mov    0x0(%rbp),%edi
call   1050 <feof@plt>
test   %eax,%eax
je     1189 <main+0x49>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe83(%rip),%rbx
lea    0x4(%rsp),%r14
mov    %rsp,%r15
lea    0xe7a(%rip),%r13
xor    %r12d,%r12d
jmp    11db <main+0x9b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%eax
and    $0xf,%eax
mov    0x4(%rsp),%ecx
shl    $0x4,%ecx
movzbl %cl,%esi
or     %eax,%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
call   1050 <feof@plt>
mov    $0x1,%r12b
test   %eax,%eax
jne    116c <main+0x2c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    116c <main+0x2c>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     1202 <main+0xc2>
movl   $0x0,(%rsp)
test   $0x1,%r12b
je     11b0 <main+0x70>
lea    0xe07(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@.str = [19 x i8] c"uint8_t ary[] = { \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [7 x i8] c"0x%02x\00"
@.str.4 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %28, %2
%11 = load i32, i32* @stdin
%12 = call i32 @feof(i32 %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %36
15: ; preds = %10
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %15
br label %36
19: ; preds = %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %6
br label %23
23: ; preds = %22, %19
%24 = load i32, i32* %8
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = load i32, i32* %6
%30 = and i32 %29, 15
%31 = load i32, i32* %7
%32 = shl i32 %31, 4
%33 = and i32 %32, 240
%34 = or i32 %30, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %34)
store i32 0, i32* %8
br label %10
36: ; preds = %18, %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [19 x i8] c"uint8_t ary[] = { \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [7 x i8] c"0x%02x\00"
@str = [3 x i8] c"};\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @feof(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %2, %22
%12 = phi i1 [ true, %22 ], [ false, %2 ]
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = icmp eq i32 %16, 1
br i1 %17, label %19, label %18
18: ; preds = %15
store i32 0, i32* %3
br label %19
19: ; preds = %18, %15
br i1 %12, label %20, label %22
20: ; preds = %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %19
%23 = load i32, i32* %3
%24 = and i32 %23, 15
%25 = load i32, i32* %4
%26 = shl i32 %25, 4
%27 = and i32 %26, 240
%28 = or i32 %27, %24
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @stdin
%31 = call i32 @feof(i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %11, label %33
33: ; preds = %22, %11, %2
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}