void parse_direction(char move, int *direction) {
  switch (move) {
  case '^':
    direction[0] = 0;
    direction[1] = 1;
    break;
  case 'v':
    direction[0] = 0;
    direction[1] = -1;
    break;
  case '>':
    direction[0] = 1;
    direction[1] = 0;
    break;
  case '<':
    direction[0] = -1;
    direction[1] = 0;
    break;
  }
}


x86 assembly (clang, -O0):
<parse_direction>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x3c,%eax
je     11a4 <parse_direction+0xa4>
jmp    1123 <parse_direction+0x23>
mov    -0x14(%rbp),%eax
sub    $0x3e,%eax
je     118a <parse_direction+0x8a>
jmp    1134 <parse_direction+0x34>
mov    -0x14(%rbp),%eax
sub    $0x5e,%eax
je     1156 <parse_direction+0x56>
jmp    1145 <parse_direction+0x45>
mov    -0x14(%rbp),%eax
sub    $0x76,%eax
je     1170 <parse_direction+0x70>
jmp    11b9 <parse_direction+0xb9>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x4(%rax)
jmp    11b9 <parse_direction+0xb9>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
jmp    11b9 <parse_direction+0xb9>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
jmp    11b9 <parse_direction+0xb9>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_direction>:
cmp    $0x5d,%edi
jg     1118 <parse_direction+0x18>
cmp    $0x3c,%edi
je     112b <parse_direction+0x2b>
cmp    $0x3e,%edi
jne    113e <parse_direction+0x3e>
xor    %ecx,%ecx
mov    $0x1,%eax
jmp    1139 <parse_direction+0x39>
xor    %eax,%eax
cmp    $0x5e,%edi
je     1134 <parse_direction+0x34>
cmp    $0x76,%edi
jne    113e <parse_direction+0x3e>
mov    $0xffffffff,%ecx
jmp    1139 <parse_direction+0x39>
xor    %ecx,%ecx
mov    $0xffffffff,%eax
jmp    1139 <parse_direction+0x39>
mov    $0x1,%ecx
mov    %eax,(%rsi)
mov    %ecx,0x4(%rsi)
ret

LLVM IR (-O0):
define void @parse_direction(i8 signext %0, i32* %1) {
%3 = alloca i8
%4 = alloca i32*
store i8 %0, i8* %3
store i32* %1, i32** %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %27 [
i32 94, label %7
i32 118, label %12
i32 62, label %17
i32 60, label %22
]
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 0, i32* %9
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 1, i32* %11
br label %27
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 0, i32* %14
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 -1, i32* %16
br label %27
17: ; preds = %2
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 1, i32* %19
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 1
store i32 0, i32* %21
br label %27
22: ; preds = %2
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 0
store i32 -1, i32* %24
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 1
store i32 0, i32* %26
br label %27
27: ; preds = %2, %22, %17, %12, %7
ret void
}

LLVM IR (-O2):
define void @parse_direction(i8 signext %0, i32* nocapture writeonly %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %11 [
i32 94, label %7
i32 118, label %4
i32 62, label %5
i32 60, label %6
]
4: ; preds = %2
br label %7
5: ; preds = %2
br label %7
6: ; preds = %2
br label %7
7: ; preds = %2, %4, %5, %6
%8 = phi i32 [ -1, %6 ], [ 1, %5 ], [ 0, %4 ], [ 0, %2 ]
%9 = phi i32 [ 0, %6 ], [ 0, %5 ], [ -1, %4 ], [ 1, %2 ]
store i32 %8, i32* %1
%10 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %9, i32* %10
br label %11
11: ; preds = %7, %2
ret void
}