#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 main() {
  char *s[4] = {"C Programming Language", "Asembly Language", "Data structure",
                "Natural Language"};
  int i;
  char *aptr;
  printf("第一种方法输出：通过指针数组的数组名输出字符串:\n");
  for (i = 0; i < 4; i++)
    printf("第%d个字符串：%s\n", i + 1, s[i]);
  printf("第二种方法输出：通过指向数组的指针输出字符串：\n");
  for (aptr = s[0], i = 0; i < 4; aptr = s[i]) {
    printf("第%d个字符串：%s\n", i + 1, aptr);
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    1195 <main+0x85>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0xf10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1160 <main+0x50>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    11ef <main+0xdf>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
mov    -0x40(%rbp),%rdx
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x40(%rbp)
jmp    11b2 <main+0xa2>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0c(%rip),%rbx
lea    0xebd(%rip),%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%r15
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%r12
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea9(%rip),%r13
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"C Programming Language\00"
@.str.1 = [17 x i8] c"Asembly Language\00"
@.str.2 = [15 x i8] c"Data structure\00"
@.str.3 = [17 x i8] c"Natural Language\00"
@__const.main.s = [4 x i8*] [i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [72 x i8] c"\E7\AC\AC\E4\B8\80\E7\A7\8D\E6\96\B9\E6\B3\95\E8\BE\93\E5\87\BA\EF\BC\9A\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\95\B0\E7\BB\84\E7\9A\84\E6\95\B0\E7\BB\84\E5\90\8D\E8\BE\93\E5\87\BA\E5\AD\97\E7\AC\A6\E4\B8\B2:\0A\00"
@.str.5 = [24 x i8] c"\E7\AC\AC%d\E4\B8\AA\E5\AD\97\E7\AC\A6\E4\B8\B2\EF\BC\9A%s\0A\00"
@.str.6 = [71 x i8] c"\E7\AC\AC\E4\BA\8C\E7\A7\8D\E6\96\B9\E6\B3\95\E8\BE\93\E5\87\BA\EF\BC\9A\E9\80\9A\E8\BF\87\E6\8C\87\E5\90\91\E6\95\B0\E7\BB\84\E7\9A\84\E6\8C\87\E9\92\88\E8\BE\93\E5\87\BA\E5\AD\97\E7\AC\A6\E4\B8\B2\EF\BC\9A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [4 x i8*]* %2 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %12, i8* %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %7
21: ; preds = %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.6, i64 0, i64 0))
%23 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%24 = load i8*, i8** %23
store i8* %24, i8** %4
store i32 0, i32* %3
br label %25
25: ; preds = %35, %21
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
%31 = load i8*, i8** %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %30, i8* %31)
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %35
35: ; preds = %28
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %37
%39 = load i8*, i8** %38
store i8* %39, i8** %4
br label %25
40: ; preds = %25
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [23 x i8] c"C Programming Language\00"
@.str.1 = [17 x i8] c"Asembly Language\00"
@.str.2 = [15 x i8] c"Data structure\00"
@.str.3 = [17 x i8] c"Natural Language\00"
@.str.5 = [24 x i8] c"\E7\AC\AC%d\E4\B8\AA\E5\AD\97\E7\AC\A6\E4\B8\B2\EF\BC\9A%s\0A\00"
@str = [71 x i8] c"\E7\AC\AC\E4\B8\80\E7\A7\8D\E6\96\B9\E6\B3\95\E8\BE\93\E5\87\BA\EF\BC\9A\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\95\B0\E7\BB\84\E7\9A\84\E6\95\B0\E7\BB\84\E5\90\8D\E8\BE\93\E5\87\BA\E5\AD\97\E7\AC\A6\E4\B8\B2:\00"
@str.7 = [70 x i8] c"\E7\AC\AC\E4\BA\8C\E7\A7\8D\E6\96\B9\E6\B3\95\E8\BE\93\E5\87\BA\EF\BC\9A\E9\80\9A\E8\BF\87\E6\8C\87\E5\90\91\E6\95\B0\E7\BB\84\E7\9A\84\E6\8C\87\E9\92\88\E8\BE\93\E5\87\BA\E5\AD\97\E7\AC\A6\E4\B8\B2\EF\BC\9A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}