#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 /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int x, y, a, b;
  scanf("%d %d %d %d", &x, &y, &a, &b);
  int i;
  int c = 0;
  for (i = a; i <= b; i++) {
    if (i % x == 0 && i % y == 0)
      c++;
  }
  printf("%d\n", c);
  return 0;
}


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
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a0 <main+0x80>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    118d <main+0x6d>
mov    -0x18(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    118d <main+0x6d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x72>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <main+0x38>
mov    -0x1c(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%edi
xor    %esi,%esi
cmp    %edi,%ecx
jle    1165 <main+0x45>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
add    $0x1,%edi
xor    %esi,%esi
jmp    1187 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ecx
cmp    %ecx,%edi
je     1152 <main+0x32>
mov    %ecx,%eax
cltd
idiv   %r8d
test   %edx,%edx
jne    1180 <main+0x60>
mov    %ecx,%eax
cltd
idiv   %r9d
cmp    $0x1,%edx
adc    $0x0,%esi
jmp    1180 <main+0x60>

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