#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *number;
  printf("2520 is the smallest number that can be divided by each of the "
         "numbers from 1 to 10 without any remainder.\n");
  printf(
      "please provide a number and the smallest multiple that can be created "
      "using a sequence from one to the number will be calculated.\n");
  printf("number: ");
  scanf("%d", number);
  int i = 0;
  unsigned long multiple = 0;
  int div = 0;
  while (div == 0) {
    i++;
    int c = 1;
    div = 1;
    for (c; c < *number; c++) {
      if (i % c != 0) {
        div = 0;
        break;
      }
    }
    if (div == 1) {
      multiple = i;
    }
  }
  printf("%lu\n", multiple);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xf94(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11f5 <main+0xd5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11de <main+0xbe>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x28(%rbp)
cmp    $0x0,%edx
je     11cb <main+0xab>
movl   $0x0,-0x24(%rbp)
jmp    11de <main+0xbe>
jmp    11d0 <main+0xb0>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a0 <main+0x80>
cmpl   $0x1,-0x24(%rbp)
jne    11f0 <main+0xd0>
movslq -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    117f <main+0x5f>
mov    -0x20(%rbp),%rsi
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1050 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [108 x i8] c"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\0A\00"
@.str.1 = [131 x i8] c"please provide a number and the smallest multiple that can be created using a sequence from one to the number will be calculated.\0A\00"
@.str.2 = [9 x i8] c"number: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32*, i32** %2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %10)
store i32 0, i32* %3
store i64 0, i64* %4
store i32 0, i32* %5
br label %12
12: ; preds = %40, %0
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %41
15: ; preds = %12
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
store i32 1, i32* %6
store i32 1, i32* %5
%18 = load i32, i32* %6
br label %19
19: ; preds = %31, %15
%20 = load i32, i32* %6
%21 = load i32*, i32** %2
%22 = load i32, i32* %21
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %34
24: ; preds = %19
%25 = load i32, i32* %3
%26 = load i32, i32* %6
%27 = srem i32 %25, %26
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 0, i32* %5
br label %34
30: ; preds = %24
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %19
34: ; preds = %29, %19
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
store i64 %39, i64* %4
br label %40
40: ; preds = %37, %34
br label %12
41: ; preds = %12
%42 = load i64, i64* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %42)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"number: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [5 x i8] c"%lu\0A\00"
@str = [107 x i8] c"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\00"
@str.5 = [130 x i8] c"please provide a number and the smallest multiple that can be created using a sequence from one to the number will be calculated.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([107 x i8], [107 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([130 x i8], [130 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* undef)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 1)
ret i32 0
}