#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, c;
  do {
    a = 2;
    printf("请输入一个数字：");
    scanf("%d", &c);
    printf("%d\n", a);
    while (a < c) {
      a++;
      b = 2;
      while (a > b) {
        if (a % b == 0)
          break;
        b++;
      }
      if (a == b) {
        printf("%d\n", a);
      }
    }
  } while (c != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11b0 <main+0x90>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11a2 <main+0x82>
jmp    11b0 <main+0x90>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1181 <main+0x61>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11cd <main+0xad>
mov    -0x8(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1165 <main+0x45>
jmp    11d7 <main+0xb7>
cmpl   $0x0,-0x10(%rbp)
jne    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xee7(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xede(%rip),%r13
jmp    1148 <main+0x28>
test   %ecx,%ecx
je     11e5 <main+0xc5>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    %r13,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
cmp    $0x3,%ecx
jl     1140 <main+0x20>
mov    $0x2,%ebp
mov    $0x3,%ebx
mov    $0xffffffff,%r14d
jmp    119b <main+0x7b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%r14d
cmp    %ecx,%ebp
jge    1140 <main+0x20>
add    $0x1,%ebp
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     11cf <main+0xaf>
lea    (%r14,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x2,%eax
jne    11b0 <main+0x90>
mov    %ebx,%esi
cmp    %esi,%ebp
jne    1190 <main+0x70>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
jmp    1190 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B0\E5\AD\97\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %39, %0
store i32 2, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %37, %5
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
store i32 2, i32* %3
br label %17
17: ; preds = %27, %14
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = srem i32 %22, %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
br label %30
27: ; preds = %21
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %17
30: ; preds = %26, %17
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %30
br label %10
38: ; preds = %10
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 0
br i1 %41, label %5, label %42
42: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E6\95\B0\E5\AD\97\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %31, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %31
9: ; preds = %3, %27
%10 = phi i32 [ %28, %27 ], [ %7, %3 ]
%11 = phi i32 [ %30, %27 ], [ 3, %3 ]
%12 = phi i32 [ %13, %27 ], [ 2, %3 ]
%13 = add nuw nsw i32 %12, 1
br label %14
14: ; preds = %9, %18
%15 = phi i32 [ %19, %18 ], [ 2, %9 ]
%16 = urem i32 %13, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = add nuw nsw i32 %15, 1
%20 = icmp eq i32 %19, %11
br i1 %20, label %21, label %14
21: ; preds = %18, %14
%22 = phi i32 [ %11, %18 ], [ %15, %14 ]
%23 = icmp eq i32 %13, %22
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%26 = load i32, i32* %1
br label %27
27: ; preds = %24, %21
%28 = phi i32 [ %26, %24 ], [ %10, %21 ]
%29 = icmp slt i32 %13, %28
%30 = add nuw i32 %11, 1
br i1 %29, label %9, label %31
31: ; preds = %27, %3
%32 = phi i32 [ %7, %3 ], [ %28, %27 ]
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %3
34: ; preds = %31
ret i32 0
}