#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 *rdin();
int main() {
  int *ay = NULL;
  int l;
  ay = rdin();
  if (ay == NULL) {
    printf("rd error\n");
    return -1;
  }
  l = ay[0];
  while (l-- >= 0)
    printf("%d ", *ay++);
  printf("\n ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <rdin@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <main+0x47>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bd <main+0x9d>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jl     11a8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1170 <main+0x50>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <rdin@plt>
test   %rax,%rax
je     119a <main+0x6a>
mov    %rax,%rbx
mov    (%rax),%ebp
test   %ebp,%ebp
js     1188 <main+0x58>
lea    0xeb0(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
je     1188 <main+0x58>
add    $0x4,%rbx
add    $0x1,%ebp
lea    0xe95(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1170 <main+0x40>
lea    0xe75(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ab <main+0x7b>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"rd error\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %2
%4 = call i32* (...) @rdin()
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %24
9: ; preds = %0
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
store i32 %12, i32* %3
br label %13
13: ; preds = %17, %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, -1
store i32 %15, i32* %3
%16 = icmp sge i32 %14, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i32 1
store i32* %19, i32** %2
%20 = load i32, i32* %18
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %13
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %7
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"\0A \00"
@str = [9 x i8] c"rd error\00"
define i32 @main() {
%1 = tail call i32* (...) @rdin()
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %21
5: ; preds = %0
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, -1
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%10 = icmp eq i32 %6, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i32* [ %14, %11 ], [ %1, %8 ]
%13 = phi i32 [ %15, %11 ], [ %6, %8 ]
%14 = getelementptr inbounds i32, i32* %12, i64 1
%15 = add nsw i32 %13, -1
%16 = load i32, i32* %14
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = icmp sgt i32 %13, 1
br i1 %18, label %11, label %19
19: ; preds = %11, %8, %5
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %3
%22 = phi i32 [ -1, %3 ], [ 0, %19 ]
ret i32 %22
}