#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*/ assert(int);
int ivecs_new_read(char const *, int *, int **);
int *ivec_new_read(const char *fname, int *d_out) {
  int d, n;
  int *vi;
  n = ivecs_new_read(fname, &d, &vi);
  if (n < 0)
    return NULL;
  assert(n == 1);
  if (d_out)
    *d_out = d;
  return vi;
}


x86 assembly (clang, -O0):
<ivec_new_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <ivecs_new_read@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    115b <ivec_new_read+0x3b>
movq   $0x0,-0x8(%rbp)
jmp    1188 <ivec_new_read+0x68>
cmpl   $0x1,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
je     1180 <ivec_new_read+0x60>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivec_new_read>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <ivecs_new_read@plt>
test   %eax,%eax
js     115b <ivec_new_read+0x3b>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
test   %rbx,%rbx
je     1154 <ivec_new_read+0x34>
mov    0x4(%rsp),%eax
mov    %eax,(%rbx)
mov    0x8(%rsp),%rax
jmp    115d <ivec_new_read+0x3d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32* @ivec_new_read(i8* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
%9 = load i8*, i8** %4
%10 = call i32 @ivecs_new_read(i8* %9, i32* %6, i32** %8)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32* null, i32** %3
br label %26
14: ; preds = %2
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 1
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32*, i32** %5
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = load i32, i32* %6
%23 = load i32*, i32** %5
store i32 %22, i32* %23
br label %24
24: ; preds = %21, %14
%25 = load i32*, i32** %8
store i32* %25, i32** %3
br label %26
26: ; preds = %24, %13
%27 = load i32*, i32** %3
ret i32* %27
}

LLVM IR (-O2):
define i32* @ivec_new_read(i8* %0, i32* writeonly %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32** %4 to i8*
%7 = call i32 @ivecs_new_read(i8* %0, i32* %3, i32** %4)
%8 = icmp slt i32 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %2
%10 = icmp eq i32 %7, 1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = icmp eq i32* %1, null
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = load i32, i32* %3
store i32 %15, i32* %1
br label %16
16: ; preds = %14, %9
%17 = load i32*, i32** %4
br label %18
18: ; preds = %2, %16
%19 = phi i32* [ %17, %16 ], [ null, %2 ]
ret i32* %19
}