#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 lcm(long, long);
int /*<<< orphan*/ printf(char *, long);
void fun() {
  long int i;
  long int val = 1;
  for (i = 2; i < 21; i++)
    val = lcm(val, i);
  printf("%d\n", val);
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x1,-0x10(%rbp)
movq   $0x2,-0x8(%rbp)
cmpq   $0x15,-0x8(%rbp)
jge    1165 <fun+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <lcm@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1138 <fun+0x18>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <lcm@plt>
mov    $0x3,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x4,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x5,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x6,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x7,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x8,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x9,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xa,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xb,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xc,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xd,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xe,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0xf,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x10,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x11,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x12,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x13,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
mov    $0x14,%esi
mov    %rax,%rdi
call   1040 <lcm@plt>
lea    0xddf(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @fun() {
%1 = alloca i64
%2 = alloca i64
store i64 1, i64* %2
store i64 2, i64* %1
br label %3
3: ; preds = %10, %0
%4 = load i64, i64* %1
%5 = icmp slt i64 %4, 21
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i64, i64* %2
%8 = load i64, i64* %1
%9 = call i64 @lcm(i64 %7, i64 %8)
store i64 %9, i64* %2
br label %10
10: ; preds = %6
%11 = load i64, i64* %1
%12 = add nsw i64 %11, 1
store i64 %12, i64* %1
br label %3
13: ; preds = %3
%14 = load i64, i64* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %14)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @fun() {
%1 = tail call i64 @lcm(i64 1, i64 2)
%2 = tail call i64 @lcm(i64 %1, i64 3)
%3 = tail call i64 @lcm(i64 %2, i64 4)
%4 = tail call i64 @lcm(i64 %3, i64 5)
%5 = tail call i64 @lcm(i64 %4, i64 6)
%6 = tail call i64 @lcm(i64 %5, i64 7)
%7 = tail call i64 @lcm(i64 %6, i64 8)
%8 = tail call i64 @lcm(i64 %7, i64 9)
%9 = tail call i64 @lcm(i64 %8, i64 10)
%10 = tail call i64 @lcm(i64 %9, i64 11)
%11 = tail call i64 @lcm(i64 %10, i64 12)
%12 = tail call i64 @lcm(i64 %11, i64 13)
%13 = tail call i64 @lcm(i64 %12, i64 14)
%14 = tail call i64 @lcm(i64 %13, i64 15)
%15 = tail call i64 @lcm(i64 %14, i64 16)
%16 = tail call i64 @lcm(i64 %15, i64 17)
%17 = tail call i64 @lcm(i64 %16, i64 18)
%18 = tail call i64 @lcm(i64 %17, i64 19)
%19 = tail call i64 @lcm(i64 %18, i64 20)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %19)
ret void
}