#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 argc, char *argv[]) {
  int choose_flag = 0;
  int n;
  int i;
  while (1) {
    printf("请选择使用任务，1 为任务1，2 为任务2，0 退出。\n");
    scanf("%d", &choose_flag);
    printf("请输入循环显示的值\n");
    scanf("%d", &n);
    if (choose_flag == 1) {
      for (i = 1; i <= n; i++) {
        printf("%d\n", 2 * i);
      }
    } else if (choose_flag == 2) {
      for (i = 2; i <= 2 * n; i += 2) {
        printf("%d\n", i);
      }
    } else if (choose_flag == 0) {
      break;
    } else {
      printf("你输入的不符合要求\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11bd <main+0x9d>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11b8 <main+0x98>
mov    -0x1c(%rbp),%esi
shl    $0x1,%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118a <main+0x6a>
jmp    122a <main+0x10a>
cmpl   $0x2,-0x14(%rbp)
jne    1203 <main+0xe3>
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jg     11fe <main+0xde>
mov    -0x1c(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <main+0xae>
jmp    1225 <main+0x105>
cmpl   $0x0,-0x14(%rbp)
jne    1212 <main+0xf2>
jmp    122f <main+0x10f>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <main+0x105>
jmp    122a <main+0x10a>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeb6(%rip),%r15
lea    0xef8(%rip),%r12
mov    %rsp,%r13
lea    0xea8(%rip),%rbp
nopl   0x0(%rax,%rax,1)
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     11b0 <main+0x80>
cmp    $0x2,%eax
je     11e0 <main+0xb0>
test   %eax,%eax
je     120d <main+0xdd>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
jmp    1160 <main+0x30>
nopl   0x0(%rax)
cmpl   $0x0,(%rsp)
jle    1160 <main+0x30>
xor    %ebx,%ebx
mov    $0x2,%r14d
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
add    $0x2,%r14d
cmp    (%rsp),%ebx
jl     11c0 <main+0x90>
jmp    1160 <main+0x30>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,(%rsp)
jle    1160 <main+0x30>
mov    $0x2,%ebx
nop
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebx
mov    (%rsp),%eax
add    %eax,%eax
cmp    %eax,%ebx
jle    11f0 <main+0xc0>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [67 x i8] c"\E8\AF\B7\E9\80\89\E6\8B\A9\E4\BD\BF\E7\94\A8\E4\BB\BB\E5\8A\A1\EF\BC\8C1 \E4\B8\BA\E4\BB\BB\E5\8A\A11\EF\BC\8C2 \E4\B8\BA\E4\BB\BB\E5\8A\A12\EF\BC\8C0 \E9\80\80\E5\87\BA\E3\80\82\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\BE\AA\E7\8E\AF\E6\98\BE\E7\A4\BA\E7\9A\84\E5\80\BC\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [29 x i8] c"\E4\BD\A0\E8\BE\93\E5\85\A5\E7\9A\84\E4\B8\8D\E7\AC\A6\E5\90\88\E8\A6\81\E6\B1\82\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %2, %53
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %29
16: ; preds = %9
store i32 1, i32* %8
br label %17
17: ; preds = %25, %16
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %8
%23 = mul nsw i32 2, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %17
28: ; preds = %17
br label %53
29: ; preds = %9
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %45
32: ; preds = %29
store i32 2, i32* %8
br label %33
33: ; preds = %41, %32
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = mul nsw i32 2, %35
%37 = icmp sle i32 %34, %36
br i1 %37, label %38, label %44
38: ; preds = %33
%39 = load i32, i32* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 2
store i32 %43, i32* %8
br label %33
44: ; preds = %33
br label %52
45: ; preds = %29
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %45
br label %54
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %51
51: ; preds = %49
br label %52
52: ; preds = %51, %44
br label %53
53: ; preds = %52, %28
br label %9
54: ; preds = %48
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [66 x i8] c"\E8\AF\B7\E9\80\89\E6\8B\A9\E4\BD\BF\E7\94\A8\E4\BB\BB\E5\8A\A1\EF\BC\8C1 \E4\B8\BA\E4\BB\BB\E5\8A\A11\EF\BC\8C2 \E4\B8\BA\E4\BB\BB\E5\8A\A12\EF\BC\8C0 \E9\80\80\E5\87\BA\E3\80\82\00"
@str.5 = [28 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\BE\AA\E7\8E\AF\E6\98\BE\E7\A4\BA\E7\9A\84\E5\80\BC\00"
@str.6 = [28 x i8] c"\E4\BD\A0\E8\BE\93\E5\85\A5\E7\9A\84\E4\B8\8D\E7\AC\A6\E5\90\88\E8\A6\81\E6\B1\82\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
br label %7
7: ; preds = %16, %2
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %3
switch i32 %12, label %34 [
i32 1, label %17
i32 2, label %13
i32 0, label %36
]
13: ; preds = %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %27
16: ; preds = %27, %20, %13, %17, %34
br label %7
17: ; preds = %7
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 1
br i1 %19, label %16, label %20
20: ; preds = %17, %20
%21 = phi i32 [ %24, %20 ], [ 1, %17 ]
%22 = shl nuw nsw i32 %21, 1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i32 %21, 1
%25 = load i32, i32* %4
%26 = icmp slt i32 %21, %25
br i1 %26, label %20, label %16
27: ; preds = %13, %27
%28 = phi i32 [ %30, %27 ], [ 2, %13 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = add nuw nsw i32 %28, 2
%31 = load i32, i32* %4
%32 = shl nsw i32 %31, 1
%33 = icmp sgt i32 %30, %32
br i1 %33, label %16, label %27
34: ; preds = %7
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
br label %16
36: ; preds = %7
ret i32 0
}