#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 digit_sum(int);
scalar_t__ is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n;
  for (n = 2; n < 5000; n++) {
    if (is_prime(n) && digit_sum(n) == 25) {
      printf("%d ", n);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x1388,-0x8(%rbp)
jge    1198 <main+0x68>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     1185 <main+0x55>
mov    -0x8(%rbp),%edi
call   1050 <digit_sum@plt>
cmp    $0x19,%eax
jne    1185 <main+0x55>
mov    -0x8(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <main+0x5a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%ebx
lea    0xec0(%rip),%r14
jmp    115b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x1388,%ebx
je     117f <main+0x4f>
mov    %ebx,%edi
call   1040 <is_prime@plt>
test   %rax,%rax
je     1150 <main+0x20>
mov    %ebx,%edi
call   1050 <digit_sum@plt>
cmp    $0x19,%eax
jne    1150 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5000
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i64 @is_prime(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @digit_sum(i32 %11)
%13 = icmp eq i32 %12, 25
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10, %6
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %3
21: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 2, %0 ], [ %11, %10 ]
%3 = tail call i64 @is_prime(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 @digit_sum(i32 %2)
%7 = icmp eq i32 %6, 25
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %10
10: ; preds = %1, %5, %8
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 5000
br i1 %12, label %13, label %1
13: ; preds = %10
ret i32 0
}