#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*/ build_value(unsigned long long, int /*<<< orphan*/);
unsigned long long extract_value(long long, int *);
long long intMultiply(int /*<<< orphan*/, int /*<<< orphan*/);
unsigned long long int_gcd(unsigned long long, unsigned long long);
int /*<<< orphan*/ mask_value(unsigned long long);
long long int intLCM(long long int y, long long int x) {
  int s;
  unsigned long long int xv = extract_value(x, &s);
  unsigned long long int yv = extract_value(y, &s);
  unsigned long long int gcd;
  if (xv == 0 || yv == 0)
    return 0;
  gcd = int_gcd(xv, yv);
  return intMultiply(mask_value(xv / gcd), build_value(yv, 0));
}


x86 assembly (clang, -O0):
<intLCM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <extract_value@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <extract_value@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1198 <intLCM+0x48>
cmpq   $0x0,-0x30(%rbp)
jne    11a5 <intLCM+0x55>
movq   $0x0,-0x8(%rbp)
jmp    11e6 <intLCM+0x96>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <int_gcd@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x38(%rbp)
mov    %rax,%rdi
call   1050 <mask_value@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1030 <build_value@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1040 <intMultiply@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intLCM>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%r14
mov    %rsi,%rdi
mov    %r14,%rsi
call   1060 <extract_value@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <extract_value@plt>
mov    %rax,%r14
xor    %eax,%eax
test   %r15,%r15
je     11d3 <intLCM+0x83>
test   %r14,%r14
je     11d3 <intLCM+0x83>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <int_gcd@plt>
mov    %rax,%rcx
mov    %r15,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     11b0 <intLCM+0x60>
mov    %r15,%rax
xor    %edx,%edx
div    %rcx
mov    %rax,%rdi
jmp    11b9 <intLCM+0x69>
mov    %r15d,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1050 <mask_value@plt>
mov    %eax,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <build_value@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <intMultiply@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @intLCM(i64 %0, i64 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @extract_value(i64 %1, i32* %3)
%6 = call i64 @extract_value(i64 %0, i32* %3)
%7 = icmp eq i64 %5, 0
%8 = icmp eq i64 %6, 0
%9 = select i1 %7, i1 true, i1 %8
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = call i64 @int_gcd(i64 %5, i64 %6)
%12 = udiv i64 %5, %11
%13 = call i32 @mask_value(i64 %12)
%14 = call i32 @build_value(i64 %6, i32 0)
%15 = call i64 @intMultiply(i32 %13, i32 %14)
br label %16
16: ; preds = %2, %10
%17 = phi i64 [ %15, %10 ], [ 0, %2 ]
ret i64 %17
}