#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int calculate_multiply(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int main() {
  FILE *fin = fopen("ride.in", "r");
  FILE *fout = fopen("ride.out", "w");
  char first[8];
  char second[8];
  fscanf(fin, "%s %s", first, second);
  int sum1 = calculate_multiply(first);
  int sum2 = calculate_multiply(second);
  char go[3] = "GO";
  char stay[5] = "STAY";
  if (sum1 % 47 == sum2 % 47) {
    fprintf(fout, "%s\n", go);
  } else {
    fprintf(fout, "%s\n", stay);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9d(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    0xe85(%rip),%rsi
call   1040 <fscanf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <calculate_multiply@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x28(%rbp),%rdi
call   1030 <calculate_multiply@plt>
mov    %eax,-0x30(%rbp)
mov    0xe67(%rip),%ax
mov    %ax,-0x33(%rbp)
mov    0xe5f(%rip),%al
mov    %al,-0x31(%rbp)
mov    0xe57(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xe52(%rip),%al
mov    %al,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x2f,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x2f,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x3c(%rbp),%edx
cmp    %eax,%edx
jne    1212 <main+0xd2>
mov    -0x18(%rbp),%rdi
lea    -0x33(%rbp),%rdx
lea    0xe1b(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1226 <main+0xe6>
mov    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rdx
lea    0xe02(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeae(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xe97(%rip),%rsi
lea    0x20(%rsp),%r15
lea    0x18(%rsp),%r12
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <fscanf@plt>
mov    %r15,%rdi
call   1030 <calculate_multiply@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <calculate_multiply@plt>
movb   $0x0,0xe(%rsp)
movw   $0x4f47,0xc(%rsp)
movb   $0x0,0x14(%rsp)
movl   $0x59415453,0x10(%rsp)
59
movslq %ebx,%rcx
imul   $0xffffffffae4c415d,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x5,%edx
add    %esi,%edx
imul   $0x2f,%edx,%edx
sub    %edx,%ecx
cltq
imul   $0xffffffffae4c415d,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x5,%edx
add    %esi,%edx
imul   $0x2f,%edx,%edx
sub    %edx,%eax
cmp    %eax,%ecx
lea    0xc(%rsp),%rax
lea    0x10(%rsp),%rdx
cmove  %rax,%rdx
lea    0xe0e(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"ride.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"ride.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%s %s\00"
@__const.main.go = [3 x i8] c"GO\00"
@__const.main.stay = [5 x i8] c"STAY\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [8 x i8]
%5 = alloca [8 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i8]
%9 = alloca [5 x i8]
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %11, i32** %3
%12 = load i32*, i32** %2
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%15 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %13, i8* %14)
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%17 = call i32 @calculate_multiply(i8* %16)
store i32 %17, i32* %6
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%19 = call i32 @calculate_multiply(i8* %18)
store i32 %19, i32* %7
%20 = bitcast [3 x i8]* %8 to i8*
%21 = bitcast [5 x i8]* %9 to i8*
%22 = load i32, i32* %6
%23 = srem i32 %22, 47
%24 = load i32, i32* %7
%25 = srem i32 %24, 47
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %31
27: ; preds = %0
%28 = load i32*, i32** %3
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%30 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %29)
br label %35
31: ; preds = %0
%32 = load i32*, i32** %3
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%34 = call i32 @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %31, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"ride.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"ride.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%s %s\00"
@__const.main.go = [3 x i8] c"GO\00"
@__const.main.stay = [5 x i8] c"STAY\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = alloca [8 x i8]
%3 = alloca [3 x i8]
%4 = alloca [5 x i8]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%9 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %8)
%10 = call i32 @calculate_multiply(i8* %7)
%11 = call i32 @calculate_multiply(i8* %8)
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%14 = srem i32 %10, 47
%15 = srem i32 %11, 47
%16 = icmp eq i32 %14, %15
%17 = select i1 %16, i8* %12, i8* %13
%18 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %17)
ret i32 0
}