#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 **allocTable(int);
int getTableVal(int **, int, int, int, int);
int /*<<< orphan*/ initTable(int **, int, int, int, int);
int /*<<< orphan*/ printTable(int **, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int xp, xk, yp, yk;
  scanf("%d %d %d", &xp, &xk, &yp);
  yk = (xk - xp) + yp;
  int length = xk - xp + 1;
  int **table = allocTable(length);
  if (!table)
    return -1;
  initTable(table, xp, xk, yp, yk);
  printTable(table, length);
  int i, j;
  do {
    scanf("%d", &i);
  } while (!(i <= xk && xp <= i));
  do {
    scanf("%d", &j);
  } while (!(j <= yk && yp <= j));
  printf("%d*%d=%d\n", i, j, getTableVal(table, i, j, xp, yp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <allocTable@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c4 <main+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a0 <main+0x140>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1080 <initTable@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1060 <printTable@plt>
lea    0xe19(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x29(%rbp)
jg     1215 <main+0xb5>
mov    -0x8(%rbp),%eax
cmp    -0x24(%rbp),%eax
setle  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    11e6 <main+0x86>
jmp    1227 <main+0xc7>
lea    0xdd8(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x28(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x2a(%rbp)
jg     1256 <main+0xf6>
mov    -0x10(%rbp),%eax
cmp    -0x28(%rbp),%eax
setle  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1227 <main+0xc7>
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8d
call   1030 <getTableVal@plt>
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    %eax,%ecx
lea    0xd75(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xe8d(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x14(%rsp),%ebp
sub    0xc(%rsp),%ebp
mov    0x10(%rsp),%ebx
add    %ebp,%ebx
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <allocTable@plt>
test   %rax,%rax
je     1259 <main+0xf9>
mov    %rax,%r14
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    %rax,%rdi
mov    %ebx,%r8d
call   1080 <initTable@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printTable@plt>
lea    0xe31(%rip),%r15
lea    0x18(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    0x14(%rsp),%eax
jg     11e0 <main+0x80>
cmp    %eax,0xc(%rsp)
jg     11e0 <main+0x80>
lea    0xe02(%rip),%r15
lea    0x1c(%rsp),%r12
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x1c(%rsp),%ebp
cmp    %ebx,%ebp
jg     1210 <main+0xb0>
mov    0x10(%rsp),%r8d
cmp    %ebp,%r8d
jg     1210 <main+0xb0>
mov    0x18(%rsp),%ebx
mov    0xc(%rsp),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <getTableVal@plt>
lea    0xdbf(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
jmp    125e <main+0xfe>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"%d*%d=%d\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**
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = sub nsw i32 %11, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = sub nsw i32 %16, %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = call i32** @allocTable(i32 %20)
store i32** %21, i32*** %7
%22 = load i32**, i32*** %7
%23 = icmp ne i32** %22, null
br i1 %23, label %25, label %24
24: ; preds = %0
store i32 -1, i32* %1
br label %72
25: ; preds = %0
%26 = load i32**, i32*** %7
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = call i32 @initTable(i32** %26, i32 %27, i32 %28, i32 %29, i32 %30)
%32 = load i32**, i32*** %7
%33 = load i32, i32* %6
%34 = call i32 @printTable(i32** %32, i32 %33)
br label %35
35: ; preds = %45, %25
%36 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
br label %37
37: ; preds = %35
%38 = load i32, i32* %8
%39 = load i32, i32* %3
%40 = icmp sle i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i32, i32* %2
%43 = load i32, i32* %8
%44 = icmp sle i32 %42, %43
br label %45
45: ; preds = %41, %37
%46 = phi i1 [ false, %37 ], [ %44, %41 ]
%47 = xor i1 %46, true
br i1 %47, label %35, label %48
48: ; preds = %45
br label %49
49: ; preds = %59, %48
%50 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
br label %51
51: ; preds = %49
%52 = load i32, i32* %9
%53 = load i32, i32* %5
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %59
55: ; preds = %51
%56 = load i32, i32* %4
%57 = load i32, i32* %9
%58 = icmp sle i32 %56, %57
br label %59
59: ; preds = %55, %51
%60 = phi i1 [ false, %51 ], [ %58, %55 ]
%61 = xor i1 %60, true
br i1 %61, label %49, label %62
62: ; preds = %59
%63 = load i32, i32* %8
%64 = load i32, i32* %9
%65 = load i32**, i32*** %7
%66 = load i32, i32* %8
%67 = load i32, i32* %9
%68 = load i32, i32* %2
%69 = load i32, i32* %4
%70 = call i32 @getTableVal(i32** %65, i32 %66, i32 %67, i32 %68, i32 %69)
%71 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %63, i32 %64, i32 %70)
store i32 0, i32* %1
br label %72
72: ; preds = %62, %24
%73 = load i32, i32* %1
ret i32 %73
}

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