#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*/ CheckSum(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int bit;
  printf("1. 8-bit, 2. 12-bit, 3. 16-bit\n");
  printf("Choice?: ");
  scanf("%d", &bit);
  switch (bit) {
  case 1:
    CheckSum(8);
    break;
  case 2:
    CheckSum(12);
    break;
  case 3:
    CheckSum(16);
    break;
  default:
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     119d <main+0x6d>
jmp    117b <main+0x4b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11ac <main+0x7c>
jmp    118c <main+0x5c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11bb <main+0x8b>
jmp    11ca <main+0x9a>
mov    $0x8,%edi
call   1040 <CheckSum@plt>
jmp    11d6 <main+0xa6>
mov    $0xc,%edi
call   1040 <CheckSum@plt>
jmp    11d6 <main+0xa6>
mov    $0x10,%edi
call   1040 <CheckSum@plt>
jmp    11d6 <main+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11dd <main+0xad>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
ja     1182 <main+0x42>
lea    0x8(,%rax,4),%edi
call   1050 <CheckSum@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"1. 8-bit, 2. 12-bit, 3. 16-bit\0A\00"
@.str.1 = [10 x i8] c"Choice?: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %13 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
]
7: ; preds = %0
%8 = call i32 @CheckSum(i32 8)
br label %14
9: ; preds = %0
%10 = call i32 @CheckSum(i32 12)
br label %14
11: ; preds = %0
%12 = call i32 @CheckSum(i32 16)
br label %14
13: ; preds = %0
store i32 0, i32* %1
br label %15
14: ; preds = %11, %9, %7
store i32 0, i32* %1
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"Choice?: \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [31 x i8] c"1. 8-bit, 2. 12-bit, 3. 16-bit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -1
%8 = icmp ult i32 %7, 3
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = shl i32 %7, 2
%11 = add i32 %10, 8
%12 = call i32 @CheckSum(i32 %11)
br label %13
13: ; preds = %0, %9
ret i32 0
}