#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 */
scalar_t__ divisibility(unsigned long, unsigned long);
int /*<<< orphan*/ printf(char *, unsigned long);
int main() {
  unsigned long int i, j, flag = 0;
  for (i = 1; !flag; i++) {
    for (j = 1; j <= 20; j++)
      flag += divisibility(i, j);
    if (flag == 20)
      flag = 1;
    else
      flag = 0;
  }
  printf("\nResult is %u", i - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x1,-0x10(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1156 <main+0x36>
jmp    11c5 <main+0xa5>
movq   $0x1,-0x18(%rbp)
cmpq   $0x14,-0x18(%rbp)
ja     118f <main+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <divisibility@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115e <main+0x3e>
cmpq   $0x14,-0x20(%rbp)
jne    11a7 <main+0x87>
movq   $0x1,-0x20(%rbp)
jmp    11af <main+0x8f>
movq   $0x0,-0x20(%rbp)
jmp    11b4 <main+0x94>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113f <main+0x1f>
mov    -0x10(%rbp),%rsi
sub    $0x1,%rsi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    $0x1,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
mov    $0x2,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x3,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x4,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x5,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x6,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x7,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x8,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x9,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0xa,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0xb,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0xc,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0xd,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0xe,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0xf,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x10,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x11,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x12,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r15
add    %r14,%r15
mov    $0x13,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
mov    %rax,%r14
add    %r15,%r14
mov    $0x14,%esi
mov    %rbx,%rdi
call   1040 <divisibility@plt>
add    %r14,%rax
cmp    $0x14,%rax
jne    1130 <main+0x10>
lea    0xd45(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0AResult is %u\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %4
store i64 1, i64* %2
br label %5
5: ; preds = %28, %0
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %31
9: ; preds = %5
store i64 1, i64* %3
br label %10
10: ; preds = %19, %9
%11 = load i64, i64* %3
%12 = icmp ule i64 %11, 20
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i64, i64* %2
%15 = load i64, i64* %3
%16 = call i64 @divisibility(i64 %14, i64 %15)
%17 = load i64, i64* %4
%18 = add i64 %17, %16
store i64 %18, i64* %4
br label %19
19: ; preds = %13
%20 = load i64, i64* %3
%21 = add i64 %20, 1
store i64 %21, i64* %3
br label %10
22: ; preds = %10
%23 = load i64, i64* %4
%24 = icmp eq i64 %23, 20
br i1 %24, label %25, label %26
25: ; preds = %22
store i64 1, i64* %4
br label %27
26: ; preds = %22
store i64 0, i64* %4
br label %27
27: ; preds = %26, %25
br label %28
28: ; preds = %27
%29 = load i64, i64* %2
%30 = add i64 %29, 1
store i64 %30, i64* %2
br label %5
31: ; preds = %5
%32 = load i64, i64* %2
%33 = sub i64 %32, 1
%34 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0AResult is %u\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 1, %0 ], [ %43, %1 ]
%3 = tail call i64 @divisibility(i64 %2, i64 1)
%4 = tail call i64 @divisibility(i64 %2, i64 2)
%5 = add i64 %4, %3
%6 = tail call i64 @divisibility(i64 %2, i64 3)
%7 = add i64 %6, %5
%8 = tail call i64 @divisibility(i64 %2, i64 4)
%9 = add i64 %8, %7
%10 = tail call i64 @divisibility(i64 %2, i64 5)
%11 = add i64 %10, %9
%12 = tail call i64 @divisibility(i64 %2, i64 6)
%13 = add i64 %12, %11
%14 = tail call i64 @divisibility(i64 %2, i64 7)
%15 = add i64 %14, %13
%16 = tail call i64 @divisibility(i64 %2, i64 8)
%17 = add i64 %16, %15
%18 = tail call i64 @divisibility(i64 %2, i64 9)
%19 = add i64 %18, %17
%20 = tail call i64 @divisibility(i64 %2, i64 10)
%21 = add i64 %20, %19
%22 = tail call i64 @divisibility(i64 %2, i64 11)
%23 = add i64 %22, %21
%24 = tail call i64 @divisibility(i64 %2, i64 12)
%25 = add i64 %24, %23
%26 = tail call i64 @divisibility(i64 %2, i64 13)
%27 = add i64 %26, %25
%28 = tail call i64 @divisibility(i64 %2, i64 14)
%29 = add i64 %28, %27
%30 = tail call i64 @divisibility(i64 %2, i64 15)
%31 = add i64 %30, %29
%32 = tail call i64 @divisibility(i64 %2, i64 16)
%33 = add i64 %32, %31
%34 = tail call i64 @divisibility(i64 %2, i64 17)
%35 = add i64 %34, %33
%36 = tail call i64 @divisibility(i64 %2, i64 18)
%37 = add i64 %36, %35
%38 = tail call i64 @divisibility(i64 %2, i64 19)
%39 = add i64 %38, %37
%40 = tail call i64 @divisibility(i64 %2, i64 20)
%41 = add i64 %40, %39
%42 = icmp eq i64 %41, 20
%43 = add i64 %2, 1
br i1 %42, label %44, label %1
44: ; preds = %1
%45 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}