#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int plain1, encrypted1, plain2, encrypted2, length, crypt, keeper;
  int keyA, keyB;
  scanf("%d %d %d %d %d", &plain1, &encrypted1, &plain2, &encrypted2, &length);
  keyA = (encrypted2 - encrypted1) / (plain2 - plain1);
  keyB = encrypted1 - plain1 * keyA;
  for (int i = 1; i < length; i++) {
    scanf("%d", &crypt);
    keeper = (crypt - keyB) / keyA;
    printf("%d ", keeper);
  }
  scanf("%d", &crypt);
  keeper = (crypt - keyB) / keyA;
  printf("%d\n", keeper);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x24(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c1 <main+0xa1>
lea    0xe80(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
sub    -0x28(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1179 <main+0x59>
lea    0xe44(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
sub    -0x28(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0x10(%rsp),%ebp
sub    %ebp,%eax
mov    0xc(%rsp),%ecx
mov    0x14(%rsp),%esi
sub    %esi,%ecx
cltd
idiv   %ecx
mov    %eax,%r13d
imul   %esi,%eax
sub    %eax,%ebp
cmpl   $0x2,0x4(%rsp)
jl     11c9 <main+0xa9>
mov    $0x1,%ebx
lea    0xe85(%rip),%r14
mov    %rsp,%r15
lea    0xe7e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
sub    %ebp,%eax
cltd
idiv   %r13d
mov    %r12,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     11a0 <main+0x80>
lea    0xe3c(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
sub    %ebp,%eax
cltd
idiv   %r13d
lea    0xe29(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d %d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [4 x i8] c"%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
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = sub nsw i32 %16, %17
%19 = sdiv i32 %15, %18
store i32 %19, i32* %9
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = load i32, i32* %9
%23 = mul nsw i32 %21, %22
%24 = sub nsw i32 %20, %23
store i32 %24, i32* %10
store i32 1, i32* %11
br label %25
25: ; preds = %38, %0
%26 = load i32, i32* %11
%27 = load i32, i32* %6
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%31 = load i32, i32* %7
%32 = load i32, i32* %10
%33 = sub nsw i32 %31, %32
%34 = load i32, i32* %9
%35 = sdiv i32 %33, %34
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %29
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %25
41: ; preds = %25
%42 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%43 = load i32, i32* %7
%44 = load i32, i32* %10
%45 = sub nsw i32 %43, %44
%46 = load i32, i32* %9
%47 = sdiv i32 %45, %46
store i32 %47, i32* %8
%48 = load i32, i32* %8
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d %d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [4 x i8] c"%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 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4, i32* %5)
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = sub nsw i32 %14, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %1
%19 = sub nsw i32 %17, %18
%20 = sdiv i32 %16, %19
%21 = mul nsw i32 %20, %18
%22 = sub nsw i32 %15, %21
%23 = load i32, i32* %5
%24 = icmp sgt i32 %23, 1
br i1 %24, label %31, label %25
25: ; preds = %31, %0
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, %22
%29 = sdiv i32 %28, %20
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
ret i32 0
31: ; preds = %0, %31
%32 = phi i32 [ %38, %31 ], [ 1, %0 ]
%33 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%34 = load i32, i32* %6
%35 = sub nsw i32 %34, %22
%36 = sdiv i32 %35, %20
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = add nuw nsw i32 %32, 1
%39 = load i32, i32* %5
%40 = icmp slt i32 %38, %39
br i1 %40, label %31, label %25
}