#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);
int main(void) {
  int foundIt = 0;
  for (int i = 20; i > 0; i++) {
    int a = 20;
    while (i % a == 0) {
      a--;
      if (a == 0) {
        foundIt = 1;
        break;
      }
    }
    if (foundIt == 1) {
      printf("this is it: %d", i);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11a3 <main+0x93>
movl   $0x14,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1172 <main+0x62>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    116d <main+0x5d>
movl   $0x1,-0x8(%rbp)
jmp    1172 <main+0x62>
jmp    113e <main+0x2e>
cmpl   $0x1,-0x8(%rbp)
jne    1190 <main+0x80>
mov    -0xc(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x93>
jmp    1195 <main+0x85>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x14,0x4(%rsp)
mov    $0x13,%esi
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
mov    %eax,%r8d
mov    %esi,%r12d
mov    %eax,%ebp
mov    %rbp,%r14
mov    $0xcccccccd,%eax
imul   %rax,%r14
imul   $0x38e38e39,%rbp,%r10
mov    %r8d,%edi
shr    %edi
mov    $0x92492493,%eax
imul   %rax,%rdi
mov    %rbp,%rax
mov    $0xf0f0f0f1,%ecx
imul   %rcx,%rax
shr    $0x24,%rax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
mov    %r10,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%edx
mov    %rbp,%rax
mov    $0xaf286bcb,%esi
imul   %rsi,%rax
shr    $0x20,%rax
mov    %r8d,%esi
sub    %eax,%esi
shr    %esi
add    %eax,%esi
shr    $0x4,%esi
lea    (%rsi,%rsi,8),%eax
lea    (%rsi,%rax,2),%eax
mov    %r14,%rsi
shr    $0x24,%rsi
shl    $0x2,%esi
lea    (%rsi,%rsi,4),%esi
neg    %esi
add    %r12d,%esi
add    $0x1,%esi
neg    %eax
add    %r12d,%eax
add    $0x1,%eax
neg    %edx
or     %esi,%eax
lea    0x1(%r12),%esi
lea    0x1(%r8),%eax
mov    %eax,0x4(%rsp)
jne    1130 <main+0x20>
shr    $0x22,%rdi
mov    %rbp,%rbx
mov    $0x88888889,%eax
imul   %rax,%rbx
neg    %ecx
lea    (%r12,%rdx,1),%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
mov    %edi,%eax
shl    $0x4,%eax
shr    $0x23,%rbx
mov    %esi,%edx
and    $0xf,%edx
add    %r12d,%ecx
add    $0x14,%ecx
cmp    $0x13,%ecx
jne    1130 <main+0x20>
mov    %rbp,%r13
mov    $0xaaaaaaab,%ecx
imul   %rcx,%r13
imul   $0x4ec4ec4f,%rbp,%r11
mov    %edi,%r15d
sub    %eax,%r15d
lea    (%rbx,%rbx,4),%eax
lea    (%rax,%rax,2),%eax
neg    %eax
test   %edx,%edx
jne    1130 <main+0x20>
imul   $0x24924925,%rbp,%r9
mov    %r13,%rdx
shr    $0x23,%rdx
shr    $0x22,%r11
add    %r15d,%edi
add    %r12d,%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
shr    $0x20,%r9
mov    $0xba2e8ba3,%eax
imul   %rax,%rbp
shl    $0x2,%edx
lea    (%r11,%r11,2),%eax
lea    (%r11,%rax,4),%ebx
neg    %ebx
lea    (%r12,%rdi,1),%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
sub    %r9d,%r8d
mov    %r14,%rdi
shr    $0x23,%rdi
shr    $0x23,%rbp
lea    (%rdx,%rdx,2),%edx
neg    %edx
lea    (%r12,%rbx,1),%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
shr    %r8d
add    %edi,%edi
lea    0x0(%rbp,%rbp,4),%eax
lea    0x0(%rbp,%rax,2),%ebp
neg    %ebp
lea    (%r12,%rdx,1),%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
add    %r9d,%r8d
shr    $0x21,%r10
lea    (%rdi,%rdi,4),%edx
neg    %edx
lea    (%r12,%rbp,1),%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
shr    $0x2,%r8d
lea    (%r10,%r10,8),%eax
neg    %eax
add    %r12d,%edx
add    $0x14,%edx
cmp    $0x13,%edx
jne    1130 <main+0x20>
mov    %r13,%rdx
shr    $0x22,%rdx
lea    0x0(,%r8,8),%ebp
mov    %esi,%edi
and    $0x7,%edi
add    %r12d,%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
add    %edx,%edx
sub    %ebp,%r8d
test   %edi,%edi
jne    1130 <main+0x20>
shr    $0x22,%r14
lea    (%rdx,%rdx,2),%eax
neg    %eax
lea    (%r12,%r8,1),%edx
add    $0x14,%edx
cmp    $0x13,%edx
jne    1130 <main+0x20>
lea    (%r14,%r14,4),%edx
neg    %edx
add    %r12d,%eax
add    $0x14,%eax
cmp    $0x13,%eax
jne    1130 <main+0x20>
shr    $0x21,%r13
mov    %esi,%eax
and    $0x3,%eax
add    %r12d,%edx
add    $0x14,%edx
cmp    $0x13,%edx
jne    1130 <main+0x20>
lea    0x0(%r13,%r13,2),%ecx
neg    %ecx
test   %eax,%eax
jne    1130 <main+0x20>
mov    %esi,%eax
and    $0x1,%eax
add    %r12d,%ecx
add    $0x14,%ecx
cmp    $0x13,%ecx
jne    1130 <main+0x20>
test   %eax,%eax
jne    1130 <main+0x20>
lea    0xc55(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"this is it: %d\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 20, %0 ], [ %58, %1 ]
%3 = urem i32 %2, 20
%4 = urem i32 %2, 19
%5 = or i32 %3, %4
%6 = icmp eq i32 %5, 0
%7 = urem i32 %2, 18
%8 = icmp eq i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
%10 = urem i32 %2, 17
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
%13 = and i32 %2, 15
%14 = icmp eq i32 %13, 0
%15 = select i1 %12, i1 %14, i1 false
%16 = urem i32 %2, 15
%17 = icmp eq i32 %16, 0
%18 = select i1 %15, i1 %17, i1 false
%19 = urem i32 %2, 14
%20 = icmp eq i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
%22 = urem i32 %2, 13
%23 = icmp eq i32 %22, 0
%24 = select i1 %21, i1 %23, i1 false
%25 = urem i32 %2, 12
%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, 10
%32 = icmp eq i32 %31, 0
%33 = select i1 %30, i1 %32, i1 false
%34 = urem i32 %2, 9
%35 = icmp eq i32 %34, 0
%36 = select i1 %33, i1 %35, i1 false
%37 = and i32 %2, 7
%38 = icmp eq i32 %37, 0
%39 = select i1 %36, i1 %38, i1 false
%40 = urem i32 %2, 7
%41 = icmp eq i32 %40, 0
%42 = select i1 %39, i1 %41, i1 false
%43 = urem i32 %2, 6
%44 = icmp eq i32 %43, 0
%45 = select i1 %42, i1 %44, i1 false
%46 = urem i32 %2, 5
%47 = icmp eq i32 %46, 0
%48 = select i1 %45, i1 %47, i1 false
%49 = and i32 %2, 3
%50 = icmp eq i32 %49, 0
%51 = select i1 %48, i1 %50, i1 false
%52 = urem i32 %2, 3
%53 = icmp eq i32 %52, 0
%54 = select i1 %51, i1 %53, i1 false
%55 = and i32 %2, 1
%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
%60 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}