char *convert_to_str(int line, int col, int vx, int vy) {
  static char str[3] = {0};
  if (vx == -1 || vx == 1) {
    str[0] = (vx == -1 ? 'L' : 'R');
    str[1] = line + '0';
  } else {
    str[0] = (vy == -1 ? 'B' : 'T');
    str[1] = col + '0';
  }
  return str;
}


x86 assembly (clang, -O0):
<convert_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1124 <convert_to_str+0x24>
cmpl   $0x1,-0xc(%rbp)
jne    114e <convert_to_str+0x4e>
mov    -0xc(%rbp),%edx
mov    $0x52,%eax
mov    $0x4c,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %al,0x2ee4(%rip)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,0x2ed9(%rip)
jmp    1173 <convert_to_str+0x73>
mov    -0x10(%rbp),%edx
mov    $0x54,%eax
mov    $0x42,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
mov    %al,0x2eba(%rip)
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,0x2eaf(%rip)
lea    0x2ea7(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_str>:
cmp    $0x1,%edx
je     110a <convert_to_str+0xa>
cmp    $0xffffffff,%edx
jne    111c <convert_to_str+0x1c>
cmp    $0xffffffff,%edx
mov    $0x4c,%ecx
mov    $0x52,%eax
cmove  %ecx,%eax
jmp    112e <convert_to_str+0x2e>
cmp    $0xffffffff,%ecx
mov    $0x42,%ecx
mov    $0x54,%eax
cmove  %ecx,%eax
mov    %esi,%edi
mov    %al,0x2eed(%rip)
lea    0x2ee6(%rip),%rax
add    $0x30,%dil
mov    %dil,0x2edc(%rip)
ret

LLVM IR (-O0):
@convert_to_str.str = internal global [3 x i8] zeroinitializer
define i8* @convert_to_str(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, -1
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %23
14: ; preds = %11, %4
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, -1
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 76, i32 82
%19 = trunc i32 %18 to i8
store i8 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 0)
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 48
%22 = trunc i32 %21 to i8
store i8 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 1)
br label %32
23: ; preds = %11
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, -1
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 66, i32 84
%28 = trunc i32 %27 to i8
store i8 %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 0)
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 48
%31 = trunc i32 %30 to i8
store i8 %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 1)
br label %32
32: ; preds = %23, %14
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 0)
}

LLVM IR (-O2):
@convert_to_str.str = internal global [3 x i8] zeroinitializer
define i8* @convert_to_str(i32 %0, i32 %1, i32 %2, i32 %3) {
switch i32 %2, label %8 [
i32 -1, label %5
i32 1, label %5
]
5: ; preds = %4, %4
%6 = icmp eq i32 %2, -1
%7 = select i1 %6, i8 76, i8 82
br label %11
8: ; preds = %4
%9 = icmp eq i32 %3, -1
%10 = select i1 %9, i8 66, i8 84
br label %11
11: ; preds = %8, %5
%12 = phi i8 [ %7, %5 ], [ %10, %8 ]
%13 = phi i32 [ %0, %5 ], [ %1, %8 ]
store i8 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 0)
%14 = trunc i32 %13 to i8
%15 = add i8 %14, 48
store i8 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 1)
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @convert_to_str.str, i64 0, i64 0)
}