#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 main(void) {
  long count, product;
  product = 1;
  for (count = 2; count <= 20; count++) {
    printf("%li - ", count);
    if (product % count) {
      product = product * count;
      printf("ok - %li\n", product);
    } else
      printf("fail\n");
  }
  printf("Smallest Multiple: %li\n", product / 24);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x2,-0x10(%rbp)
cmpq   $0x14,-0x10(%rbp)
jg     11a8 <main+0x98>
mov    -0x10(%rbp),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
je     1184 <main+0x74>
mov    -0x18(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1192 <main+0x82>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <main+0x87>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <main+0x1f>
mov    -0x18(%rbp),%rax
mov    $0x18,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x2,%ebx
mov    $0x1,%r14d
lea    0xec5(%rip),%r15
lea    0xee7(%rip),%r12
lea    0xebe(%rip),%r13
jmp    1162 <main+0x42>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    $0x15,%rbx
je     11af <main+0x8f>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1190 <main+0x70>
mov    %r14,%rax
cqto
idiv   %rbx
test   %rdx,%rdx
jne    119c <main+0x7c>
jmp    1150 <main+0x30>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     1150 <main+0x30>
imul   %rbx,%r14
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1158 <main+0x38>
movabs $0x2aaaaaaaaaaaaaab,%rcx
aa aa 2a
mov    %r14,%rax
imul   %rcx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x2,%rdx
add    %rdx,%rsi
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%li - \00"
@.str.1 = [10 x i8] c"ok - %li\0A\00"
@.str.2 = [6 x i8] c"fail\0A\00"
@.str.3 = [24 x i8] c"Smallest Multiple: %li\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 1, i64* %3
store i64 2, i64* %2
br label %4
4: ; preds = %23, %0
%5 = load i64, i64* %2
%6 = icmp sle i64 %5, 20
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = load i64, i64* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = load i64, i64* %3
%11 = load i64, i64* %2
%12 = srem i64 %10, %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %7
%15 = load i64, i64* %3
%16 = load i64, i64* %2
%17 = mul nsw i64 %15, %16
store i64 %17, i64* %3
%18 = load i64, i64* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %18)
br label %22
20: ; preds = %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %14
br label %23
23: ; preds = %22
%24 = load i64, i64* %2
%25 = add nsw i64 %24, 1
store i64 %25, i64* %2
br label %4
26: ; preds = %4
%27 = load i64, i64* %3
%28 = sdiv i64 %27, 24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i64 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%li - \00"
@.str.1 = [10 x i8] c"ok - %li\0A\00"
@.str.3 = [24 x i8] c"Smallest Multiple: %li\0A\00"
@str = [5 x i8] c"fail\00"
define i32 @main() {
br label %1
1: ; preds = %0, %12
%2 = phi i64 [ 1, %0 ], [ %13, %12 ]
%3 = phi i64 [ 2, %0 ], [ %14, %12 ]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = srem i64 %2, %3
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = mul nsw i64 %2, %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %8)
br label %12
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %7, %10
%13 = phi i64 [ %8, %7 ], [ %2, %10 ]
%14 = add nuw nsw i64 %3, 1
%15 = icmp eq i64 %14, 21
br i1 %15, label %16, label %1
16: ; preds = %12
%17 = sdiv i64 %13, 24
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i64 %17)
ret i32 0
}