int is_divisible(int num) {
  for (int i = 19; i > 10; i--) {
    if (num % i != 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_divisible>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x13,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    1147 <is_divisible+0x47>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
je     1134 <is_divisible+0x34>
movl   $0x0,-0x4(%rbp)
jmp    114e <is_divisible+0x4e>
jmp    1139 <is_divisible+0x39>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_divisible+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_divisible>:
movslq %edi,%rcx
imul   $0x6bca1af3,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
sar    $0x3,%eax
add    %edx,%eax
lea    (%rax,%rax,8),%edx
lea    (%rax,%rdx,2),%eax
mov    %ecx,%edx
sub    %eax,%edx
imul   $0x38e38e39,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rax
sar    $0x2,%eax
add    %esi,%eax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %ecx,%esi
sub    %eax,%esi
or     %edx,%esi
imul   $0x78787879,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
sar    $0x3,%eax
add    %edx,%eax
mov    %eax,%edx
shl    $0x4,%edx
add    %eax,%edx
mov    %ecx,%eax
sub    %edx,%eax
mov    %ecx,%edx
and    $0xf,%edx
or     %eax,%edx
or     %esi,%edx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%esi
shr    $0x1f,%esi
sar    $0x3,%eax
add    %esi,%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%esi
mov    %ecx,%eax
sub    %esi,%eax
or     %edx,%eax
imul   $0xffffffff92492493,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x3,%edx
add    %esi,%edx
mov    %edx,%esi
shl    $0x4,%esi
mov    %edx,%edi
sub    %esi,%edi
add    %edx,%edi
add    %ecx,%edi
imul   $0x4ec4ec4f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,2),%esi
lea    (%rdx,%rsi,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
or     %edi,%esi
or     %eax,%esi
imul   $0x2aaaaaab,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rax
add    %edx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %ecx,%edx
sub    %eax,%edx
or     %esi,%edx
imul   $0x2e8ba2e9,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rax
add    %esi,%eax
lea    (%rax,%rax,4),%esi
lea    (%rax,%rsi,2),%eax
sub    %eax,%ecx
xor    %eax,%eax
or     %edx,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @is_divisible(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 19, i32* %4
br label %5
5: ; preds = %15, %1
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 10
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%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 %19
14: ; preds = %8
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
br label %5
18: ; preds = %5
store i32 1, i32* %2
br label %19
19: ; preds = %18, %13
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @is_divisible(i32 %0) {
%2 = srem i32 %0, 19
%3 = srem i32 %0, 18
%4 = or i32 %2, %3
%5 = srem i32 %0, 17
%6 = or i32 %4, %5
%7 = and i32 %0, 15
%8 = or i32 %6, %7
%9 = srem i32 %0, 15
%10 = or i32 %8, %9
%11 = srem i32 %0, 14
%12 = or i32 %10, %11
%13 = srem i32 %0, 13
%14 = or i32 %12, %13
%15 = srem i32 %0, 12
%16 = or i32 %14, %15
%17 = srem i32 %0, 11
%18 = or i32 %16, %17
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
ret i32 %20
}