#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 divisible(unsigned long n) {
  for (unsigned short j = 1; j < 20; j++) {
    if (n % j != 0) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<divisible>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movw   $0x1,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
cmp    $0x14,%eax
jge    1154 <divisible+0x54>
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     113e <divisible+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    115b <divisible+0x5b>
jmp    1143 <divisible+0x43>
mov    -0x12(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x12(%rbp)
jmp    110e <divisible+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisible>:
mov    %edi,%ecx
and    $0x1,%ecx
movabs $0xaaaaaaaaaaaaaaab,%r9
aa aa aa
mov    %rdi,%rax
mul    %r9
shr    %rdx
lea    (%rdx,%rdx,2),%rax
mov    %rdi,%rdx
sub    %rax,%rdx
or     %rcx,%rdx
mov    %edi,%eax
and    $0x3,%eax
or     %rdx,%rax
sete   %dl
movabs $0xcccccccccccccccd,%rsi
cc cc cc
imul   %rdi,%rsi
movabs $0x3333333333333334,%rcx
33 33 33
cmp    %rcx,%rsi
setb   %al
and    %dl,%al
imul   %rdi,%r9
mov    %r9,%rcx
ror    %rcx
movabs $0x2aaaaaaaaaaaaaab,%rdx
aa aa 2a
cmp    %rdx,%rcx
setb   %r8b
movabs $0x6db6db6db6db6db7,%r11
db b6 6d
imul   %rdi,%r11
movabs $0x2492492492492493,%rcx
49 92 24
cmp    %rcx,%r11
setb   %cl
and    %r8b,%cl
and    %al,%cl
test   $0x7,%dil
sete   %r10b
movabs $0x8e38e38e38e38e39,%r8
e3 38 8e
imul   %rdi,%r8
movabs $0x1c71c71c71c71c72,%rax
c7 71 1c
cmp    %rax,%r8
setb   %al
and    %r10b,%al
ror    %rsi
movabs $0x199999999999999a,%rdx
99 99 19
cmp    %rdx,%rsi
setb   %dl
and    %al,%dl
movabs $0x2e8ba2e8ba2e8ba3,%rax
a2 8b 2e
imul   %rdi,%rax
movabs $0x1745d1745d1745d2,%rsi
d1 45 17
cmp    %rsi,%rax
setb   %r10b
and    %dl,%r10b
and    %cl,%r10b
ror    $0x2,%r9
movabs $0x1555555555555556,%rcx
55 55 15
cmp    %rcx,%r9
setb   %cl
movabs $0x4ec4ec4ec4ec4ec5,%rdx
ec c4 4e
imul   %rdi,%rdx
movabs $0x13b13b13b13b13b2,%rsi
3b b1 13
cmp    %rsi,%rdx
setb   %dl
and    %cl,%dl
ror    %r11
movabs $0x124924924924924a,%rcx
24 49 12
cmp    %rcx,%r11
setb   %al
and    %dl,%al
movabs $0xeeeeeeeeeeeeeeef,%rcx
ee ee ee
imul   %rdi,%rcx
movabs $0x1111111111111112,%rdx
11 11 11
cmp    %rdx,%rcx
setb   %cl
and    %al,%cl
and    %r10b,%cl
test   $0xf,%dil
sete   %al
movabs $0xf0f0f0f0f0f0f0f1,%rdx
f0 f0 f0
imul   %rdi,%rdx
movabs $0xf0f0f0f0f0f0f10,%rsi
0f 0f 0f
cmp    %rsi,%rdx
setb   %dl
and    %al,%dl
ror    %r8
movabs $0xe38e38e38e38e39,%rax
e3 38 0e
cmp    %rax,%r8
setb   %al
and    %dl,%al
movabs $0x86bca1af286bca1b,%rdx
a1 bc 86
imul   %rdi,%rdx
movabs $0xd79435e50d79436,%rsi
43 79 0d
cmp    %rsi,%rdx
setb   %dl
and    %al,%dl
and    %cl,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @divisible(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i16
store i64 %0, i64* %3
store i16 1, i16* %4
br label %5
5: ; preds = %17, %1
%6 = load i16, i16* %4
%7 = zext i16 %6 to i32
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = load i64, i64* %3
%11 = load i16, i16* %4
%12 = zext i16 %11 to i64
%13 = urem i64 %10, %12
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %9
store i32 0, i32* %2
br label %21
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i16, i16* %4
%19 = add i16 %18, 1
store i16 %19, i16* %4
br label %5
20: ; preds = %5
store i32 1, i32* %2
br label %21
21: ; preds = %20, %15
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @divisible(i64 %0) {
%2 = and i64 %0, 1
%3 = icmp eq i64 %2, 0
%4 = urem i64 %0, 3
%5 = icmp eq i64 %4, 0
%6 = and i1 %3, %5
%7 = and i64 %0, 3
%8 = icmp eq i64 %7, 0
%9 = and i1 %6, %8
%10 = urem i64 %0, 5
%11 = icmp eq i64 %10, 0
%12 = and i1 %9, %11
%13 = urem i64 %0, 6
%14 = icmp eq i64 %13, 0
%15 = and i1 %12, %14
%16 = urem i64 %0, 7
%17 = icmp eq i64 %16, 0
%18 = and i1 %15, %17
%19 = and i64 %0, 7
%20 = icmp eq i64 %19, 0
%21 = and i1 %18, %20
%22 = urem i64 %0, 9
%23 = icmp eq i64 %22, 0
%24 = and i1 %21, %23
%25 = urem i64 %0, 10
%26 = icmp eq i64 %25, 0
%27 = and i1 %24, %26
%28 = urem i64 %0, 11
%29 = icmp eq i64 %28, 0
%30 = and i1 %27, %29
%31 = urem i64 %0, 12
%32 = icmp eq i64 %31, 0
%33 = and i1 %30, %32
%34 = urem i64 %0, 13
%35 = icmp eq i64 %34, 0
%36 = and i1 %33, %35
%37 = urem i64 %0, 14
%38 = icmp eq i64 %37, 0
%39 = and i1 %36, %38
%40 = urem i64 %0, 15
%41 = icmp eq i64 %40, 0
%42 = and i1 %39, %41
%43 = and i64 %0, 15
%44 = icmp eq i64 %43, 0
%45 = and i1 %42, %44
%46 = urem i64 %0, 17
%47 = icmp eq i64 %46, 0
%48 = and i1 %45, %47
%49 = urem i64 %0, 18
%50 = icmp eq i64 %49, 0
%51 = and i1 %48, %50
%52 = urem i64 %0, 19
%53 = icmp eq i64 %52, 0
%54 = and i1 %51, %53
%55 = select i1 %54, i32 1, i32 0
ret i32 %55
}