#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 *);
char switchPolicy(char pol) {
  printf("\n\rYou switched the policy of scheduling from ");
  if (pol == 'p') {
    printf("PRIORITY to REMAINING EXECUTIONS\n\r");
    return 'e';
  } else if (pol == 'e') {
    printf("REMAINING EXECUTIONS to PRIORITY \n\r");
    return 'p';
  }
  return 'p';
}


x86 assembly (clang, -O0):
<switchPolicy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x70,%eax
jne    114c <switchPolicy+0x3c>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
movb   $0x65,-0x1(%rbp)
jmp    1177 <switchPolicy+0x67>
movsbl -0x2(%rbp),%eax
cmp    $0x65,%eax
jne    116e <switchPolicy+0x5e>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
movb   $0x70,-0x1(%rbp)
jmp    1177 <switchPolicy+0x67>
jmp    1173 <switchPolicy+0x63>
movb   $0x70,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<switchPolicy>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x70,%bpl
je     113a <switchPolicy+0x2a>
mov    $0x70,%bl
cmp    $0x65,%bpl
jne    1148 <switchPolicy+0x38>
mov    $0x70,%bl
lea    0xf19(%rip),%rdi
jmp    1143 <switchPolicy+0x33>
mov    $0x65,%bl
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"\0A\0DYou switched the policy of scheduling from \00"
@.str.1 = [35 x i8] c"PRIORITY to REMAINING EXECUTIONS\0A\0D\00"
@.str.2 = [36 x i8] c"REMAINING EXECUTIONS to PRIORITY \0A\0D\00"
define signext i8 @switchPolicy(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 112
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
store i8 101, i8* %2
br label %18
10: ; preds = %1
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 101
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
store i8 112, i8* %2
br label %18
16: ; preds = %10
br label %17
17: ; preds = %16
store i8 112, i8* %2
br label %18
18: ; preds = %17, %14, %8
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
@.str = [46 x i8] c"\0A\0DYou switched the policy of scheduling from \00"
@.str.1 = [35 x i8] c"PRIORITY to REMAINING EXECUTIONS\0A\0D\00"
@.str.2 = [36 x i8] c"REMAINING EXECUTIONS to PRIORITY \0A\0D\00"
define signext i8 @switchPolicy(i8 signext %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
switch i8 %0, label %8 [
i8 112, label %4
i8 101, label %3
]
3: ; preds = %1
br label %4
4: ; preds = %1, %3
%5 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %1 ]
%6 = phi i8 [ 112, %3 ], [ 101, %1 ]
%7 = tail call i32 @printf(i8* dereferenceable(1) %5)
br label %8
8: ; preds = %4, %1
%9 = phi i8 [ 112, %1 ], [ %6, %4 ]
ret i8 %9
}