#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 *);
void rock_paper_scissors_lizard_spock() {
  printf("Scissors cuts Paper\n");
  printf("Paper covers Rock\n");
  printf("Rock crushes Lizard\n");
  printf("Lizard poisons Spock\n");
  printf("Spock smashes Scissors\n");
  printf("Scissors decapitates Lizard\n");
  printf("Lizard eats Paper\n");
  printf("Paper disproves Spock\n");
  printf("Spock vaporizes Rock\n");
  printf("(and as it always has) Rock crushes Scissors\n");
  printf("\n");
  printf("R. Rock\n");
  printf("P. Paper\n");
  printf("S. Scissors\n");
  printf("L. Lizzard\n");
  printf("P. Spock\n");
  char player1;
  char player2;
  printf("Player 1? ");
  scanf(" %c", &player1);
  printf("Player 2? ");
  scanf(" %c", &player2);
  switch (player1) {
  case 'R':
    if (player2 == 'S') {
      printf("Player 1 wins.\n");
    }
    if (player2 == 'P') {
      printf("Player 2 wins.\n");
    }
    break;
  case 'P':
    if (player2 == 'R') {
      printf("Player 1 wins.\n");
    }
    if (player2 == 'S') {
      printf("Player 2 wins.\n");
    }
    break;
  case 'S':
    if (player2 == 'P') {
      printf("Player 1 wins.\n");
    }
    if (player2 == 'R') {
      printf("Player 2 wins.\n");
    }
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<rock_paper_scissors_lizard_spock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
call   1030 <printf@plt>
lea    0xf23(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2d(%rip),%rdi
call   1030 <printf@plt>
lea    0xfad(%rip),%rdi
call   1030 <printf@plt>
lea    0xf43(%rip),%rdi
call   1030 <printf@plt>
lea    0xf40(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3c(%rip),%rdi
mov    %rdi,-0x10(%rbp)
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x2(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x50,%eax
je     128f <rock_paper_scissors_lizard_spock+0x16f>
jmp    1236 <rock_paper_scissors_lizard_spock+0x116>
mov    -0x8(%rbp),%eax
sub    $0x52,%eax
je     1258 <rock_paper_scissors_lizard_spock+0x138>
jmp    1247 <rock_paper_scissors_lizard_spock+0x127>
mov    -0x8(%rbp),%eax
sub    $0x53,%eax
je     12c6 <rock_paper_scissors_lizard_spock+0x1a6>
jmp    12fd <rock_paper_scissors_lizard_spock+0x1dd>
movsbl -0x2(%rbp),%eax
cmp    $0x53,%eax
jne    1271 <rock_paper_scissors_lizard_spock+0x151>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x50,%eax
jne    128a <rock_paper_scissors_lizard_spock+0x16a>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    1302 <rock_paper_scissors_lizard_spock+0x1e2>
movsbl -0x2(%rbp),%eax
cmp    $0x52,%eax
jne    12a8 <rock_paper_scissors_lizard_spock+0x188>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x53,%eax
jne    12c1 <rock_paper_scissors_lizard_spock+0x1a1>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    1302 <rock_paper_scissors_lizard_spock+0x1e2>
movsbl -0x2(%rbp),%eax
cmp    $0x50,%eax
jne    12df <rock_paper_scissors_lizard_spock+0x1bf>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x52,%eax
jne    12f8 <rock_paper_scissors_lizard_spock+0x1d8>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    1302 <rock_paper_scissors_lizard_spock+0x1e2>
jmp    1302 <rock_paper_scissors_lizard_spock+0x1e2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rock_paper_scissors_lizard_spock>:
push   %rbx
sub    $0x10,%rsp
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeed(%rip),%rdi
call   1040 <puts@plt>
lea    0xef8(%rip),%rdi
call   1040 <puts@plt>
lea    0xf08(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0e(%rip),%rdi
call   1040 <puts@plt>
lea    0xf18(%rip),%rdi
call   1040 <puts@plt>
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf38(%rip),%rdi
call   1040 <puts@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
lea    0xf31(%rip),%rdi
call   1040 <puts@plt>
lea    0xf31(%rip),%rdi
call   1040 <puts@plt>
lea    0xf30(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf6(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf5(%rip),%rbx
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xde5(%rip),%rdi
call   1050 <printf@plt>
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x50,%eax
je     126e <rock_paper_scissors_lizard_spock+0x12e>
cmp    $0x53,%eax
je     128c <rock_paper_scissors_lizard_spock+0x14c>
cmp    $0x52,%eax
jne    12b4 <rock_paper_scissors_lizard_spock+0x174>
mov    0xe(%rsp),%al
cmp    $0x53,%al
jne    1268 <rock_paper_scissors_lizard_spock+0x128>
lea    0xee7(%rip),%rdi
call   1040 <puts@plt>
mov    0xe(%rsp),%al
cmp    $0x50,%al
je     12a8 <rock_paper_scissors_lizard_spock+0x168>
jmp    12b4 <rock_paper_scissors_lizard_spock+0x174>
mov    0xe(%rsp),%al
cmp    $0x52,%al
jne    1286 <rock_paper_scissors_lizard_spock+0x146>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
mov    0xe(%rsp),%al
cmp    $0x53,%al
je     12a8 <rock_paper_scissors_lizard_spock+0x168>
jmp    12b4 <rock_paper_scissors_lizard_spock+0x174>
mov    0xe(%rsp),%al
cmp    $0x50,%al
jne    12a4 <rock_paper_scissors_lizard_spock+0x164>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
mov    0xe(%rsp),%al
cmp    $0x52,%al
jne    12b4 <rock_paper_scissors_lizard_spock+0x174>
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Scissors cuts Paper\0A\00"
@.str.1 = [19 x i8] c"Paper covers Rock\0A\00"
@.str.2 = [21 x i8] c"Rock crushes Lizard\0A\00"
@.str.3 = [22 x i8] c"Lizard poisons Spock\0A\00"
@.str.4 = [24 x i8] c"Spock smashes Scissors\0A\00"
@.str.5 = [29 x i8] c"Scissors decapitates Lizard\0A\00"
@.str.6 = [19 x i8] c"Lizard eats Paper\0A\00"
@.str.7 = [23 x i8] c"Paper disproves Spock\0A\00"
@.str.8 = [22 x i8] c"Spock vaporizes Rock\0A\00"
@.str.9 = [46 x i8] c"(and as it always has) Rock crushes Scissors\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [9 x i8] c"R. Rock\0A\00"
@.str.12 = [10 x i8] c"P. Paper\0A\00"
@.str.13 = [13 x i8] c"S. Scissors\0A\00"
@.str.14 = [12 x i8] c"L. Lizzard\0A\00"
@.str.15 = [10 x i8] c"P. Spock\0A\00"
@.str.16 = [11 x i8] c"Player 1? \00"
@.str.17 = [4 x i8] c" %c\00"
@.str.18 = [11 x i8] c"Player 2? \00"
@.str.19 = [16 x i8] c"Player 1 wins.\0A\00"
@.str.20 = [16 x i8] c"Player 2 wins.\0A\00"
define void @rock_paper_scissors_lizard_spock() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %1)
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %2)
%23 = load i8, i8* %1
%24 = sext i8 %23 to i32
switch i32 %24, label %64 [
i32 82, label %25
i32 80, label %38
i32 83, label %51
]
25: ; preds = %0
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 83
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = load i8, i8* %2
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 80
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
br label %37
37: ; preds = %35, %31
br label %65
38: ; preds = %0
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 82
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 83
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
br label %65
51: ; preds = %0
%52 = load i8, i8* %2
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 80
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
br label %57
57: ; preds = %55, %51
%58 = load i8, i8* %2
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 82
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
br label %63
63: ; preds = %61, %57
br label %65
64: ; preds = %0
br label %65
65: ; preds = %64, %63, %50, %37
ret void
}

LLVM IR (-O2):
@.str.16 = [11 x i8] c"Player 1? \00"
@.str.17 = [4 x i8] c" %c\00"
@.str.18 = [11 x i8] c"Player 2? \00"
@str = [20 x i8] c"Scissors cuts Paper\00"
@str.21 = [18 x i8] c"Paper covers Rock\00"
@str.22 = [20 x i8] c"Rock crushes Lizard\00"
@str.23 = [21 x i8] c"Lizard poisons Spock\00"
@str.24 = [23 x i8] c"Spock smashes Scissors\00"
@str.25 = [28 x i8] c"Scissors decapitates Lizard\00"
@str.26 = [18 x i8] c"Lizard eats Paper\00"
@str.27 = [22 x i8] c"Paper disproves Spock\00"
@str.28 = [21 x i8] c"Spock vaporizes Rock\00"
@str.29 = [45 x i8] c"(and as it always has) Rock crushes Scissors\00"
@str.30 = [8 x i8] c"R. Rock\00"
@str.31 = [9 x i8] c"P. Paper\00"
@str.32 = [12 x i8] c"S. Scissors\00"
@str.33 = [11 x i8] c"L. Lizzard\00"
@str.34 = [9 x i8] c"P. Spock\00"
@str.39 = [15 x i8] c"Player 2 wins.\00"
@str.40 = [15 x i8] c"Player 1 wins.\00"
define void @rock_paper_scissors_lizard_spock() {
%1 = alloca i8
%2 = alloca i8
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.21, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.22, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.24, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.25, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.26, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.27, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.28, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.29, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.30, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.31, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.32, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.33, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.34, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %1)
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %2)
%23 = load i8, i8* %1
%24 = sext i8 %23 to i32
switch i32 %24, label %55 [
i32 82, label %25
i32 80, label %34
i32 83, label %43
]
25: ; preds = %0
%26 = load i8, i8* %2
%27 = icmp eq i8 %26, 83
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.40, i64 0, i64 0))
%30 = load i8, i8* %2
br label %31
31: ; preds = %28, %25
%32 = phi i8 [ %30, %28 ], [ %26, %25 ]
%33 = icmp eq i8 %32, 80
br i1 %33, label %52, label %55
34: ; preds = %0
%35 = load i8, i8* %2
%36 = icmp eq i8 %35, 82
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.40, i64 0, i64 0))
%39 = load i8, i8* %2
br label %40
40: ; preds = %37, %34
%41 = phi i8 [ %39, %37 ], [ %35, %34 ]
%42 = icmp eq i8 %41, 83
br i1 %42, label %52, label %55
43: ; preds = %0
%44 = load i8, i8* %2
%45 = icmp eq i8 %44, 80
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.40, i64 0, i64 0))
%48 = load i8, i8* %2
br label %49
49: ; preds = %46, %43
%50 = phi i8 [ %48, %46 ], [ %44, %43 ]
%51 = icmp eq i8 %50, 82
br i1 %51, label %52, label %55
52: ; preds = %49, %40, %31
%53 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.39, i64 0, i64 0), %31 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.39, i64 0, i64 0), %40 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.39, i64 0, i64 0), %49 ]
%54 = call i32 @puts(i8* dereferenceable(1) %53)
br label %55
55: ; preds = %52, %0, %49, %40, %31
ret void
}