#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*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ m4errx(int, char *, char *);
size_t regerror(int, int /*<<< orphan*/ *, char *, size_t);
char *xalloc(size_t, char *, unsigned long);
void exit_regerror(int er, regex_t *re) {
  size_t errlen;
  char *errbuf;
  errlen = regerror(er, re, NULL, 0);
  errbuf = xalloc(errlen, "malloc in regerror: %lu", (unsigned long)errlen);
  regerror(er, re, errbuf, errlen);
  m4errx(1, "regular expression error: %s.", errbuf);
}


x86 assembly (clang, -O0):
<exit_regerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1040 <regerror@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe9b(%rip),%rsi
call   1050 <xalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <regerror@plt>
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
lea    0xe86(%rip),%rsi
call   1030 <m4errx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_regerror>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <regerror@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rsi
mov    %rax,%rdi
mov    %rax,%rdx
call   1050 <xalloc@plt>
mov    %rax,%rbp
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <regerror@plt>
lea    0xea2(%rip),%rsi
mov    $0x1,%edi
mov    %rbp,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <m4errx@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"malloc in regerror: %lu\00"
@.str.1 = [30 x i8] c"regular expression error: %s.\00"
define void @exit_regerror(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i8*
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = load i32*, i32** %4
%9 = call i64 @regerror(i32 %7, i32* %8, i8* null, i64 0)
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = load i64, i64* %5
%12 = call i8* @xalloc(i64 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %11)
store i8* %12, i8** %6
%13 = load i32, i32* %3
%14 = load i32*, i32** %4
%15 = load i8*, i8** %6
%16 = load i64, i64* %5
%17 = call i64 @regerror(i32 %13, i32* %14, i8* %15, i64 %16)
%18 = load i8*, i8** %6
%19 = call i32 @m4errx(i32 1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %18)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"malloc in regerror: %lu\00"
@.str.1 = [30 x i8] c"regular expression error: %s.\00"
define void @exit_regerror(i32 %0, i32* %1) {
%3 = tail call i64 @regerror(i32 %0, i32* %1, i8* null, i64 0)
%4 = tail call i8* @xalloc(i64 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = tail call i64 @regerror(i32 %0, i32* %1, i8* %4, i64 %3)
%6 = tail call i32 @m4errx(i32 1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}