int solve() {
  for (int i = 2520;; i++) {
    int found = 0;
    for (int j = 2; j <= 20; j++) {
      if (i % j != 0) {
        found = 0;
        break;
      }
      found = 1;
    }
    if (found)
      return i;
  }
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
movl   $0x9d8,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jg     1154 <solve+0x54>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
je     113f <solve+0x3f>
movl   $0x0,-0x8(%rbp)
jmp    1154 <solve+0x54>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <solve+0x19>
cmpl   $0x0,-0x8(%rbp)
je     1163 <solve+0x63>
mov    -0x4(%rbp),%eax
pop    %rbp
ret
jmp    1168 <solve+0x68>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <solve+0xb>

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movl   $0x9d8,-0x4(%rsp)
mov    $0x9d7,%eax
nopw   0x0(%rax,%rax,1)
mov    -0x4(%rsp),%ecx
mov    %ecx,%r8d
mov    %eax,%r12d
mov    %ecx,%r9d
mov    %r9,%r13
mov    $0xcccccccd,%eax
imul   %rax,%r13
lea    0x1(%r12),%eax
mov    %r9,%r14
mov    $0xaaaaaaab,%ecx
imul   %rcx,%r14
imul   $0x24924925,%r9,%rcx
shr    $0x20,%rcx
mov    %r8d,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
mov    %r14,%rcx
shr    $0x22,%rcx
mov    %r13,%r10
shr    $0x22,%r10
mov    %r14,%rdi
shr    $0x21,%rdi
lea    (%rdi,%rdi,2),%edi
mov    %eax,%ebp
and    $0x1,%ebp
neg    %edi
lea    (%r12,%rdi,1),%esi
add    $0x1,%esi
mov    %eax,%edi
and    $0x3,%edi
lea    0x1(%r8),%ebx
mov    %ebx,-0x4(%rsp)
or     %ebp,%esi
jne    1120 <solve+0x20>
shr    $0x2,%edx
add    %ecx,%ecx
lea    (%r10,%r10,4),%ebp
neg    %ebp
test   %edi,%edi
jne    1120 <solve+0x20>
lea    0x0(,%rdx,8),%edi
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%r12,%rbp,1),%esi
add    $0x9d8,%esi
cmp    $0x9d7,%esi
jne    1120 <solve+0x20>
imul   $0x38e38e39,%r9,%r11
sub    %edi,%edx
add    %r12d,%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
mov    %r13,%rcx
shr    $0x23,%rcx
mov    %r11,%rbp
shr    $0x21,%rbp
mov    %eax,%edi
and    $0x7,%edi
add    %r12d,%edx
add    $0x9d8,%edx
cmp    $0x9d7,%edx
jne    1120 <solve+0x20>
mov    %r8d,%edx
shr    %edx
mov    %r9,%rbx
mov    $0xba2e8ba3,%esi
imul   %rsi,%rbx
add    %ecx,%ecx
lea    0x0(%rbp,%rbp,8),%ebp
neg    %ebp
test   %edi,%edi
jne    1120 <solve+0x20>
mov    $0x92492493,%esi
imul   %rsi,%rdx
shr    $0x23,%r14
shr    $0x23,%rbx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%r12,%rbp,1),%esi
add    $0x9d8,%esi
cmp    $0x9d7,%esi
jne    1120 <solve+0x20>
shr    $0x22,%rdx
imul   $0x4ec4ec4f,%r9,%r10
shl    $0x2,%r14d
lea    (%rbx,%rbx,4),%esi
lea    (%rbx,%rsi,2),%edi
neg    %edi
add    %r12d,%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
mov    %edx,%r15d
shl    $0x4,%r15d
shr    $0x22,%r10
lea    (%r14,%r14,2),%ecx
neg    %ecx
lea    (%r12,%rdi,1),%esi
add    $0x9d8,%esi
cmp    $0x9d7,%esi
jne    1120 <solve+0x20>
mov    %r9,%rbx
mov    $0xaf286bcb,%esi
imul   %rsi,%rbx
mov    %r9,%rbp
mov    $0xf0f0f0f1,%esi
imul   %rsi,%rbp
mov    $0x88888889,%esi
imul   %rsi,%r9
mov    %edx,%r14d
sub    %r15d,%r14d
lea    (%r10,%r10,2),%esi
lea    (%r10,%rsi,4),%edi
neg    %edi
add    %r12d,%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
shr    $0x20,%rbx
shr    $0x24,%rbp
shr    $0x23,%r9
add    %r14d,%edx
lea    (%r12,%rdi,1),%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
sub    %ebx,%r8d
mov    %ebp,%ecx
shl    $0x4,%ecx
lea    (%r9,%r9,4),%esi
lea    (%rsi,%rsi,2),%esi
neg    %esi
add    %r12d,%edx
add    $0x9d8,%edx
cmp    $0x9d7,%edx
jne    1120 <solve+0x20>
shr    %r8d
shr    $0x22,%r11
add    %ecx,%ebp
mov    %eax,%ecx
and    $0xf,%ecx
lea    (%r12,%rsi,1),%edx
add    $0x9d8,%edx
cmp    $0x9d7,%edx
jne    1120 <solve+0x20>
add    %ebx,%r8d
add    %r11d,%r11d
neg    %ebp
test   %ecx,%ecx
jne    1120 <solve+0x20>
shr    $0x24,%r13
shr    $0x4,%r8d
lea    (%r11,%r11,8),%ecx
neg    %ecx
lea    (%r12,%rbp,1),%edx
add    $0x9d8,%edx
cmp    $0x9d7,%edx
jne    1120 <solve+0x20>
shl    $0x2,%r13d
lea    (%r8,%r8,8),%edx
lea    (%r8,%rdx,2),%edx
neg    %edx
add    %r12d,%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
lea    0x0(%r13,%r13,4),%ecx
neg    %ecx
add    %r12d,%edx
add    $0x9d8,%edx
cmp    $0x9d7,%edx
jne    1120 <solve+0x20>
add    %r12d,%ecx
add    $0x9d8,%ecx
cmp    $0x9d7,%ecx
jne    1120 <solve+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @solve() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 2520, i32* %1
br label %4
4: ; preds = %24, %0
store i32 0, i32* %2
store i32 2, i32* %3
br label %5
5: ; preds = %15, %4
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 20
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %1
%10 = load i32, i32* %3
%11 = srem i32 %9, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 0, i32* %2
br label %18
14: ; preds = %8
store i32 1, i32* %2
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %13, %5
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* %1
ret i32 %22
23: ; preds = %18
br label %24
24: ; preds = %23
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %4
}

