#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 gcd(unsigned int, unsigned int);
int /*<<< orphan*/ gets(char *);
int lcm(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int main(int argc, char *argv[]) {
  char str01[32], str02[32];
  unsigned int n1, n2;
  printf("give me a natural number: ");
  gets(str01);
  sscanf(str01, "%u", &n1);
  printf("give me a natural number: ");
  gets(str02);
  sscanf(str02, "%u", &n2);
  printf("lcm(%u,%u)=%u\n", n1, n2, lcm(n1, n2));
  printf("gcd(%u,%u)=%u\n", n1, n2, gcd(n1, n2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x30(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    -0x54(%rbp),%rdx
call   1060 <sscanf@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x50(%rbp),%rdi
lea    0xe68(%rip),%rsi
lea    -0x58(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1040 <lcm@plt>
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    %eax,%ecx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1070 <gcd@plt>
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    %eax,%ecx
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xe9f(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xe9c(%rip),%r15
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sscanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <sscanf@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <lcm@plt>
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <gcd@plt>
lea    0xe3a(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"give me a natural number: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [15 x i8] c"lcm(%u,%u)=%u\0A\00"
@.str.3 = [15 x i8] c"gcd(%u,%u)=%u\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8]
%7 = alloca [32 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%17 = call i32 @gets(i8* %16)
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = call i32 @lcm(i32 %22, i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21, i32 %24)
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = call i32 @gcd(i32 %28, i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"give me a natural number: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [15 x i8] c"lcm(%u,%u)=%u\0A\00"
@.str.3 = [15 x i8] c"gcd(%u,%u)=%u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @gets(i8* %7)
%13 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @gets(i8* %8)
%16 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @lcm(i32 %17, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @gcd(i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
ret i32 0
}