#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*/ assert(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ strcat(char *, char *);
char *get_acqu_file(char *name) {
  FILE *file;
  char buff[250 + 1];
  int len, size;
  char *script = NULL;
  if ((file = fopen(name, "r")) == NULL)
    return NULL;
  len = 0;
  script = (char *)calloc(1, 250);
  assert(script);
  while ((size = fread(buff, 1, 250, file)) > 0) {
    len += size;
    buff[size] = '\0';
    script = (char *)realloc(script, len + 1);
    assert(script);
    strcat(script, buff);
  }
  fclose(file);
  return script;
}


x86 assembly (clang, -O0):
<get_acqu_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x130(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11b5 <get_acqu_file+0x45>
movq   $0x0,-0x8(%rbp)
jmp    127f <get_acqu_file+0x10f>
movl   $0x0,-0x124(%rbp)
mov    $0x1,%edi
mov    $0xfa,%esi
call   1050 <calloc@plt>
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rdi
call   1060 <assert@plt>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xfa,%edx
call   1030 <fread@plt>
mov    %eax,-0x128(%rbp)
cmp    $0x0,%eax
jle    126b <get_acqu_file+0xfb>
mov    -0x128(%rbp),%eax
add    -0x124(%rbp),%eax
mov    %eax,-0x124(%rbp)
movslq -0x128(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x130(%rbp),%rdi
mov    -0x124(%rbp),%esi
add    $0x1,%esi
call   1070 <realloc@plt>
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rdi
call   1060 <assert@plt>
mov    -0x130(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1090 <strcat@plt>
jmp    11e1 <get_acqu_file+0x71>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x130(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_acqu_file>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe7c(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1222 <get_acqu_file+0xb2>
mov    %rax,%r14
mov    $0x1,%edi
mov    $0xfa,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <assert@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0xfa,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jle    1218 <get_acqu_file+0xa8>
xor    %ecx,%ecx
mov    %rsp,%r15
nopl   (%rax)
lea    (%rax,%rcx,1),%ebp
mov    %eax,%edx
movb   $0x0,(%rsp,%rdx,1)
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %rbx,%rdi
call   1070 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <strcat@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0xfa,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
mov    %ebp,%ecx
test   %eax,%eax
jg     11d0 <get_acqu_file+0x60>
mov    %r14,%rdi
call   1040 <fclose@plt>
jmp    1224 <get_acqu_file+0xb4>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i8* @get_acqu_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [251 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %8
%9 = load i8*, i8** %3
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %4
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %13
12: ; preds = %1
store i8* null, i8** %2
br label %44
13: ; preds = %1
store i32 0, i32* %6
%14 = call i64 @calloc(i32 1, i32 250)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %8
%16 = load i8*, i8** %8
%17 = call i32 @assert(i8* %16)
br label %18
18: ; preds = %23, %13
%19 = getelementptr inbounds [251 x i8], [251 x i8]* %5, i64 0, i64 0
%20 = load i32*, i32** %4
%21 = call i32 @fread(i8* %19, i32 1, i32 250, i32* %20)
store i32 %21, i32* %7
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %40
23: ; preds = %18
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = add nsw i32 %25, %24
store i32 %26, i32* %6
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [251 x i8], [251 x i8]* %5, i64 0, i64 %28
store i8 0, i8* %29
%30 = load i8*, i8** %8
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
%33 = call i64 @realloc(i8* %30, i32 %32)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %8
%35 = load i8*, i8** %8
%36 = call i32 @assert(i8* %35)
%37 = load i8*, i8** %8
%38 = getelementptr inbounds [251 x i8], [251 x i8]* %5, i64 0, i64 0
%39 = call i32 @strcat(i8* %37, i8* %38)
br label %18
40: ; preds = %18
%41 = load i32*, i32** %4
%42 = call i32 @fclose(i32* %41)
%43 = load i8*, i8** %8
store i8* %43, i8** %2
br label %44
44: ; preds = %40, %12
%45 = load i8*, i8** %2
ret i8* %45
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i8* @get_acqu_file(i8* nocapture %0) {
%2 = alloca [251 x i8]
%3 = getelementptr inbounds [251 x i8], [251 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %31, label %6
6: ; preds = %1
%7 = tail call i64 @calloc(i32 1, i32 250)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @assert(i8* %8)
%10 = call i32 @fread(i8* %3, i32 1, i32 250, i32* %4)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %6, %12
%13 = phi i32 [ %24, %12 ], [ %10, %6 ]
%14 = phi i8* [ %21, %12 ], [ %8, %6 ]
%15 = phi i32 [ %16, %12 ], [ 0, %6 ]
%16 = add nsw i32 %13, %15
%17 = zext i32 %13 to i64
%18 = getelementptr inbounds [251 x i8], [251 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %18
%19 = add nsw i32 %16, 1
%20 = call i64 @realloc(i8* %14, i32 %19)
%21 = inttoptr i64 %20 to i8*
%22 = call i32 @assert(i8* %21)
%23 = call i32 @strcat(i8* %21, i8* %3)
%24 = call i32 @fread(i8* %3, i32 1, i32 250, i32* %4)
%25 = icmp sgt i32 %24, 0
br i1 %25, label %12, label %26
26: ; preds = %12
%27 = inttoptr i64 %20 to i8*
br label %28
28: ; preds = %26, %6
%29 = phi i8* [ %8, %6 ], [ %27, %26 ]
%30 = call i32 @fclose(i32* %4)
br label %31
31: ; preds = %1, %28
%32 = phi i8* [ %29, %28 ], [ null, %1 ]
ret i8* %32
}