LLVM IR (-O2):
define i32 @solve() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 2520, %0 ], [ %58, %1 ]
%3 = and i32 %2, 1
%4 = urem i32 %2, 3
%5 = or i32 %3, %4
%6 = icmp eq i32 %5, 0
%7 = and i32 %2, 3
%8 = icmp eq i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
%10 = urem i32 %2, 5
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
%13 = urem i32 %2, 6
%14 = icmp eq i32 %13, 0
%15 = select i1 %12, i1 %14, i1 false
%16 = urem i32 %2, 7
%17 = icmp eq i32 %16, 0
%18 = select i1 %15, i1 %17, i1 false
%19 = and i32 %2, 7
%20 = icmp eq i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
%22 = urem i32 %2, 9
%23 = icmp eq i32 %22, 0
%24 = select i1 %21, i1 %23, i1 false
%25 = urem i32 %2, 10
%26 = icmp eq i32 %25, 0
%27 = select i1 %24, i1 %26, i1 false
%28 = urem i32 %2, 11
%29 = icmp eq i32 %28, 0
%30 = select i1 %27, i1 %29, i1 false
%31 = urem i32 %2, 12
%32 = icmp eq i32 %31, 0
%33 = select i1 %30, i1 %32, i1 false
%34 = urem i32 %2, 13
%35 = icmp eq i32 %34, 0
%36 = select i1 %33, i1 %35, i1 false
%37 = urem i32 %2, 14
%38 = icmp eq i32 %37, 0
%39 = select i1 %36, i1 %38, i1 false
%40 = urem i32 %2, 15
%41 = icmp eq i32 %40, 0
%42 = select i1 %39, i1 %41, i1 false
%43 = and i32 %2, 15
%44 = icmp eq i32 %43, 0
%45 = select i1 %42, i1 %44, i1 false
%46 = urem i32 %2, 17
%47 = icmp eq i32 %46, 0
%48 = select i1 %45, i1 %47, i1 false
%49 = urem i32 %2, 18
%50 = icmp eq i32 %49, 0
%51 = select i1 %48, i1 %50, i1 false
%52 = urem i32 %2, 19
%53 = icmp eq i32 %52, 0
%54 = select i1 %51, i1 %53, i1 false
%55 = urem i32 %2, 20
%56 = icmp eq i32 %55, 0
%57 = select i1 %54, i1 %56, i1 false
%58 = add nuw nsw i32 %2, 1
br i1 %57, label %59, label %1
59: ; preds = %1
ret i32 %2
}