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

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ convert_be_to_local(char *, int);
int /*<<< orphan*/ cslob_read(int /*<<< orphan*/ *, ...);
char *cslob_read_astrings(FILE *file) {
  uint16_t string_len;
  char *p;
  ;
  if (!cslob_read(file, &string_len, 2))
    return NULL;
  convert_be_to_local((char *)&(string_len), sizeof(string_len));
  ;
  p = (char *)calloc(1, string_len + 1);
  if (!p)
    return NULL;
  ;
  if (!cslob_read(file, p, string_len))
    return NULL;
  return p;
}


x86 assembly (clang, -O0):
<cslob_read_astrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x2,%edx
mov    $0x0,%al
call   1040 <cslob_read@plt>
cmp    $0x0,%eax
jne    1166 <cslob_read_astrings+0x36>
movq   $0x0,-0x8(%rbp)
jmp    11d0 <cslob_read_astrings+0xa0>
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
call   1030 <convert_be_to_local@plt>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    $0x1,%edi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11a0 <cslob_read_astrings+0x70>
movq   $0x0,-0x8(%rbp)
jmp    11d0 <cslob_read_astrings+0xa0>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1040 <cslob_read@plt>
cmp    $0x0,%eax
jne    11c8 <cslob_read_astrings+0x98>
movq   $0x0,-0x8(%rbp)
jmp    11d0 <cslob_read_astrings+0xa0>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cslob_read_astrings>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xc(%rsp),%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <cslob_read@plt>
test   %eax,%eax
je     1198 <cslob_read_astrings+0x68>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
call   1030 <convert_be_to_local@plt>
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    $0x1,%edi
call   1050 <calloc@plt>
test   %rax,%rax
je     1196 <cslob_read_astrings+0x66>
mov    %rax,%r15
mov    0xc(%rsp),%edx
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <cslob_read@plt>
test   %eax,%eax
cmovne %r15,%rbx
jmp    1198 <cslob_read_astrings+0x68>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @cslob_read_astrings(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 (i32*, ...) @cslob_read(i32* %6, i32* %4, i32 2)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %29
10: ; preds = %1
%11 = bitcast i32* %4 to i8*
%12 = call i32 @convert_be_to_local(i8* %11, i32 4)
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
%15 = call i64 @calloc(i32 1, i32 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %10
store i8* null, i8** %2
br label %29
20: ; preds = %10
%21 = load i32*, i32** %3
%22 = load i8*, i8** %5
%23 = load i32, i32* %4
%24 = call i32 (i32*, ...) @cslob_read(i32* %21, i8* %22, i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %20
store i8* null, i8** %2
br label %29
27: ; preds = %20
%28 = load i8*, i8** %5
store i8* %28, i8** %2
br label %29
29: ; preds = %27, %26, %19, %9
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
define i8* @cslob_read_astrings(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 (i32*, ...) @cslob_read(i32* %0, i32* %2, i32 2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = call i32 @convert_be_to_local(i8* %3, i32 4)
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
%10 = call i64 @calloc(i32 1, i32 %9)
%11 = inttoptr i64 %10 to i8*
%12 = icmp eq i64 %10, 0
br i1 %12, label %18, label %13
13: ; preds = %6
%14 = load i32, i32* %2
%15 = call i32 (i32*, ...) @cslob_read(i32* %0, i8* %11, i32 %14)
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8* null, i8* %11
br label %18
18: ; preds = %13, %6, %1
%19 = phi i8* [ null, %1 ], [ null, %6 ], [ %17, %13 ]
ret i8* %19
}