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

/* Variables and functions */
char *cnfCreat(int);
char *cnfCreim(char *const, int);
int /*<<< orphan*/ cnfExprt(char *, char *const, int);
int /*<<< orphan*/ cnfFree(char *);
int /*<<< orphan*/ emsExpnd(char *, char *, int, int /*<<< orphan*/, int *const,
                            int *const);
void ems_expnd_(char *const text, char *const opstr, int *const oplen,
                int *const status, int text_length, int opstr_length) {

  char *str;
  char *ctext;
  ctext = cnfCreim(text, text_length);
  str = cnfCreat(opstr_length);
  emsExpnd(ctext, str, opstr_length, 0, oplen, status);
  cnfExprt(str, opstr, opstr_length);
  cnfFree(ctext);
  cnfFree(str);
}


x86 assembly (clang, -O0):
<ems_expnd_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1070 <cnfCreim@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%edi
call   1050 <cnfCreat@plt>
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
xor    %ecx,%ecx
call   1060 <emsExpnd@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1040 <cnfExprt@plt>
mov    -0x38(%rbp),%rdi
call   1030 <cnfFree@plt>
mov    -0x30(%rbp),%rdi
call   1030 <cnfFree@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ems_expnd_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%ebx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %r8d,%esi
call   1070 <cnfCreim@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1050 <cnfCreat@plt>
mov    %rax,%rbp
mov    %r13,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1060 <emsExpnd@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <cnfExprt@plt>
mov    %r13,%rdi
call   1030 <cnfFree@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <cnfFree@plt>

LLVM IR (-O0):
define void @ems_expnd_(i8* %0, i8* %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%15 = load i8*, i8** %7
%16 = load i32, i32* %11
%17 = call i8* @cnfCreim(i8* %15, i32 %16)
store i8* %17, i8** %14
%18 = load i32, i32* %12
%19 = call i8* @cnfCreat(i32 %18)
store i8* %19, i8** %13
%20 = load i8*, i8** %14
%21 = load i8*, i8** %13
%22 = load i32, i32* %12
%23 = load i32*, i32** %9
%24 = load i32*, i32** %10
%25 = call i32 @emsExpnd(i8* %20, i8* %21, i32 %22, i32 0, i32* %23, i32* %24)
%26 = load i8*, i8** %13
%27 = load i8*, i8** %8
%28 = load i32, i32* %12
%29 = call i32 @cnfExprt(i8* %26, i8* %27, i32 %28)
%30 = load i8*, i8** %14
%31 = call i32 @cnfFree(i8* %30)
%32 = load i8*, i8** %13
%33 = call i32 @cnfFree(i8* %32)
ret void
}

LLVM IR (-O2):
define void @ems_expnd_(i8* %0, i8* %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = tail call i8* @cnfCreim(i8* %0, i32 %4)
%8 = tail call i8* @cnfCreat(i32 %5)
%9 = tail call i32 @emsExpnd(i8* %7, i8* %8, i32 %5, i32 0, i32* %2, i32* %3)
%10 = tail call i32 @cnfExprt(i8* %8, i8* %1, i32 %5)
%11 = tail call i32 @cnfFree(i8* %7)
%12 = tail call i32 @cnfFree(i8* %8)
ret void
}