#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 scanf(char *, int *, int *, int *, int *);
int main() {
  int a, b, c, d, test_case = 1;
  while (scanf("%d %d %d %d", &a, &b, &c, &d) == 4) {
    printf("Case %d:\n", test_case++);
    int det = a * d - b * c;
    printf("%d %d\n%d %d\n", d / det, -b / det, -c / det, a / det);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
cmp    $0x4,%eax
jne    11c7 <main+0xa7>
mov    -0x18(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,%esi
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
sub    -0x10(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    -0x20(%rbp),%edx
mov    %eax,%r8d
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%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
call   1040 <scanf@plt>
cmp    $0x4,%eax
jne    11fa <main+0xda>
mov    $0x1,%esi
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r14
nopl   0x0(%rax,%rax,1)
lea    0x1(%rsi),%r13d
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%r9d
mov    0x8(%rsp),%eax
mov    %eax,%ebx
imul   %r9d,%ebx
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edi
mov    %edi,%ecx
imul   %esi,%ecx
sub    %ecx,%ebx
cltd
idiv   %ebx
mov    %eax,%r8d
mov    %esi,%eax
cltd
idiv   %ebx
mov    %eax,%ebp
neg    %ebp
mov    %edi,%eax
cltd
idiv   %ebx
mov    %eax,%ecx
neg    %ecx
mov    %r9d,%eax
cltd
idiv   %ebx
lea    0xe51(%rip),%rdi
mov    %r8d,%esi
mov    %ebp,%edx
mov    %eax,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe25(%rip),%rdi
lea    0x14(%rsp),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   1040 <scanf@plt>
mov    %r13d,%esi
cmp    $0x4,%eax
je     1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [10 x i8] c"Case %d:\0A\00"
@.str.2 = [13 x i8] c"%d %d\0A%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %31
11: ; preds = %0, %11
%12 = phi i32 [ %13, %11 ], [ 1, %0 ]
%13 = add nuw nsw i32 %12, 1
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%15 = load i32, i32* %1
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, %15
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, %18
%21 = sub nsw i32 %17, %20
%22 = sdiv i32 %16, %21
%23 = sdiv i32 %18, %21
%24 = sub nsw i32 0, %23
%25 = sdiv i32 %19, %21
%26 = sub nsw i32 0, %25
%27 = sdiv i32 %15, %21
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %24, i32 %26, i32 %27)
%29 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%30 = icmp eq i32 %29, 4
br i1 %30, label %11, label %31
31: ; preds = %11, %0
ret i32 0
}