char *processRotationSymbol(void) {
  static int sVar = 0;
  switch (sVar) {
  case 0:
    sVar = 1;
    return "-";
  case 1:
    sVar = 2;
    return "\\";
  case 2:
    sVar = 3;
    return "|";
  case 3:
    sVar = 0;
    return "/";
  default:
    sVar = 0;
    return "-";
  }
}


x86 assembly (clang, -O0):
<processRotationSymbol>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1194 <processRotationSymbol+0x94>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,0x2eee(%rip)
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a9 <processRotationSymbol+0xa9>
movl   $0x2,0x2ed4(%rip)
lea    0xebb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a9 <processRotationSymbol+0xa9>
movl   $0x3,0x2eba(%rip)
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a9 <processRotationSymbol+0xa9>
movl   $0x0,0x2ea0(%rip)
lea    0xe8b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a9 <processRotationSymbol+0xa9>
movl   $0x0,0x2e86(%rip)
lea    0xe6b(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<processRotationSymbol>:
movslq 0x2f1d(%rip),%rax
cmp    $0x3,%rax
ja     112c <processRotationSymbol+0x2c>
lea    0xef4(%rip),%rcx
mov    (%rcx,%rax,4),%ecx
lea    0xefa(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
mov    %ecx,0x2ef9(%rip)
ret
xor    %ecx,%ecx
lea    0xecb(%rip),%rax
mov    %ecx,0x2ee9(%rip)
ret

LLVM IR (-O0):
@processRotationSymbol.sVar = internal global i32 0
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"\\\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [2 x i8] c"/\00"
define i8* @processRotationSymbol() {
%1 = alloca i8*
%2 = load i32, i32* @processRotationSymbol.sVar
switch i32 %2, label %7 [
i32 0, label %3
i32 1, label %4
i32 2, label %5
i32 3, label %6
]
3: ; preds = %0
store i32 1, i32* @processRotationSymbol.sVar
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %1
br label %8
4: ; preds = %0
store i32 2, i32* @processRotationSymbol.sVar
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %8
5: ; preds = %0
store i32 3, i32* @processRotationSymbol.sVar
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %8
6: ; preds = %0
store i32 0, i32* @processRotationSymbol.sVar
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %8
7: ; preds = %0
store i32 0, i32* @processRotationSymbol.sVar
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %1
br label %8
8: ; preds = %7, %6, %5, %4, %3
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@processRotationSymbol.sVar = internal unnamed_addr global i32 0
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"\\\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [2 x i8] c"/\00"
@switch.table.processRotationSymbol = [4 x i32] [i32 1, i32 2, i32 3, i32 0]
@reltable.processRotationSymbol = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.processRotationSymbol to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.processRotationSymbol to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.processRotationSymbol to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.processRotationSymbol to i64)) to i32)]
define i8* @processRotationSymbol() {
%1 = load i32, i32* @processRotationSymbol.sVar
%2 = icmp ult i32 %1, 4
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.processRotationSymbol, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %1 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.processRotationSymbol to i8*), i64 %8)
br label %10
10: ; preds = %0, %3
%11 = phi i32 [ %6, %3 ], [ 0, %0 ]
%12 = phi i8* [ %9, %3 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %0 ]
store i32 %11, i32* @processRotationSymbol.sVar
ret i8* %12
}