#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *get_array1(int *, int);
int /*<<< orphan*/ stderr;
void rd_1dim_slice(int *array, int dim, int shift, int post) {
  char *cp;
  cp = get_array1(array + shift, dim - shift - post);
  if (cp) {
    fprintf(stderr, "\nrd_1dim: %s\n", cp);
    exit(1);
  }
  return;
}


x86 assembly (clang, -O0):
<rd_1dim_slice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
sub    -0x14(%rbp),%esi
call   1040 <get_array1@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1194 <rd_1dim_slice+0x64>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_1dim_slice>:
push   %rax
movslq %edx,%rax
lea    (%rdi,%rax,4),%rdi
add    %ecx,%eax
sub    %eax,%esi
call   1040 <get_array1@plt>
test   %rax,%rax
jne    1148 <rd_1dim_slice+0x18>
pop    %rax
ret
mov    0x2e91(%rip),%rcx
mov    (%rcx),%edi
lea    0xea8(%rip),%rsi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"\0Ard_1dim: %s\0A\00"
define void @rd_1dim_slice(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32*, i32** %5
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = sub nsw i32 %14, %15
%17 = load i32, i32* %8
%18 = sub nsw i32 %16, %17
%19 = call i8* @get_array1(i32* %13, i32 %18)
store i8* %19, i8** %9
%20 = load i8*, i8** %9
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %27
22: ; preds = %4
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %9
%25 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"\0Ard_1dim: %s\0A\00"
define void @rd_1dim_slice(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = add i32 %2, %3
%8 = sub i32 %1, %7
%9 = tail call i8* @get_array1(i32* %6, i32 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %4
ret void
}