#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 */
long gcd(long, long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *, long *);
int main() {
  long x, y, MCD, mcm;
  printf("inserisci due numeri interi\n");
  scanf("%ld%ld", &x, &y);
  MCD = gcd(x, y);
  mcm = (x * y) / MCD;
  printf("Massimo comune divisore di %ld e %ld = %ld\n", x, y, MCD);
  printf("Minimo comune multiplo di %ld e %ld = %ld\n", x, y, mcm);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <gcd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1060 <gcd@plt>
mov    %rax,%rcx
mov    0x8(%rsp),%rsi
mov    (%rsp),%r8
mov    %r8,%rax
imul   %rsi,%rax
mov    %rcx,%rdx
or     %rax,%rdx
shr    $0x20,%rdx
je     119c <main+0x5c>
cqto
idiv   %rcx
mov    %rax,%rbx
jmp    11a2 <main+0x62>
xor    %edx,%edx
div    %ecx
mov    %eax,%ebx
lea    0xe5e(%rip),%rdi
mov    %r8,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
lea    0xe70(%rip),%rdi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"inserisci due numeri interi\0A\00"
@.str.1 = [7 x i8] c"%ld%ld\00"
@.str.2 = [44 x i8] c"Massimo comune divisore di %ld e %ld = %ld\0A\00"
@.str.3 = [43 x i8] c"Minimo comune multiplo di %ld e %ld = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %3)
%8 = load i64, i64* %2
%9 = load i64, i64* %3
%10 = call i64 @gcd(i64 %8, i64 %9)
store i64 %10, i64* %4
%11 = load i64, i64* %2
%12 = load i64, i64* %3
%13 = mul nsw i64 %11, %12
%14 = load i64, i64* %4
%15 = sdiv i64 %13, %14
store i64 %15, i64* %5
%16 = load i64, i64* %2
%17 = load i64, i64* %3
%18 = load i64, i64* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i64 %16, i64 %17, i64 %18)
%20 = load i64, i64* %2
%21 = load i64, i64* %3
%22 = load i64, i64* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i64 %20, i64 %21, i64 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%ld%ld\00"
@.str.2 = [44 x i8] c"Massimo comune divisore di %ld e %ld = %ld\0A\00"
@.str.3 = [43 x i8] c"Minimo comune multiplo di %ld e %ld = %ld\0A\00"
@str = [28 x i8] c"inserisci due numeri interi\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%7 = load i64, i64* %1
%8 = load i64, i64* %2
%9 = call i64 @gcd(i64 %7, i64 %8)
%10 = load i64, i64* %1
%11 = load i64, i64* %2
%12 = mul nsw i64 %11, %10
%13 = sdiv i64 %12, %9
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i64 %10, i64 %11, i64 %9)
%15 = load i64, i64* %1
%16 = load i64, i64* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i64 %15, i64 %16, i64 %13)
ret i32 0
}