#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 session {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ get_arg_in_braces(char *, char *, int);
int /*<<< orphan*/ substitute(struct session *, char *, char *, int);
int /*<<< orphan*/ write_line_mud(char *, struct session *);
struct session *do_send(struct session *ses, char *arg) {
  char left[10000], out[10000];
  get_arg_in_braces(arg, left, 1);
  substitute(ses, left, out, (1 << 1) | (1 << 2) | (1 << 4) | (1 << 8));
  write_line_mud(out, ses);
  return ses;
}


x86 assembly (clang, -O0):
<do_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x2720(%rbp),%rsi
mov    $0x1,%edx
call   1030 <get_arg_in_braces@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2720(%rbp),%rsi
lea    -0x4e30(%rbp),%rdx
mov    $0x116,%ecx
call   1050 <substitute@plt>
lea    -0x4e30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <write_line_mud@plt>
mov    -0x8(%rbp),%rax
add    $0x4e30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_send>:
push   %r15
push   %r14
push   %rbx
sub    $0x4e20,%rsp
mov    %rdi,%rbx
lea    0x2710(%rsp),%r14
mov    %rsi,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <get_arg_in_braces@plt>
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x116,%ecx
call   1050 <substitute@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <write_line_mud@plt>
mov    %rbx,%rax
add    $0x4e20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.session = type { i32 }
define %struct.session* @do_send(%struct.session* %0, i8* %1) {
%3 = alloca %struct.session*
%4 = alloca i8*
%5 = alloca [10000 x i8]
%6 = alloca [10000 x i8]
store %struct.session* %0, %struct.session** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%9 = call i32 @get_arg_in_braces(i8* %7, i8* %8, i32 1)
%10 = load %struct.session*, %struct.session** %3
%11 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%13 = call i32 @substitute(%struct.session* %10, i8* %11, i8* %12, i32 278)
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%15 = load %struct.session*, %struct.session** %3
%16 = call i32 @write_line_mud(i8* %14, %struct.session* %15)
%17 = load %struct.session*, %struct.session** %3
ret %struct.session* %17
}

LLVM IR (-O2):
%struct.session = type { i32 }
define %struct.session* @do_send(%struct.session* returned %0, i8* %1) {
%3 = alloca [10000 x i8]
%4 = alloca [10000 x i8]
%5 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%7 = call i32 @get_arg_in_braces(i8* %1, i8* %5, i32 1)
%8 = call i32 @substitute(%struct.session* %0, i8* %5, i8* %6, i32 278)
%9 = call i32 @write_line_mud(i8* %6, %struct.session* %0)
ret %struct.session* %0
}