#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 lcm(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int min, max, m, n, dividend;
  scanf("%d %d %d %d", &min, &max, &m, &n);
  dividend = lcm(m, n);
  if (min < 0) {
    min -= min % dividend;
  } else if (min % dividend != 0) {
    min += dividend - min % dividend;
  }
  for (int i = min; i <= max; i += dividend) {
    printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1050 <scanf@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <lcm@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1187 <main+0x57>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    -0x8(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x8(%rbp)
jmp    11b4 <main+0x84>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
je     11af <main+0x7f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    -0x20(%rbp),%eax
sub    %edx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b4 <main+0x84>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11e3 <main+0xb3>
mov    -0x1c(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ba <main+0x8a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <lcm@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
mov    %ebp,%eax
cltd
idiv   %ebx
test   %ebp,%ebp
js     1177 <main+0x47>
test   %edx,%edx
je     117c <main+0x4c>
add    %ebx,%ebp
sub    %edx,%ebp
mov    %ebp,(%rsp)
cmp    0x4(%rsp),%ebp
jg     11a2 <main+0x72>
lea    0xe83(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    %ebx,%ebp
cmp    0x4(%rsp),%ebp
jle    1190 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [4 x i8] c"%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 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @lcm(i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 0
%15 = srem i32 %13, %12
br i1 %14, label %16, label %18
16: ; preds = %0
%17 = sub nsw i32 %13, %15
store i32 %17, i32* %1
br label %23
18: ; preds = %0
%19 = icmp eq i32 %15, 0
br i1 %19, label %23, label %20
20: ; preds = %18
%21 = add i32 %13, %12
%22 = sub i32 %21, %15
store i32 %22, i32* %1
br label %23
23: ; preds = %18, %20, %16
%24 = phi i32 [ %13, %18 ], [ %22, %20 ], [ %17, %16 ]
%25 = load i32, i32* %2
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %28, %23
ret i32 0
28: ; preds = %23, %28
%29 = phi i32 [ %31, %28 ], [ %24, %23 ]
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = add nsw i32 %29, %12
%32 = load i32, i32* %2
%33 = icmp sgt i32 %31, %32
br i1 %33, label %27, label %28
}