int chrturn(int ch) {
  return ch == '>'    ? 'v'
         : ch == 'v'  ? '<'
         : ch == '<'  ? '^'
         : ch == '^'  ? '>'
         : ch == '/'  ? '\\'
         : ch == '\\' ? '/'
                      : ch;
}


x86 assembly (clang, -O0):
<chrturn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x3e,-0x4(%rbp)
jne    111e <chrturn+0x1e>
mov    $0x76,%eax
mov    %eax,-0x8(%rbp)
jmp    11b5 <chrturn+0xb5>
cmpl   $0x76,-0x4(%rbp)
jne    1135 <chrturn+0x35>
mov    $0x3c,%eax
mov    %eax,-0xc(%rbp)
jmp    11af <chrturn+0xaf>
cmpl   $0x3c,-0x4(%rbp)
jne    114c <chrturn+0x4c>
mov    $0x5e,%eax
mov    %eax,-0x10(%rbp)
jmp    11a9 <chrturn+0xa9>
cmpl   $0x5e,-0x4(%rbp)
jne    1163 <chrturn+0x63>
mov    $0x3e,%eax
mov    %eax,-0x14(%rbp)
jmp    11a3 <chrturn+0xa3>
cmpl   $0x2f,-0x4(%rbp)
jne    117a <chrturn+0x7a>
mov    $0x5c,%eax
mov    %eax,-0x18(%rbp)
jmp    119d <chrturn+0x9d>
cmpl   $0x5c,-0x4(%rbp)
jne    1191 <chrturn+0x91>
mov    $0x2f,%eax
mov    %eax,-0x1c(%rbp)
jmp    1197 <chrturn+0x97>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrturn>:
cmp    $0x3d,%edi
jle    111a <chrturn+0x1a>
cmp    $0x3e,%edi
je     112a <chrturn+0x2a>
cmp    $0x5e,%edi
je     1130 <chrturn+0x30>
cmp    $0x76,%edi
jne    113c <chrturn+0x3c>
mov    $0x3c,%eax
ret
cmp    $0x2f,%edi
je     1136 <chrturn+0x36>
cmp    $0x3c,%edi
jne    113c <chrturn+0x3c>
mov    $0x5e,%eax
ret
mov    $0x76,%eax
ret
mov    $0x3e,%eax
ret
mov    $0x5c,%eax
ret
cmp    $0x5c,%edi
mov    $0x2f,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define i32 @chrturn(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 62
br i1 %4, label %5, label %6
5: ; preds = %1
br label %38
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 118
br i1 %8, label %9, label %10
9: ; preds = %6
br label %36
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 60
br i1 %12, label %13, label %14
13: ; preds = %10
br label %34
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 94
br i1 %16, label %17, label %18
17: ; preds = %14
br label %32
18: ; preds = %14
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 47
br i1 %20, label %21, label %22
21: ; preds = %18
br label %30
22: ; preds = %18
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 92
br i1 %24, label %25, label %26
25: ; preds = %22
br label %28
26: ; preds = %22
%27 = load i32, i32* %2
br label %28
28: ; preds = %26, %25
%29 = phi i32 [ 47, %25 ], [ %27, %26 ]
br label %30
30: ; preds = %28, %21
%31 = phi i32 [ 92, %21 ], [ %29, %28 ]
br label %32
32: ; preds = %30, %17
%33 = phi i32 [ 62, %17 ], [ %31, %30 ]
br label %34
34: ; preds = %32, %13
%35 = phi i32 [ 94, %13 ], [ %33, %32 ]
br label %36
36: ; preds = %34, %9
%37 = phi i32 [ 60, %9 ], [ %35, %34 ]
br label %38
38: ; preds = %36, %5
%39 = phi i32 [ 118, %5 ], [ %37, %36 ]
ret i32 %39
}

LLVM IR (-O2):
define i32 @chrturn(i32 %0) {
switch i32 %0, label %2 [
i32 62, label %9
i32 118, label %5
i32 60, label %6
i32 94, label %7
i32 47, label %8
]
2: ; preds = %1
%3 = icmp eq i32 %0, 92
%4 = select i1 %3, i32 47, i32 %0
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %2
%10 = phi i32 [ 118, %1 ], [ %4, %2 ], [ 60, %5 ], [ 94, %6 ], [ 62, %7 ], [ 92, %8 ]
ret i32 %10
}