#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*/ printf(char *, ...);
int main() {
  char nilai = 'C';
  int level = 10;
  printf("Nilai: %c\n", nilai);
  switch (nilai) {
  case 'A':
    printf("Sempurna, baik sekali!\n");
    break;
  case 'B':
    printf("Baik!\n");
    break;
  case 'C':
    switch (level) {
    case 10:
      printf("level 10");
      break;
    case 15:
      printf("level 15");
      break;
    case 20:
      printf("level 20");
      break;
    }
    break;
  case 'D':
  case 'E':
    printf("Tidak bagus dan tidak lulus\n");
    break;
  default:
    printf("Nilai tidak tersedia\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x43,-0x5(%rbp)
movl   $0xa,-0xc(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     120e <main+0xfe>
mov    -0x18(%rbp),%rax
lea    0xea3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0x10c>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0x10c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0xa,%eax
je     11c2 <main+0xb2>
jmp    11a0 <main+0x90>
mov    -0x1c(%rbp),%eax
sub    $0xf,%eax
je     11d5 <main+0xc5>
jmp    11b1 <main+0xa1>
mov    -0x1c(%rbp),%eax
sub    $0x14,%eax
je     11e8 <main+0xd8>
jmp    11f6 <main+0xe6>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <main+0xe6>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <main+0xe6>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0x10c>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0x10c>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x43,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Nilai: %c\0A\00"
@.str.1 = [24 x i8] c"Sempurna, baik sekali!\0A\00"
@.str.2 = [7 x i8] c"Baik!\0A\00"
@.str.3 = [9 x i8] c"level 10\00"
@.str.4 = [9 x i8] c"level 15\00"
@.str.5 = [9 x i8] c"level 20\00"
@.str.6 = [29 x i8] c"Tidak bagus dan tidak lulus\0A\00"
@.str.7 = [22 x i8] c"Nilai tidak tersedia\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 67, i8* %2
store i32 10, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
switch i32 %8, label %24 [
i32 65, label %9
i32 66, label %11
i32 67, label %13
i32 68, label %22
i32 69, label %22
]
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %26
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %26
13: ; preds = %0
%14 = load i32, i32* %3
switch i32 %14, label %21 [
i32 10, label %15
i32 15, label %17
i32 20, label %19
]
15: ; preds = %13
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %21
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %21
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %13, %19, %17, %15
br label %26
22: ; preds = %0, %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %26
24: ; preds = %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
br label %26
26: ; preds = %24, %22, %21, %11, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Nilai: %c\0A\00"
@.str.3 = [9 x i8] c"level 10\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 67)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}