#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, ...);
int main() {
  int i, t = 0, n, s = 0, isprime = 1;
  for (n = 999; t < 10; n -= 2) {
    isprime = 1;
    for (i = 2; i < n; i++) {
      if (0 == n % i) {
        isprime = 0;
        break;
      }
    }
    if (1 == isprime) {
      if (t < 9) {
        s += n;
        t += 1;
        printf("%d+", n);
      } else if (9 == t) {
        s += n;
        t += 1;
        printf("%d=%d", n, s);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x3e7,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1220 <main+0x110>
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118f <main+0x7f>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    117c <main+0x6c>
movl   $0x0,-0x18(%rbp)
jmp    118f <main+0x7f>
jmp    1181 <main+0x71>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <main+0x43>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    120d <main+0xfd>
cmpl   $0x9,-0xc(%rbp)
jge    11cf <main+0xbf>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1208 <main+0xf8>
mov    $0x9,%eax
cmp    -0xc(%rbp),%eax
jne    1203 <main+0xf3>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1208 <main+0xf8>
jmp    120d <main+0xfd>
jmp    1212 <main+0x102>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x3e7,%ebx
mov    $0xfffffc1b,%ebp
lea    0xed7(%rip),%r14
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    114c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xfffffffe,%ebx
add    $0x2,%ebp
cmp    $0xa,%r12d
jge    11a2 <main+0x92>
cmp    $0x3,%ebx
jl     1174 <main+0x64>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1140 <main+0x30>
add    $0x1,%ecx
lea    (%rcx,%rbp,1),%eax
cmp    $0x2,%eax
jne    1160 <main+0x50>
add    %ebx,%r15d
cmp    $0x8,%r12d
jg     118f <main+0x7f>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1140 <main+0x30>
lea    0xe6e(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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