#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 */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
int strlen(char *);
int /*<<< orphan*/ yyerror(char *);
char *strcomb(char *op1, char *op2, char *opt) {
  char *p;
  char *tmp;
  int i;
  int ttlLen;
  ttlLen = strlen(op1) + strlen(op2) + 1 + 3;
  if (!(p = (char *)malloc(sizeof(char) * ttlLen))) {
    yyerror("strcomb out of space");
    abort();
  }
  tmp = op1;
  while (*p++ = *tmp++)
    ;
  p--;
  *p++ = ' ';
  tmp = op2;
  while (*p++ = *tmp++)
    ;
  p--;
  *p++ = ' ';
  tmp = opt;
  while (*p++ = *tmp++)
    ;
  p -= ttlLen;
  return p;
}


x86 assembly (clang, -O0):
<strcomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
add    $0x3,%eax
mov    %eax,-0x30(%rbp)
movslq -0x30(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a9 <strcomb+0x69>
lea    0xe63(%rip),%rdi
call   1040 <yyerror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     11e0 <strcomb+0xa0>
jmp    11b1 <strcomb+0x71>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1235 <strcomb+0xf5>
jmp    1206 <strcomb+0xc6>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x20,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     128a <strcomb+0x14a>
jmp    125b <strcomb+0x11b>
mov    -0x30(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcomb>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
lea    (%r14,%r13,1),%edi
add    $0x4,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     11eb <strcomb+0xab>
add    %r13d,%r14d
nopl   0x0(%rax)
movzbl (%rbx),%ecx
add    $0x1,%rbx
mov    %cl,(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1180 <strcomb+0x40>
movb   $0x20,-0x1(%rax)
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r12),%ecx
add    $0x1,%r12
mov    %cl,(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    11a0 <strcomb+0x60>
movb   $0x20,-0x1(%rax)
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%r15,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    11c0 <strcomb+0x80>
mov    $0xfffffffc,%edx
sub    %r14d,%edx
movslq %edx,%rdx
add    %rdx,%rax
add    %rcx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe0e(%rip),%rdi
call   1040 <yyerror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"strcomb out of space\00"
define i8* @strcomb(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %12, %14
%16 = add nsw i32 %15, 1
%17 = add nsw i32 %16, 3
store i32 %17, i32* %10
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
%20 = mul i64 1, %19
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %7
%24 = icmp ne i8* %23, null
br i1 %24, label %28, label %25
25: ; preds = %3
%26 = call i32 @yyerror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%27 = call i32 (...) @abort()
unreachable
28: ; preds = %3
%29 = load i8*, i8** %4
store i8* %29, i8** %8
br label %30
30: ; preds = %37, %28
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %8
%33 = load i8, i8* %31
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %7
store i8 %33, i8* %34
%36 = icmp ne i8 %33, 0
br i1 %36, label %37, label %38
37: ; preds = %30
br label %30
38: ; preds = %30
%39 = load i8*, i8** %7
%40 = getelementptr inbounds i8, i8* %39, i32 -1
store i8* %40, i8** %7
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %7
store i8 32, i8* %41
%43 = load i8*, i8** %5
store i8* %43, i8** %8
br label %44
44: ; preds = %51, %38
%45 = load i8*, i8** %8
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %8
%47 = load i8, i8* %45
%48 = load i8*, i8** %7
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %7
store i8 %47, i8* %48
%50 = icmp ne i8 %47, 0
br i1 %50, label %51, label %52
51: ; preds = %44
br label %44
52: ; preds = %44
%53 = load i8*, i8** %7
%54 = getelementptr inbounds i8, i8* %53, i32 -1
store i8* %54, i8** %7
%55 = load i8*, i8** %7
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %7
store i8 32, i8* %55
%57 = load i8*, i8** %6
store i8* %57, i8** %8
br label %58
58: ; preds = %65, %52
%59 = load i8*, i8** %8
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %8
%61 = load i8, i8* %59
%62 = load i8*, i8** %7
%63 = getelementptr inbounds i8, i8* %62, i32 1
store i8* %63, i8** %7
store i8 %61, i8* %62
%64 = icmp ne i8 %61, 0
br i1 %64, label %65, label %66
65: ; preds = %58
br label %58
66: ; preds = %58
%67 = load i32, i32* %10
%68 = load i8*, i8** %7
%69 = sext i32 %67 to i64
%70 = sub i64 0, %69
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8* %71, i8** %7
%72 = load i8*, i8** %7
ret i8* %72
}

LLVM IR (-O2):
@.str = [21 x i8] c"strcomb out of space\00"
define i8* @strcomb(i8* %0, i8* %1, i8* nocapture %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = add nsw i32 %5, %4
%7 = add nsw i32 %6, 4
%8 = tail call i64 @malloc(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = tail call i32 @yyerror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (...) @abort()
unreachable
13: ; preds = %3
%14 = inttoptr i64 %8 to i8*
br label %15
15: ; preds = %15, %13
%16 = phi i8* [ %0, %13 ], [ %18, %15 ]
%17 = phi i8* [ %14, %13 ], [ %20, %15 ]
%18 = getelementptr inbounds i8, i8* %16, i64 1
%19 = load i8, i8* %16
%20 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %19, i8* %17
%21 = icmp eq i8 %19, 0
br i1 %21, label %22, label %15
22: ; preds = %15
store i8 32, i8* %17
br label %23
23: ; preds = %23, %22
%24 = phi i8* [ %1, %22 ], [ %27, %23 ]
%25 = phi i8* [ %17, %22 ], [ %26, %23 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = getelementptr inbounds i8, i8* %24, i64 1
%28 = load i8, i8* %24
store i8 %28, i8* %26
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %23
30: ; preds = %23
%31 = getelementptr inbounds i8, i8* %25, i64 2
store i8 32, i8* %26
br label %32
32: ; preds = %32, %30
%33 = phi i8* [ %2, %30 ], [ %35, %32 ]
%34 = phi i8* [ %31, %30 ], [ %37, %32 ]
%35 = getelementptr inbounds i8, i8* %33, i64 1
%36 = load i8, i8* %33
%37 = getelementptr inbounds i8, i8* %34, i64 1
store i8 %36, i8* %34
%38 = icmp eq i8 %36, 0
br i1 %38, label %39, label %32
39: ; preds = %32
%40 = sub i32 -4, %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %37, i64 %41
ret i8* %42
}