#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 /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i = 0;
  int x[7] = {0};
  for (i = 0; i < 7; i++) {
    printf("x[%d]: ", i + 1);
    scanf("%d", &x[i]);
  }
  for (i = 0; i < 7 / 2; i++) {
    int t = x[i];
    x[i] = x[7 - i - 1];
    x[7 - i - 1] = t;
  }
  puts("倒序排列");
  for (i = 0; i < 7; i++) {
    printf("x[%d] = %d\n", i + 1, x[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1050 <memset@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11b4 <main+0x74>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x2d>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    120b <main+0xcb>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
mov    $0x7,%eax
sub    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%ecx
mov    $0x7,%eax
sub    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x7b>
lea    0xdf9(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1252 <main+0x112>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121e <main+0xde>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xc(%rsp)
movaps %xmm0,(%rsp)
lea    0xc(%rsp),%r15
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%eax
mov    0x18(%rsp),%ecx
mov    %ecx,(%rsp)
mov    %eax,0x18(%rsp)
mov    0x4(%rsp),%rax
rol    $0x20,%rax
mov    0x10(%rsp),%rcx
rol    $0x20,%rcx
mov    %rcx,0x4(%rsp)
mov    %rax,0x10(%rsp)
lea    0xdc2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
lea    0xdc0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"x[%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"\E5\80\92\E5\BA\8F\E6\8E\92\E5\88\97\00"
@.str.3 = [12 x i8] c"x[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 5)
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 6)
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%22 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %4
%25 = load i32, i32* %22
store i32 %25, i32* %4
store i32 %24, i32* %22
%26 = load i32, i32* %7
%27 = load i32, i32* %19
store i32 %27, i32* %7
store i32 %26, i32* %19
%28 = load i32, i32* %10
%29 = load i32, i32* %16
store i32 %29, i32* %10
store i32 %28, i32* %16
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* %4
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %31)
%33 = load i32, i32* %7
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %33)
%35 = load i32, i32* %10
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %35)
%37 = load i32, i32* %13
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %37)
%39 = load i32, i32* %16
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 %39)
%41 = load i32, i32* %19
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 6, i32 %41)
%43 = load i32, i32* %22
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 %43)
ret i32 0
}