#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*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
char *message_get_style(char *dest, const char *style, const char *colorcode,
                        const char *backgroundcode) {
  char ret[12] = "";
  strcat(ret, "\e[");
  strcat(ret, style);
  strcat(ret, ";");
  strcat(ret, colorcode);
  strcat(ret, ";");
  strcat(ret, backgroundcode);
  strcat(ret, "m");
  strcpy(dest, ret);
  return dest;
}


x86 assembly (clang, -O0):
<message_get_style>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    -0x2c(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x2c(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<message_get_style>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r14
movl   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xeb0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcat@plt>
lea    0xe96(%rip),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\1B[\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [2 x i8] c"m\00"
define i8* @message_get_style(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [12 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = bitcast [12 x i8]* %9 to i8*
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%12 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%14 = load i8*, i8** %6
%15 = call i32 @strcat(i8* %13, i8* %14)
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%17 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%19 = load i8*, i8** %7
%20 = call i32 @strcat(i8* %18, i8* %19)
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%22 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%24 = load i8*, i8** %8
%25 = call i32 @strcat(i8* %23, i8* %24)
%26 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = load i8*, i8** %5
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%30 = call i32 @strcpy(i8* %28, i8* %29)
%31 = load i8*, i8** %5
ret i8* %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"\1B[\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [2 x i8] c"m\00"
define i8* @message_get_style(i8* returned %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [12 x i8]
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%7 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @strcat(i8* %6, i8* %1)
%9 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @strcat(i8* %6, i8* %2)
%11 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @strcat(i8* %6, i8* %3)
%13 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @strcpy(i8* %0, i8* %6)
ret i8* %0
}