#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ strtol(char *, char **, int);
void importData_1Di(FILE *dataset, int size1, int array[size1]) {
  int pos = 1;
  while (pos <= size1 - 1) {
    array[pos] = 0x00;
    pos++;
  }
  pos = 1;
  int end = 0;
  while (end == 0) {
    char *endptr;
    char str[50];
    fgets(str, 49, dataset);
    int number = (int)strtol(str, &endptr, 10);
    if (number == 0)
      end = 1;
    array[pos] = number;
    pos++;
  }
}


x86 assembly (clang, -O0):
<importData_1Di>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1168 <importData_1Di+0x48>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <importData_1Di+0x1a>
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    11d4 <importData_1Di+0xb4>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x31,%esi
call   1030 <fgets@plt>
lea    -0x60(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
jne    11b8 <importData_1Di+0x98>
movl   $0x1,-0x20(%rbp)
mov    -0x64(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1176 <importData_1Di+0x56>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<importData_1Di>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
cmp    $0x2,%esi
jl     115a <importData_1Di+0x2a>
mov    %esi,%edx
lea    0x4(%rbx),%rdi
add    $0xffffffff,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x4,%rbx
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x31,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,(%rbx)
add    $0x4,%rbx
test   %eax,%eax
jne    1170 <importData_1Di+0x40>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @importData_1Di(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca [50 x i8]
%11 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
store i32 1, i32* %7
br label %14
14: ; preds = %19, %3
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = icmp sle i32 %15, %17
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load i32*, i32** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 0, i32* %23
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %14
26: ; preds = %14
store i32 1, i32* %7
store i32 0, i32* %8
br label %27
27: ; preds = %40, %26
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %48
30: ; preds = %27
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%32 = load i32*, i32** %4
%33 = call i32 @fgets(i8* %31, i32 49, i32* %32)
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%35 = call i64 @strtol(i8* %34, i8** %9, i32 10)
%36 = trunc i64 %35 to i32
store i32 %36, i32* %11
%37 = load i32, i32* %11
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %30
store i32 1, i32* %8
br label %40
40: ; preds = %39, %30
%41 = load i32, i32* %11
%42 = load i32*, i32** %6
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 %41, i32* %45
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %27
48: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @importData_1Di(i32* nocapture %0, i32 %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = alloca [50 x i8]
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = getelementptr i32, i32* %2, i64 1
%9 = bitcast i32* %8 to i8*
%10 = add nsw i32 %1, -1
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
br label %13
13: ; preds = %7, %3
%14 = bitcast i8** %4 to i8*
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
br label %16
16: ; preds = %13, %16
%17 = phi i64 [ 1, %13 ], [ %23, %16 ]
%18 = call i32 @fgets(i8* %15, i32 49, i32* %0)
%19 = call i64 @strtol(i8* %15, i8** %4, i32 10)
%20 = trunc i64 %19 to i32
%21 = icmp eq i32 %20, 0
%22 = getelementptr inbounds i32, i32* %2, i64 %17
store i32 %20, i32* %22
%23 = add nuw i64 %17, 1
br i1 %21, label %24, label %16
24: ; preds = %16
ret void
}