#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 /*<<< orphan*/ scanf(char *, int *, int *);
main() {
  int x, y;
  scanf("%d %d", &x, &y);
  int m, n;
  if (x > y) {
    m = x;
    n = y;
  } else {
    m = y;
    n = x;
  }
  int i = 1;
  int r1, r2;
  while (1) {
    r1 = m % i;
    r2 = n % i;
    if (r1 == 0 && r2 == 0) {
      printf("%d ", i);
    }
    i++;
    if (i > m || i > n) {
      printf("\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1160 <main+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    116c <main+0x4c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11ac <main+0x8c>
cmpl   $0x0,-0x20(%rbp)
jne    11ac <main+0x8c>
mov    -0x18(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11cd <main+0xad>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11e0 <main+0xc0>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <main+0xc5>
jmp    1173 <main+0x53>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ebx
cmp    %ebx,%eax
mov    %eax,%r15d
cmovg  %ebx,%r15d
cmovg  %eax,%ebx
mov    $0x1,%ebp
lea    0xe9c(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %edx,%ecx
mov    %r15d,%eax
cltd
idiv   %ebp
or     %ecx,%edx
jne    118d <main+0x5d>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebx,%ebp
jge    119b <main+0x6b>
lea    0x1(%rbp),%eax
cmp    %r15d,%ebp
mov    %eax,%ebp
jl     1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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