#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*/ Test_Lcd_Tft_16Bit_240320();
int /*<<< orphan*/ Test_Lcd_Tft_16Bit_640480();
int /*<<< orphan*/ Test_Lcd_Tft_8Bit_240320();
int /*<<< orphan*/ Test_Lcd_Tft_8Bit_640480();
char getc();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ uart0_init();
int main() {
  char c;
  uart0_init();
  while (1) {
    printf("\r\n##### Test TFT LCD #####\r\n");
    printf("[1] TFT240320 8Bit\n\r");
    printf("[2] TFT240320 16Bit\n\r");
    printf("[3] TFT640480 8Bit\n\r");
    printf("[4] TFT640480 16Bit\n\r");
    printf("Enter your selection: ");
    c = getc();
    printf("%c\n\r", c);
    switch (c) {
    case '1': {
      Test_Lcd_Tft_8Bit_240320();
      break;
    }
    case '2': {
      Test_Lcd_Tft_16Bit_240320();
      break;
    }
    case '3': {
      Test_Lcd_Tft_8Bit_640480();
      break;
    }
    case '4': {
      Test_Lcd_Tft_16Bit_640480();
      break;
    }
    default:
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <uart0_init@plt>
lea    0xe83(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe8c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xea6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
call   1080 <getc@plt>
mov    %al,%cl
mov    -0x11(%rbp),%al
mov    %cl,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     125c <main+0xec>
mov    -0x10(%rbp),%rax
lea    0xddd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <Test_Lcd_Tft_8Bit_240320@plt>
jmp    1261 <main+0xf1>
mov    $0x0,%al
call   1060 <Test_Lcd_Tft_16Bit_240320@plt>
jmp    1261 <main+0xf1>
mov    $0x0,%al
call   1090 <Test_Lcd_Tft_8Bit_640480@plt>
jmp    1261 <main+0xf1>
mov    $0x0,%al
call   1040 <Test_Lcd_Tft_16Bit_640480@plt>
jmp    1261 <main+0xf1>
jmp    1261 <main+0xf1>
jmp    1186 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <uart0_init@plt>
lea    0xea2(%rip),%r13
lea    0xeb0(%rip),%rbx
lea    0xebf(%rip),%rbp
lea    0xecf(%rip),%r14
lea    0xe4b(%rip),%r12
jmp    11d0 <main+0x50>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <Test_Lcd_Tft_16Bit_640480@plt>
nopw   0x0(%rax,%rax,1)
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1090 <getc@plt>
movsbl %al,%r15d
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffcf,%r15d
cmp    $0x3,%r15d
ja     11d0 <main+0x50>
movslq (%r12,%r15,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <Test_Lcd_Tft_8Bit_240320@plt>
jmp    11d0 <main+0x50>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <Test_Lcd_Tft_16Bit_240320@plt>
jmp    11d0 <main+0x50>
nopl   0x0(%rax)
xor    %eax,%eax
call   10a0 <Test_Lcd_Tft_8Bit_640480@plt>
jmp    11d0 <main+0x50>

LLVM IR (-O0):
@.str = [29 x i8] c"\0D\0A##### Test TFT LCD #####\0D\0A\00"
@.str.1 = [21 x i8] c"[1] TFT240320 8Bit\0A\0D\00"
@.str.2 = [22 x i8] c"[2] TFT240320 16Bit\0A\0D\00"
@.str.3 = [21 x i8] c"[3] TFT640480 8Bit\0A\0D\00"
@.str.4 = [22 x i8] c"[4] TFT640480 16Bit\0A\0D\00"
@.str.5 = [23 x i8] c"Enter your selection: \00"
@.str.6 = [5 x i8] c"%c\0A\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @uart0_init()
br label %4
4: ; preds = %0, %26
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%11 = call signext i8 (...) @getc()
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
switch i32 %16, label %25 [
i32 49, label %17
i32 50, label %19
i32 51, label %21
i32 52, label %23
]
17: ; preds = %4
%18 = call i32 (...) @Test_Lcd_Tft_8Bit_240320()
br label %26
19: ; preds = %4
%20 = call i32 (...) @Test_Lcd_Tft_16Bit_240320()
br label %26
21: ; preds = %4
%22 = call i32 (...) @Test_Lcd_Tft_8Bit_640480()
br label %26
23: ; preds = %4
%24 = call i32 (...) @Test_Lcd_Tft_16Bit_640480()
br label %26
25: ; preds = %4
br label %26
26: ; preds = %25, %23, %21, %19, %17
br label %4
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"[1] TFT240320 8Bit\0A\0D\00"
@.str.2 = [22 x i8] c"[2] TFT240320 16Bit\0A\0D\00"
@.str.3 = [21 x i8] c"[3] TFT640480 8Bit\0A\0D\00"
@.str.4 = [22 x i8] c"[4] TFT640480 16Bit\0A\0D\00"
@.str.5 = [23 x i8] c"Enter your selection: \00"
@.str.6 = [5 x i8] c"%c\0A\0D\00"
@str = [28 x i8] c"\0D\0A##### Test TFT LCD #####\0D\00"
define i32 @main() {
%1 = tail call i32 (...) @uart0_init()
br label %2
2: ; preds = %12, %0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call signext i8 (...) @getc()
%10 = sext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %10)
switch i32 %10, label %12 [
i32 49, label %13
i32 50, label %15
i32 51, label %17
i32 52, label %19
]
12: ; preds = %2, %19, %17, %15, %13
br label %2
13: ; preds = %2
%14 = tail call i32 (...) @Test_Lcd_Tft_8Bit_240320()
br label %12
15: ; preds = %2
%16 = tail call i32 (...) @Test_Lcd_Tft_16Bit_240320()
br label %12
17: ; preds = %2
%18 = tail call i32 (...) @Test_Lcd_Tft_8Bit_640480()
br label %12
19: ; preds = %2
%20 = tail call i32 (...) @Test_Lcd_Tft_16Bit_640480()
br label %12
}