#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);
void test(int count) {
  int i;
  for (i = 1; i < count; i++) {
    if (i % 3 == 0)
      printf("%d is divisible by 3\n", i);
    if (i % 11 == 0)
      printf("%d is divisible by 11\n", i);
    if (i % 13 == 0)
      printf("%d is divisible by 13\n", i);
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11aa <test+0x9a>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1151 <test+0x41>
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1174 <test+0x64>
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1197 <test+0x87>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    119c <test+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <test+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11d9 <test+0xc9>
mov    %edi,%r13d
mov    $0x1,%ebp
mov    $0xba2e8ba3,%r14d
jmp    114c <test+0x3c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
cmp    %ebp,%r13d
je     11d9 <test+0xc9>
mov    %ebp,%eax
mov    %rax,%rcx
mov    $0xaaaaaaab,%edx
imul   %rdx,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%ecx
imul   $0x4ec4ec4f,%rax,%r15
imul   %r14,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%edx
lea    (%rax,%rdx,2),%eax
mov    $0x1,%r12d
sub    %eax,%r12d
shr    $0x22,%r15
cmp    %ecx,%ebp
jne    1195 <test+0x85>
lea    0xe72(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    (%r15,%r15,2),%eax
lea    (%r15,%rax,4),%eax
mov    $0x1,%ebx
sub    %eax,%ebx
add    %ebp,%r12d
cmp    $0x1,%r12d
jne    11bb <test+0xab>
lea    0xe62(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    %ebp,%ebx
cmp    $0x1,%ebx
jne    1140 <test+0x30>
lea    0xe60(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
jmp    1140 <test+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"%d is divisible by 3\0A\00"
@.str.1 = [23 x i8] c"%d is divisible by 11\0A\00"
@.str.2 = [23 x i8] c"%d is divisible by 13\0A\00"
define void @test(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %22
3: ; preds = %1, %19
%4 = phi i32 [ %20, %19 ], [ 1, %1 ]
%5 = urem i32 %4, 3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %9
9: ; preds = %7, %3
%10 = urem i32 %4, 11
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %4)
br label %14
14: ; preds = %12, %9
%15 = urem i32 %4, 13
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %4)
br label %19
19: ; preds = %14, %17
%20 = add nuw nsw i32 %4, 1
%21 = icmp eq i32 %20, %0
br i1 %21, label %22, label %3
22: ; preds = %19, %1
ret void
}