#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__ EOF;
long gcd1(long, long);
long gcd2(long, long);
int /*<<< orphan*/ printf(char *, long, long, long);
scalar_t__ scanf(char *, long *, long *);
int main() {
  long a, b;
  while (scanf("%ld %ld", &a, &b) != EOF) {
    if (a == 0 || b == 0)
      break;
    long ret = gcd1(a, b);
    printf("gcd1: %ld and %ld gcd %ld\n", a, b, ret);
    ret = gcd2(a, b);
    printf("gcd2: %ld and %ld gcd %ld\n", a, b, ret);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <scanf@plt>
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
je     11e5 <main+0xa5>
cmpq   $0x0,-0x10(%rbp)
je     1189 <main+0x49>
cmpq   $0x0,-0x18(%rbp)
jne    118e <main+0x4e>
jmp    11e5 <main+0xa5>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <gcd1@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <gcd2@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
jmp    114f <main+0xf>
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    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1060 <scanf@plt>
mov    0x2e7d(%rip),%rbp
cmp    0x0(%rbp),%rax
je     1206 <main+0xc6>
lea    0xe8c(%rip),%r14
lea    0xea0(%rip),%r15
lea    0xe76(%rip),%r12
lea    0x10(%rsp),%r13
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     1206 <main+0xc6>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
je     1206 <main+0xc6>
call   1050 <gcd1@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %rax,%rcx
call   1040 <printf@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1030 <gcd2@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %r15,%rdi
mov    %rax,%rcx
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    0x0(%rbp),%rax
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%ld %ld\00"
@EOF = global i64 0
@.str.1 = [27 x i8] c"gcd1: %ld and %ld gcd %ld\0A\00"
@.str.2 = [27 x i8] c"gcd2: %ld and %ld gcd %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
br label %5
5: ; preds = %16, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %31
9: ; preds = %5
%10 = load i64, i64* %2
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i64, i64* %3
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %9
br label %31
16: ; preds = %12
%17 = load i64, i64* %2
%18 = load i64, i64* %3
%19 = call i64 @gcd1(i64 %17, i64 %18)
store i64 %19, i64* %4
%20 = load i64, i64* %2
%21 = load i64, i64* %3
%22 = load i64, i64* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %20, i64 %21, i64 %22)
%24 = load i64, i64* %2
%25 = load i64, i64* %3
%26 = call i64 @gcd2(i64 %24, i64 %25)
store i64 %26, i64* %4
%27 = load i64, i64* %2
%28 = load i64, i64* %3
%29 = load i64, i64* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %27, i64 %28, i64 %29)
br label %5
31: ; preds = %15, %5
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%ld %ld\00"
@EOF = global i64 0
@.str.1 = [27 x i8] c"gcd1: %ld and %ld gcd %ld\0A\00"
@.str.2 = [27 x i8] c"gcd2: %ld and %ld gcd %ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %28, label %8
8: ; preds = %0, %14
%9 = load i64, i64* %1
%10 = icmp eq i64 %9, 0
%11 = load i64, i64* %2
%12 = icmp eq i64 %11, 0
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %28, label %14
14: ; preds = %8
%15 = call i64 @gcd1(i64 %9, i64 %11)
%16 = load i64, i64* %1
%17 = load i64, i64* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %16, i64 %17, i64 %15)
%19 = load i64, i64* %1
%20 = load i64, i64* %2
%21 = call i64 @gcd2(i64 %19, i64 %20)
%22 = load i64, i64* %1
%23 = load i64, i64* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %22, i64 %23, i64 %21)
%25 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%26 = load i64, i64* @EOF
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %8
28: ; preds = %14, %8, %0
ret i32 0
}