#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 *, short);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void display_svector(short *v, long nl, long nh, char *format, char *name) {
  long i;
  if (name != NULL)
    puts(name);
  for (i = nl; i <= nh; i++) {
    printf(format, v[i]);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<display_svector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1160 <display_svector+0x30>
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     119c <display_svector+0x6c>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movswl (%rax,%rcx,2),%esi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1168 <display_svector+0x38>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_svector>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
test   %r8,%r8
je     1151 <display_svector+0x21>
mov    %r8,%rdi
call   1040 <puts@plt>
cmp    %r15,%rbx
jg     1176 <display_svector+0x46>
add    $0x1,%r15
nopw   0x0(%rax,%rax,1)
movswl (%r12,%rbx,2),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <display_svector+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @display_svector(i16* %0, i64 %1, i64 %2, i8* %3, i8* %4) {
%6 = alloca i16*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
store i16* %0, i16** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = load i8*, i8** %10
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %5
%15 = load i8*, i8** %10
%16 = call i32 @puts(i8* %15)
br label %17
17: ; preds = %14, %5
%18 = load i64, i64* %7
store i64 %18, i64* %11
br label %19
19: ; preds = %30, %17
%20 = load i64, i64* %11
%21 = load i64, i64* %8
%22 = icmp sle i64 %20, %21
br i1 %22, label %23, label %33
23: ; preds = %19
%24 = load i8*, i8** %9
%25 = load i16*, i16** %6
%26 = load i64, i64* %11
%27 = getelementptr inbounds i16, i16* %25, i64 %26
%28 = load i16, i16* %27
%29 = call i32 @printf(i8* %24, i16 signext %28)
br label %30
30: ; preds = %23
%31 = load i64, i64* %11
%32 = add nsw i64 %31, 1
store i64 %32, i64* %11
br label %19
33: ; preds = %19
%34 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @display_svector(i16* nocapture %0, i64 %1, i64 %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %4, null
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 @puts(i8* %4)
br label %9
9: ; preds = %7, %5
%10 = icmp sgt i64 %1, %2
br i1 %10, label %18, label %11
11: ; preds = %9, %11
%12 = phi i64 [ %16, %11 ], [ %1, %9 ]
%13 = getelementptr inbounds i16, i16* %0, i64 %12
%14 = load i16, i16* %13
%15 = tail call i32 @printf(i8* %3, i16 signext %14)
%16 = add i64 %12, 1
%17 = icmp eq i64 %12, %2
br i1 %17, label %18, label %11
18: ; preds = %11, %9
%19 = tail call i32 @putchar(i8 signext 10)
ret void
}