#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 ssize_t;

/* Variables and functions */
int cio_file_st_get_meta_len(char *);
ssize_t cio_file_st_get_content_size(char *map, size_t size) {
  int meta_len;
  size_t s;
  if (size < 24) {
    return -1;
  }
  meta_len = cio_file_st_get_meta_len(map);
  s = (size - 24) - meta_len;
  if (s < size) {
    return s;
  }
  return -1;
}


x86 assembly (clang, -O0):
<cio_file_st_get_content_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x18,-0x18(%rbp)
jae    1137 <cio_file_st_get_content_size+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <cio_file_st_get_content_size+0x67>
mov    -0x10(%rbp),%rdi
call   1030 <cio_file_st_get_meta_len@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x18,%rax
movslq -0x1c(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1170 <cio_file_st_get_content_size+0x60>
mov    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1177 <cio_file_st_get_content_size+0x67>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cio_file_st_get_content_size>:
mov    $0xffffffff,%eax
cmp    $0x18,%rsi
jb     113d <cio_file_st_get_content_size+0x2d>
push   %rbx
mov    %rsi,%rbx
call   1030 <cio_file_st_get_meta_len@plt>
cltq
neg    %rax
lea    (%rbx,%rax,1),%rcx
add    $0xffffffffffffffe8,%rcx
cmp    %rbx,%rcx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cio_file_st_get_content_size(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%8 = load i64, i64* %5
%9 = icmp ult i64 %8, 24
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %26
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @cio_file_st_get_meta_len(i8* %12)
store i32 %13, i32* %6
%14 = load i64, i64* %5
%15 = sub i64 %14, 24
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = sub i64 %15, %17
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = load i64, i64* %5
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %11
%23 = load i64, i64* %7
%24 = trunc i64 %23 to i32
store i32 %24, i32* %3
br label %26
25: ; preds = %11
store i32 -1, i32* %3
br label %26
26: ; preds = %25, %22, %10
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @cio_file_st_get_content_size(i8* %0, i64 %1) {
%3 = icmp ult i64 %1, 24
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = tail call i32 @cio_file_st_get_meta_len(i8* %0)
%6 = add i64 %1, -24
%7 = sext i32 %5 to i64
%8 = sub i64 %6, %7
%9 = icmp ult i64 %8, %1
%10 = trunc i64 %8 to i32
%11 = select i1 %9, i32 %10, i32 -1
br label %12
12: ; preds = %4, %2
%13 = phi i32 [ -1, %2 ], [ %11, %4 ]
ret i32 %13
}