#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 */
scalar_t__ gcd(int, int);
int /*<<< orphan*/ input(int, int);
int /*<<< orphan*/ output(int, int, int, ...);
main() {
  int x = 0, y = 0;
  input(x, y);
  for (1; x != -1 && y != -1; 1) {
    output(x, y, gcd(x, y));
    if (gcd(x, y) == gcd(y, x)) {
      output(1, 1, 1, 1, 1, 1, 1, 1, 1);
    } else {
      output(0, 0, 0, 0, 0, 0, 0, 0, 0);
    }
    input(x, y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <input@plt>
xor    %eax,%eax
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1171 <main+0x41>
cmpl   $0xffffffff,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1181 <main+0x51>
jmp    1249 <main+0x119>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <output@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <gcd@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    1209 <main+0xd9>
mov    $0x1,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x1,0x10(%rsp)
mov    $0x0,%al
call   1040 <output@plt>
jmp    1239 <main+0x109>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x0,%al
call   1040 <output@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <input@plt>
jmp    1158 <main+0x28>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
jmp    1171 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
xor    %eax,%eax
push   $0x1
push   $0x1
push   $0x1
call   1040 <output@plt>
add    $0x20,%rsp
xor    %edi,%edi
xor    %esi,%esi
call   1030 <input@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <gcd@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <output@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <gcd@plt>
mov    %rax,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1050 <gcd@plt>
sub    $0x8,%rsp
cmp    %rax,%rbx
je     1140 <main+0x10>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
push   $0x0
push   $0x0
push   $0x0
jmp    1168 <main+0x38>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @input(i32 %4, i32 %5)
br label %7
7: ; preds = %38, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, -1
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %39
15: ; preds = %13
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i64 @gcd(i32 %18, i32 %19)
%21 = trunc i64 %20 to i32
%22 = call i32 (i32, i32, i32, ...) @output(i32 %16, i32 %17, i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i64 @gcd(i32 %23, i32 %24)
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = call i64 @gcd(i32 %26, i32 %27)
%29 = icmp eq i64 %25, %28
br i1 %29, label %30, label %32
30: ; preds = %15
%31 = call i32 (i32, i32, i32, ...) @output(i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1)
br label %34
32: ; preds = %15
%33 = call i32 (i32, i32, i32, ...) @output(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
br label %34
34: ; preds = %32, %30
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = call i32 @input(i32 %35, i32 %36)
br label %38
38: ; preds = %34
br label %7
39: ; preds = %13
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %13, %0
%2 = tail call i32 @input(i32 0, i32 0)
%3 = tail call i64 @gcd(i32 0, i32 0)
%4 = trunc i64 %3 to i32
%5 = tail call i32 (i32, i32, i32, ...) @output(i32 0, i32 0, i32 %4)
%6 = tail call i64 @gcd(i32 0, i32 0)
%7 = tail call i64 @gcd(i32 0, i32 0)
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call i32 (i32, i32, i32, ...) @output(i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1)
br label %13
11: ; preds = %1
%12 = tail call i32 (i32, i32, i32, ...) @output(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
br label %13
13: ; preds = %11, %9
br label %1
}