#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 */
size_t gcd(size_t, size_t);
size_t size_max(size_t const, size_t const);
size_t size_min(size_t const, size_t const);
size_t lcm(const size_t x, const size_t y) {
  size_t a, b, cm;
  a = size_min(x, y);
  b = size_max(x, y);
  if (a == 0 || b == 0) {
    return 0;
  }
  cm = b;
  cm = cm / gcd(a, b);
  return cm;
}


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <size_min@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <size_max@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1178 <lcm+0x48>
cmpq   $0x0,-0x28(%rbp)
jne    1185 <lcm+0x55>
movq   $0x0,-0x8(%rbp)
jmp    11ba <lcm+0x8a>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%rbx
call   1050 <size_min@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <size_max@plt>
mov    %rax,%rbx
xor    %eax,%eax
test   %r14,%r14
je     1187 <lcm+0x57>
test   %rbx,%rbx
je     1187 <lcm+0x57>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1181 <lcm+0x51>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
jmp    1187 <lcm+0x57>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @lcm(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%9 = load i64, i64* %4
%10 = load i64, i64* %5
%11 = call i64 @size_min(i64 %9, i64 %10)
store i64 %11, i64* %6
%12 = load i64, i64* %4
%13 = load i64, i64* %5
%14 = call i64 @size_max(i64 %12, i64 %13)
store i64 %14, i64* %7
%15 = load i64, i64* %6
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %2
%18 = load i64, i64* %7
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17, %2
store i64 0, i64* %3
br label %29
21: ; preds = %17
%22 = load i64, i64* %7
store i64 %22, i64* %8
%23 = load i64, i64* %8
%24 = load i64, i64* %6
%25 = load i64, i64* %7
%26 = call i64 @gcd(i64 %24, i64 %25)
%27 = udiv i64 %23, %26
store i64 %27, i64* %8
%28 = load i64, i64* %8
store i64 %28, i64* %3
br label %29
29: ; preds = %21, %20
%30 = load i64, i64* %3
ret i64 %30
}

LLVM IR (-O2):
define i64 @lcm(i64 %0, i64 %1) {
%3 = tail call i64 @size_min(i64 %0, i64 %1)
%4 = tail call i64 @size_max(i64 %0, i64 %1)
%5 = icmp eq i64 %3, 0
%6 = icmp eq i64 %4, 0
%7 = select i1 %5, i1 true, i1 %6
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = tail call i64 @gcd(i64 %3, i64 %4)
%10 = udiv i64 %4, %9
br label %11
11: ; preds = %2, %8
%12 = phi i64 [ %10, %8 ], [ 0, %2 ]
ret i64 %12
}