#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 */
unsigned char getc();
scalar_t__ isDigit(unsigned char);
scalar_t__ isLetter(unsigned char);
int /*<<< orphan*/ putc(unsigned char);
int /*<<< orphan*/ uart0_init();
int main() {
  unsigned char c;
  uart0_init();
  putc('T');
  putc('e');
  putc('s');
  putc('t');
  putc(':');
  putc('\n');
  putc('\r');
  while (1) {
    c = getc();
    if (isDigit(c) || isLetter(c))
      putc(c + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <uart0_init@plt>
mov    $0x54,%edi
call   1040 <putc@plt>
mov    $0x65,%edi
call   1040 <putc@plt>
mov    $0x73,%edi
call   1040 <putc@plt>
mov    $0x74,%edi
call   1040 <putc@plt>
mov    $0x3a,%edi
call   1040 <putc@plt>
mov    $0xa,%edi
call   1040 <putc@plt>
mov    $0xd,%edi
call   1040 <putc@plt>
mov    $0x0,%al
call   1060 <getc@plt>
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%edi
call   1050 <isDigit@plt>
cmp    $0x0,%rax
jne    11dc <main+0x8c>
movzbl -0x5(%rbp),%edi
call   1070 <isLetter@plt>
cmp    $0x0,%rax
je     11eb <main+0x9b>
movzbl -0x5(%rbp),%eax
add    $0x1,%eax
movzbl %al,%edi
call   1040 <putc@plt>
jmp    11ac <main+0x5c>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <uart0_init@plt>
mov    $0x54,%edi
call   1040 <putc@plt>
mov    $0x65,%edi
call   1040 <putc@plt>
mov    $0x73,%edi
call   1040 <putc@plt>
mov    $0x74,%edi
call   1040 <putc@plt>
mov    $0x3a,%edi
call   1040 <putc@plt>
mov    $0xa,%edi
call   1040 <putc@plt>
mov    $0xd,%bl
jmp    11a3 <main+0x53>
nopw   0x0(%rax,%rax,1)
add    $0x1,%bl
movzbl %bl,%edi
call   1040 <putc@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getc@plt>
mov    %eax,%ebx
movzbl %al,%ebp
mov    %ebp,%edi
call   1050 <isDigit@plt>
test   %rax,%rax
jne    11a0 <main+0x50>
mov    %ebp,%edi
call   1070 <isLetter@plt>
test   %rax,%rax
je     11b0 <main+0x60>
jmp    11a0 <main+0x50>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @uart0_init()
%4 = call i32 @putc(i8 zeroext 84)
%5 = call i32 @putc(i8 zeroext 101)
%6 = call i32 @putc(i8 zeroext 115)
%7 = call i32 @putc(i8 zeroext 116)
%8 = call i32 @putc(i8 zeroext 58)
%9 = call i32 @putc(i8 zeroext 10)
%10 = call i32 @putc(i8 zeroext 13)
br label %11
11: ; preds = %0, %26
%12 = call zeroext i8 (...) @getc()
store i8 %12, i8* %2
%13 = load i8, i8* %2
%14 = call i64 @isDigit(i8 zeroext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = load i8, i8* %2
%18 = call i64 @isLetter(i8 zeroext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %16, %11
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = add nsw i32 %22, 1
%24 = trunc i32 %23 to i8
%25 = call i32 @putc(i8 zeroext %24)
br label %26
26: ; preds = %20, %16
br label %11
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @uart0_init()
%2 = tail call i32 @putc(i8 zeroext 84)
%3 = tail call i32 @putc(i8 zeroext 101)
%4 = tail call i32 @putc(i8 zeroext 115)
%5 = tail call i32 @putc(i8 zeroext 116)
%6 = tail call i32 @putc(i8 zeroext 58)
%7 = tail call i32 @putc(i8 zeroext 10)
br label %8
8: ; preds = %0, %18
%9 = phi i8 [ %19, %18 ], [ 13, %0 ]
%10 = tail call i32 @putc(i8 zeroext %9)
br label %11
11: ; preds = %8, %15
%12 = tail call zeroext i8 (...) @getc()
%13 = tail call i64 @isDigit(i8 zeroext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = tail call i64 @isLetter(i8 zeroext %12)
%17 = icmp eq i64 %16, 0
br i1 %17, label %11, label %18
18: ; preds = %15, %11
%19 = add i8 %12, 1
br label %8
}