#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 mod9_sum(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int a, b, P;
  scanf("%d%d%d", &a, &b, &P);
  int mod9a = mod9_sum(a);
  int mod9b = mod9_sum(b);
  int mod9P = mod9_sum(P);
  if (mod9a * mod9b % 9 != mod9P) {
    printf("Wrong\n");
    printf("%d*%d!=%d\n", a, b, P);
    printf("%d*%d==%d\n", a, b, a * b);
  } else {
    if (a * b == P) {
      printf("Right\n");
    } else {
      printf("Pass\n");
      printf("%d*%d!=%d\n", a, b, P);
      printf("%d*%d==%d\n", a, b, a * b);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <mod9_sum@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <mod9_sum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <mod9_sum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
cmp    -0x1c(%rbp),%edx
je     11d5 <main+0xa5>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x10d>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11f8 <main+0xc8>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1238 <main+0x108>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x10d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xeb3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1060 <scanf@plt>
mov    0x10(%rsp),%edi
call   1050 <mod9_sum@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
call   1050 <mod9_sum@plt>
mov    %eax,%ebp
mov    0x14(%rsp),%edi
call   1050 <mod9_sum@plt>
imul   %ebx,%ebp
movslq %ebp,%rcx
imul   $0x38e38e39,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,8),%edx
sub    %edx,%ecx
cmp    %eax,%ecx
jne    11c0 <main+0x80>
mov    0xc(%rsp),%eax
imul   0x10(%rsp),%eax
cmp    0x14(%rsp),%eax
jne    11c9 <main+0x89>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
jmp    120a <main+0xca>
lea    0xe61(%rip),%rdi
jmp    11d0 <main+0x90>
lea    0xe4d(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d%d%d\00"
@.str.1 = [7 x i8] c"Wrong\0A\00"
@.str.2 = [11 x i8] c"%d*%d!=%d\0A\00"
@.str.3 = [11 x i8] c"%d*%d==%d\0A\00"
@.str.4 = [7 x i8] c"Right\0A\00"
@.str.5 = [6 x i8] c"Pass\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %2
%10 = call i32 @mod9_sum(i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = call i32 @mod9_sum(i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = call i32 @mod9_sum(i32 %13)
store i32 %14, i32* %7
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = mul nsw i32 %15, %16
%18 = srem i32 %17, 9
%19 = load i32, i32* %7
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %33
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = mul nsw i32 %29, %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %31)
br label %54
33: ; preds = %0
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %4
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %53
41: ; preds = %33
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = load i32, i32* %4
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %44, i32 %45)
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = mul nsw i32 %49, %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %48, i32 %51)
br label %53
53: ; preds = %41, %39
br label %54
54: ; preds = %53, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d%d%d\00"
@.str.2 = [11 x i8] c"%d*%d!=%d\0A\00"
@.str.3 = [11 x i8] c"%d*%d==%d\0A\00"
@str = [5 x i8] c"Pass\00"
@str.6 = [6 x i8] c"Right\00"
@str.7 = [6 x i8] c"Wrong\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = call i32 @mod9_sum(i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @mod9_sum(i32 %10)
%12 = load i32, i32* %3
%13 = call i32 @mod9_sum(i32 %12)
%14 = mul nsw i32 %11, %9
%15 = srem i32 %14, 9
%16 = icmp eq i32 %15, %13
br i1 %16, label %27, label %17
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = mul nsw i32 %24, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
br label %45
27: ; preds = %0
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = mul nsw i32 %29, %28
%31 = load i32, i32* %3
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
br label %45
35: ; preds = %27
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* %1
%42 = load i32, i32* %2
%43 = mul nsw i32 %42, %41
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %42, i32 %43)
br label %45
45: ; preds = %33, %35, %17
ret i32 0
}