#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 getchar();
void read_ray(int *line, int *col, int *vx, int *vy, char *str) {
  int c;
  int *p1 = line, *p2 = col;
  *vx = *vy = 0;
  if ((*str++ = c = getchar()) == 'L' || c == 'R') {
    *vx = (c == 'L' ? 1 : -1);
    p1 = col;
    p2 = line;
  } else {
    *vy = (c == 'T' ? -1 : 1);
  }
  if (c == 'L' || c == 'T')
    *p1 = 1;
  else
    *p1 = 8;
  *str = c = getchar();
  *p2 = c - '0';
}


x86 assembly (clang, -O0):
<read_ray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x4c,%eax
je     1181 <read_ray+0x71>
cmpl   $0x52,-0x2c(%rbp)
jne    11af <read_ray+0x9f>
mov    -0x2c(%rbp),%edx
mov    $0xffffffff,%ecx
mov    $0x1,%eax
cmp    $0x4c,%edx
cmove  %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    11c8 <read_ray+0xb8>
mov    -0x2c(%rbp),%edx
mov    $0x1,%ecx
mov    $0xffffffff,%eax
cmp    $0x54,%edx
cmove  %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x4c,-0x2c(%rbp)
je     11dc <read_ray+0xcc>
cmpl   $0x54,-0x2c(%rbp)
jne    11eb <read_ray+0xdb>
mov    -0x38(%rbp),%rax
movl   $0x1,(%rax)
jmp    11f5 <read_ray+0xe5>
mov    -0x38(%rbp),%rax
movl   $0x8,(%rax)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x2c(%rbp)
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x2c(%rbp),%ecx
sub    $0x30,%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ray>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
movl   $0x0,(%rcx)
movl   $0x0,(%rdx)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,(%r14)
cmp    $0x52,%eax
je     1164 <read_ray+0x54>
movzbl %al,%ecx
cmp    $0x4c,%ecx
je     1164 <read_ray+0x54>
xor    %ecx,%ecx
cmp    $0x54,%eax
setne  %cl
add    %ecx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,0x0(%r13)
mov    %r12,%rcx
mov    %r15,%r12
jmp    1176 <read_ray+0x66>
xor    %ecx,%ecx
cmp    $0x4c,%eax
sete   %cl
add    %ecx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rbx)
mov    %r15,%rcx
add    $0xffffffb4,%eax
test   $0xfffffff7,%eax
mov    $0x1,%eax
mov    $0x8,%edx
cmove  %eax,%edx
mov    %edx,(%rcx)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,0x1(%r14)
add    $0xffffffd0,%eax
mov    %eax,(%r12)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @read_ray(i32* %0, i32* %1, i32* %2, i32* %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i8* %4, i8** %10
%14 = load i32*, i32** %6
store i32* %14, i32** %12
%15 = load i32*, i32** %7
store i32* %15, i32** %13
%16 = load i32*, i32** %9
store i32 0, i32* %16
%17 = load i32*, i32** %8
store i32 0, i32* %17
%18 = call i32 (...) @getchar()
store i32 %18, i32* %11
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %10
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %10
store i8 %19, i8* %20
%22 = sext i8 %19 to i32
%23 = icmp eq i32 %22, 76
br i1 %23, label %27, label %24
24: ; preds = %5
%25 = load i32, i32* %11
%26 = icmp eq i32 %25, 82
br i1 %26, label %27, label %35
27: ; preds = %24, %5
%28 = load i32, i32* %11
%29 = icmp eq i32 %28, 76
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 1, i32 -1
%32 = load i32*, i32** %8
store i32 %31, i32* %32
%33 = load i32*, i32** %7
store i32* %33, i32** %12
%34 = load i32*, i32** %6
store i32* %34, i32** %13
br label %41
35: ; preds = %24
%36 = load i32, i32* %11
%37 = icmp eq i32 %36, 84
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 -1, i32 1
%40 = load i32*, i32** %9
store i32 %39, i32* %40
br label %41
41: ; preds = %35, %27
%42 = load i32, i32* %11
%43 = icmp eq i32 %42, 76
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* %11
%46 = icmp eq i32 %45, 84
br i1 %46, label %47, label %49
47: ; preds = %44, %41
%48 = load i32*, i32** %12
store i32 1, i32* %48
br label %51
49: ; preds = %44
%50 = load i32*, i32** %12
store i32 8, i32* %50
br label %51
51: ; preds = %49, %47
%52 = call i32 (...) @getchar()
store i32 %52, i32* %11
%53 = trunc i32 %52 to i8
%54 = load i8*, i8** %10
store i8 %53, i8* %54
%55 = load i32, i32* %11
%56 = sub nsw i32 %55, 48
%57 = load i32*, i32** %13
store i32 %56, i32* %57
ret void
}

LLVM IR (-O2):
define void @read_ray(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i8* nocapture writeonly %4) {
store i32 0, i32* %3
store i32 0, i32* %2
%6 = tail call i32 (...) @getchar()
%7 = trunc i32 %6 to i8
store i8 %7, i8* %4
%8 = and i32 %6, 255
%9 = icmp eq i32 %8, 76
%10 = icmp eq i32 %6, 82
%11 = or i1 %10, %9
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = icmp eq i32 %6, 76
%14 = select i1 %13, i32 1, i32 -1
store i32 %14, i32* %2
br label %18
15: ; preds = %5
%16 = icmp eq i32 %6, 84
%17 = select i1 %16, i32 -1, i32 1
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %12
%19 = phi i32* [ %1, %12 ], [ %0, %15 ]
%20 = phi i32* [ %0, %12 ], [ %1, %15 ]
%21 = icmp eq i32 %6, 84
%22 = icmp eq i32 %6, 76
%23 = or i1 %21, %22
%24 = select i1 %23, i32 1, i32 8
store i32 %24, i32* %19
%25 = getelementptr inbounds i8, i8* %4, i64 1
%26 = tail call i32 (...) @getchar()
%27 = trunc i32 %26 to i8
store i8 %27, i8* %25
%28 = add nsw i32 %26, -48
store i32 %28, i32* %20
ret void
}