#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 */
struct subText {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ doSub(char *, char *, struct subText *);
int /*<<< orphan*/ errAbort(char *, char *, int);
int subTextSizeAfter(struct subText *, char *);
void subTextStatic(struct subText *subList, char *in, char *out,
                   int outMaxSize) {
  int newSize = subTextSizeAfter(subList, in);
  if (newSize >= outMaxSize)
    errAbort("%s would expand to more than %d bytes", in, outMaxSize);
  doSub(in, out, subList);
}


x86 assembly (clang, -O0):
<subTextStatic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <subTextSizeAfter@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1176 <subTextStatic+0x46>
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe8f(%rip),%rdi
call   1040 <errAbort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <doSub@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subTextStatic>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
call   1050 <subTextSizeAfter@plt>
cmp    %ebp,%eax
jl     115c <subTextStatic+0x2c>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <errAbort@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <doSub@plt>

LLVM IR (-O0):
%struct.subText = type { i32 }
@.str = [38 x i8] c"%s would expand to more than %d bytes\00"
define void @subTextStatic(%struct.subText* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.subText*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store %struct.subText* %0, %struct.subText** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load %struct.subText*, %struct.subText** %5
%11 = load i8*, i8** %6
%12 = call i32 @subTextSizeAfter(%struct.subText* %10, i8* %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = load i32, i32* %8
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = load i32, i32* %8
%19 = call i32 @errAbort(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18)
br label %20
20: ; preds = %16, %4
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = load %struct.subText*, %struct.subText** %5
%24 = call i32 @doSub(i8* %21, i8* %22, %struct.subText* %23)
ret void
}

LLVM IR (-O2):
%struct.subText = type { i32 }
@.str = [38 x i8] c"%s would expand to more than %d bytes\00"
define void @subTextStatic(%struct.subText* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @subTextSizeAfter(%struct.subText* %0, i8* %1)
%6 = icmp slt i32 %5, %3
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @errAbort(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3)
br label %9
9: ; preds = %7, %4
%10 = tail call i32 @doSub(i8* %1, i8* %2, %struct.subText* %0)
ret void
}