#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 /*<<< orphan*/ scanf(char *, char *);
main() {
  char stat;
  printf("Please input marriage status\n(S=single, M=married, W=widowed, "
         "E=separated, D=divorced):");
  scanf("%c", &stat);
  switch (stat) {
  case 'S':
  case 's':
    printf("You are Single.");
    break;
  case 'M':
  case 'm':
    printf("You are Married.");
    break;
  case 'W':
  case 'w':
    printf("You are Widdowed.");
    break;
  case 'E':
  case 'e':
    printf("You are Separated.");
    break;
  case 'D':
  case 'd':
    printf("You are Divorced");
    break;
  default:
    printf("Invalid input.");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xfe6(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x33,%eax
ja     11ca <main+0xaa>
mov    -0x10(%rbp),%rax
lea    0xe94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xfae(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xfae(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xfaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xfb1(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xfb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xfa8(%rip),%rdi
call   1030 <printf@plt>
lea    0xff4(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffbc,%eax
cmp    $0x33,%eax
ja     1186 <main+0x66>
lea    0xfd9(%rip),%rdi
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1008(%rip),%rdi
jmp    118d <main+0x6d>
lea    0xfec(%rip),%rdi
jmp    118d <main+0x6d>
lea    0xfc0(%rip),%rdi
jmp    118d <main+0x6d>
lea    0xfc8(%rip),%rdi
jmp    118d <main+0x6d>
lea    0xff5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [88 x i8] c"Please input marriage status\0A(S=single, M=married, W=widowed, E=separated, D=divorced):\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"You are Single.\00"
@.str.3 = [17 x i8] c"You are Married.\00"
@.str.4 = [18 x i8] c"You are Widdowed.\00"
@.str.5 = [19 x i8] c"You are Separated.\00"
@.str.6 = [17 x i8] c"You are Divorced\00"
@.str.7 = [15 x i8] c"Invalid input.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %17 [
i32 83, label %7
i32 115, label %7
i32 77, label %9
i32 109, label %9
i32 87, label %11
i32 119, label %11
i32 69, label %13
i32 101, label %13
i32 68, label %15
i32 100, label %15
]
7: ; preds = %0, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %19
9: ; preds = %0, %0
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %19
11: ; preds = %0, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %19
13: ; preds = %0, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %19
15: ; preds = %0, %0
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [88 x i8] c"Please input marriage status\0A(S=single, M=married, W=widowed, E=separated, D=divorced):\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"You are Single.\00"
@.str.3 = [17 x i8] c"You are Married.\00"
@.str.4 = [18 x i8] c"You are Widdowed.\00"
@.str.5 = [19 x i8] c"You are Separated.\00"
@.str.6 = [17 x i8] c"You are Divorced\00"
@.str.7 = [15 x i8] c"Invalid input.\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 83, label %11
i32 115, label %11
i32 77, label %6
i32 109, label %6
i32 87, label %7
i32 119, label %7
i32 69, label %8
i32 101, label %8
i32 68, label %9
i32 100, label %9
]
6: ; preds = %0, %0
br label %11
7: ; preds = %0, %0
br label %11
8: ; preds = %0, %0
br label %11
9: ; preds = %0, %0
br label %11
10: ; preds = %0
br label %11
11: ; preds = %0, %0, %10, %9, %8, %7, %6
%12 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %0 ]
%13 = call i32 @printf(i8* dereferenceable(1) %12)
ret i32 0
}