#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 *STACK_PUSH(char *, char *, char *);
char *STACKCAT(char *stack_ptr, char *push1, char *push2, char *end_of_stack) {
  char *retval;
  retval = STACK_PUSH(stack_ptr, push1, end_of_stack);
  if (!retval) {
    return retval;
  }
  retval--;
  retval = STACK_PUSH(retval, push2, end_of_stack);
  return retval;
}


x86 assembly (clang, -O0):
<STACKCAT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <STACK_PUSH@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1155 <STACKCAT+0x45>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <STACKCAT+0x6e>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <STACK_PUSH@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STACKCAT>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rcx,%rdx
call   1030 <STACK_PUSH@plt>
test   %rax,%rax
je     1140 <STACKCAT+0x30>
add    $0xffffffffffffffff,%rax
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <STACK_PUSH@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @STACKCAT(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %9
%14 = call i8* @STACK_PUSH(i8* %11, i8* %12, i8* %13)
store i8* %14, i8** %10
%15 = load i8*, i8** %10
%16 = icmp ne i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %4
%18 = load i8*, i8** %10
store i8* %18, i8** %5
br label %27
19: ; preds = %4
%20 = load i8*, i8** %10
%21 = getelementptr inbounds i8, i8* %20, i32 -1
store i8* %21, i8** %10
%22 = load i8*, i8** %10
%23 = load i8*, i8** %8
%24 = load i8*, i8** %9
%25 = call i8* @STACK_PUSH(i8* %22, i8* %23, i8* %24)
store i8* %25, i8** %10
%26 = load i8*, i8** %10
store i8* %26, i8** %5
br label %27
27: ; preds = %19, %17
%28 = load i8*, i8** %5
ret i8* %28
}

LLVM IR (-O2):
define i8* @STACKCAT(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* @STACK_PUSH(i8* %0, i8* %1, i8* %3)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 -1
%9 = tail call i8* @STACK_PUSH(i8* %8, i8* %2, i8* %3)
br label %10
10: ; preds = %4, %7
%11 = phi i8* [ %9, %7 ], [ null, %4 ]
ret i8* %11
}