#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 */
scalar_t__ calloc(int, unsigned char);
int /*<<< orphan*/ cslob_read(int /*<<< orphan*/ *, ...);
char *cslob_read_astringc(FILE *file) {
  unsigned char string_len;
  char *p;
  ;
  if (!cslob_read(file, &string_len, 1))
    return NULL;
  ;
  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_astringc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <cslob_read@plt>
cmp    $0x0,%eax
jne    1156 <cslob_read_astringc+0x36>
movq   $0x0,-0x8(%rbp)
jmp    11b7 <cslob_read_astringc+0x97>
movzbl -0x11(%rbp),%eax
add    $0x1,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1186 <cslob_read_astringc+0x66>
movq   $0x0,-0x8(%rbp)
jmp    11b7 <cslob_read_astringc+0x97>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movzbl -0x11(%rbp),%edx
mov    $0x0,%al
call   1030 <cslob_read@plt>
cmp    $0x0,%eax
jne    11af <cslob_read_astringc+0x8f>
movq   $0x0,-0x8(%rbp)
jmp    11b7 <cslob_read_astringc+0x97>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cslob_read_astringc>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <cslob_read@plt>
test   %eax,%eax
je     117c <cslob_read_astringc+0x5c>
mov    0xf(%rsp),%al
add    $0x1,%al
movzbl %al,%esi
mov    $0x1,%edi
call   1040 <calloc@plt>
test   %rax,%rax
je     117a <cslob_read_astringc+0x5a>
mov    %rax,%r15
movzbl 0xf(%rsp),%edx
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <cslob_read@plt>
test   %eax,%eax
cmovne %r15,%rbx
jmp    117c <cslob_read_astringc+0x5c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @cslob_read_astringc(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i8*
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 (i32*, ...) @cslob_read(i32* %6, i8* %4, i32 1)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %30
10: ; preds = %1
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = add nsw i32 %12, 1
%14 = trunc i32 %13 to i8
%15 = call i64 @calloc(i32 1, i8 zeroext %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 %30
20: ; preds = %10
%21 = load i32*, i32** %3
%22 = load i8*, i8** %5
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = call i32 (i32*, ...) @cslob_read(i32* %21, i8* %22, i32 %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %20
store i8* null, i8** %2
br label %30
28: ; preds = %20
%29 = load i8*, i8** %5
store i8* %29, i8** %2
br label %30
30: ; preds = %28, %27, %19, %9
%31 = load i8*, i8** %2
ret i8* %31
}

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