#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 *plusOne(int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  printf("Hello, World!\n");
  int digits[3] = {9, 9, 9};
  int returnSize = 3;
  int *res = plusOne(digits, 3, &returnSize);
  for (int i = 0; i < returnSize; i++) {
    printf("顺序结果:%d\n", *(res + i));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xed5(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xed3(%rip),%eax
mov    %eax,-0x14(%rbp)
movl   $0x3,-0x20(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x3,%esi
lea    -0x20(%rbp),%rdx
call   1040 <plusOne@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11af <main+0x8f>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117c <main+0x5c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    0xebd(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xeaa(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x3,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x3,%esi
call   1050 <plusOne@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ac <main+0x7c>
mov    %rax,%r15
lea    0xe84(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1190 <main+0x60>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
@__const.main.digits = [3 x i32] [i32 9, i32 9, i32 9]
@.str.1 = [17 x i8] c"\E9\A1\BA\E5\BA\8F\E7\BB\93\E6\9E\9C:%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i32]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = bitcast [3 x i32]* %6 to i8*
store i32 3, i32* %7
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%13 = call i32* @plusOne(i32* %12, i32 3, i32* %7)
store i32* %13, i32** %8
store i32 0, i32* %9
br label %14
14: ; preds = %25, %2
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32*, i32** %8
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %14
28: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@__const.main.digits = [3 x i32] [i32 9, i32 9, i32 9]
@.str.1 = [17 x i8] c"\E9\A1\BA\E5\BA\8F\E7\BB\93\E6\9E\9C:%d\0A\00"
@str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = bitcast [3 x i32]* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 3, i32* %4
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%9 = call i32* @plusOne(i32* %8, i32 3, i32* %4)
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %13, %2
ret i32 0
13: ; preds = %2, %13
%14 = phi i64 [ %18, %13 ], [ 0, %2 ]
%15 = getelementptr inbounds i32, i32* %9, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %14, 1
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %13, label %12
}