#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 limited_primes(int lower, int upper) {
  int x, nr;
  for (nr = lower; nr <= upper; nr++) {
    if (nr == 2 || nr == 5)
      printf("\n\t%d", nr);
    else if (nr % 2 == 0 || nr % 5 == 0)
      continue;
    else
      for (x = 3; x < nr; x += 2)
        if (nr % x == 0)
          x = nr;
        else
          printf("\n\t%d", nr);
  }
}


x86 assembly (clang, -O0):
<limited_primes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f2 <limited_primes+0xe2>
cmpl   $0x2,-0x10(%rbp)
je     1144 <limited_primes+0x34>
cmpl   $0x5,-0x10(%rbp)
jne    1158 <limited_primes+0x48>
mov    -0x10(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    11df <limited_primes+0xcf>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1180 <limited_primes+0x70>
mov    -0x10(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1185 <limited_primes+0x75>
jmp    11e4 <limited_primes+0xd4>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d5 <limited_primes+0xc5>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11b3 <limited_primes+0xa3>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11c2 <limited_primes+0xb2>
mov    -0x10(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    11c7 <limited_primes+0xb7>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    118c <limited_primes+0x7c>
jmp    11da <limited_primes+0xca>
jmp    11df <limited_primes+0xcf>
jmp    11e4 <limited_primes+0xd4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <limited_primes+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limited_primes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %esi,%edi
jle    1126 <limited_primes+0x16>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %esi,%r14d
mov    %edi,%ebx
lea    0xece(%rip),%r15
jmp    1154 <limited_primes+0x44>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
je     111b <limited_primes+0xb>
cmp    $0x5,%ebx
je     1140 <limited_primes+0x30>
cmp    $0x2,%ebx
je     1140 <limited_primes+0x30>
test   $0x1,%bl
je     114a <limited_primes+0x3a>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
je     114a <limited_primes+0x3a>
cmp    $0x4,%ebx
jl     114a <limited_primes+0x3a>
mov    $0x3,%ebp
jmp    1199 <limited_primes+0x89>
nop
add    $0x2,%eax
mov    %eax,%ebp
cmp    %ebx,%eax
jge    114a <limited_primes+0x3a>
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %ebx,%eax
test   %edx,%edx
je     1190 <limited_primes+0x80>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebp,%eax
jmp    1190 <limited_primes+0x80>

LLVM IR (-O0):
@.str = [5 x i8] c"\0A\09%d\00"
define void @limited_primes(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
store i32 %7, i32* %6
br label %8
8: ; preds = %52, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %55
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 2
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 5
br i1 %17, label %18, label %21
18: ; preds = %15, %12
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %51
21: ; preds = %15
%22 = load i32, i32* %6
%23 = srem i32 %22, 2
%24 = icmp eq i32 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i32, i32* %6
%27 = srem i32 %26, 5
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25, %21
br label %52
30: ; preds = %25
store i32 3, i32* %5
br label %31
31: ; preds = %46, %30
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %49
35: ; preds = %31
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = srem i32 %36, %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = load i32, i32* %6
store i32 %41, i32* %5
br label %45
42: ; preds = %35
%43 = load i32, i32* %6
%44 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %40
br label %46
46: ; preds = %45
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 2
store i32 %48, i32* %5
br label %31
49: ; preds = %31
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50, %18
br label %52
52: ; preds = %51, %29
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %8
55: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A\09%d\00"
define void @limited_primes(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %29, label %4
4: ; preds = %2, %26
%5 = phi i32 [ %27, %26 ], [ %0, %2 ]
switch i32 %5, label %8 [
i32 5, label %6
i32 2, label %6
]
6: ; preds = %4, %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %26
8: ; preds = %4
%9 = and i32 %5, 1
%10 = icmp ne i32 %9, 0
%11 = srem i32 %5, 5
%12 = icmp ne i32 %11, 0
%13 = and i1 %10, %12
%14 = icmp sgt i32 %5, 3
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %26
16: ; preds = %8, %22
%17 = phi i32 [ %24, %22 ], [ 3, %8 ]
%18 = srem i32 %5, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %22
22: ; preds = %16, %20
%23 = phi i32 [ %17, %20 ], [ %5, %16 ]
%24 = add nsw i32 %23, 2
%25 = icmp slt i32 %24, %5
br i1 %25, label %16, label %26
26: ; preds = %22, %6, %8
%27 = add i32 %5, 1
%28 = icmp eq i32 %5, %1
br i1 %28, label %29, label %4
29: ; preds = %26, %2
ret void
}