#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 *);
main() {
  int data[10], *pt, i = 0;
  pt = data;
  do {
    scanf("%d", (pt + i));
    if (*(pt + i) < 0) {
      break;
    }
    i++;
  } while (i < 10);
  printf("逆順に出力します。\n");
  for (i--; i >= 0; i--) {
    printf("%d\n", *(pt + i));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeac(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    1170 <main+0x50>
jmp    1183 <main+0x63>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jl     113e <main+0x1e>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     11cb <main+0xab>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    119a <main+0x7a>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
js     124a <main+0x11a>
lea    0x4(%rsp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
js     1258 <main+0x128>
lea    0x8(%rsp),%rsi
lea    0xe88(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
js     125f <main+0x12f>
lea    0xc(%rsp),%rsi
lea    0xe6c(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
js     1266 <main+0x136>
lea    0x10(%rsp),%rsi
lea    0xe50(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
js     126d <main+0x13d>
lea    0x14(%rsp),%rsi
lea    0xe34(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
js     1274 <main+0x144>
lea    0x18(%rsp),%rsi
lea    0xe18(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x18(%rsp)
js     127b <main+0x14b>
lea    0x1c(%rsp),%rsi
lea    0xdfc(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x1c(%rsp)
js     1282 <main+0x152>
lea    0x20(%rsp),%rsi
lea    0xde4(%rip),%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x20(%rsp)
js     1289 <main+0x159>
lea    0x24(%rsp),%rsi
lea    0xdcc(%rip),%rdi
call   1050 <scanf@plt>
mov    0x24(%rsp),%eax
shr    $0x1f,%eax
mov    $0xa,%ebx
sub    %rax,%rbx
jmp    128e <main+0x15e>
lea    0xdb6(%rip),%rdi
call   1030 <puts@plt>
jmp    12c8 <main+0x198>
mov    $0x1,%ebx
jmp    128e <main+0x15e>
mov    $0x2,%ebx
jmp    128e <main+0x15e>
mov    $0x3,%ebx
jmp    128e <main+0x15e>
mov    $0x4,%ebx
jmp    128e <main+0x15e>
mov    $0x5,%ebx
jmp    128e <main+0x15e>
mov    $0x6,%ebx
jmp    128e <main+0x15e>
mov    $0x7,%ebx
jmp    128e <main+0x15e>
mov    $0x8,%ebx
lea    0xd72(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
lea    0xd5e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x8(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     12b0 <main+0x180>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"\E9\80\86\E9\A0\86\E3\81\AB\E5\87\BA\E5\8A\9B\E3\81\97\E3\81\BE\E3\81\99\E3\80\82\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
br label %6
6: ; preds = %22, %0
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %6
br label %25
19: ; preds = %6
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 10
br i1 %24, label %6, label %25
25: ; preds = %22, %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %29
29: ; preds = %39, %25
%30 = load i32, i32* %4
%31 = icmp sge i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32*, i32** %3
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %32
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
br label %29
42: ; preds = %29
%43 = load i32, i32* %1
ret i32 %43
}

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