#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 *concat(char *, char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char t_sep[20] = ",";
  char ch1[20] = "ON";
  char ch2[20] = "OFF";
  char ch3[20] = "OFF";
  char ch4[20] = "ON";
  char *the_data;
  the_data = concat(ch1, t_sep, ch2, t_sep, ch3, t_sep, ch4);
  printf("result: %s\n", the_data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec3(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x50(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x70(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x90(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x80(%rbp),%r8
lea    -0x20(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <concat@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xa8,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movl   $0x0,0xa0(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movl   $0x0,0x80(%rsp)
movaps 0xec1(%rip),%xmm1
movaps %xmm1,0x50(%rsp)
movl   $0x0,0x60(%rsp)
movaps %xmm1,0x30(%rsp)
movl   $0x0,0x40(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0x70(%rsp),%rdi
lea    0x50(%rsp),%rdx
lea    0x30(%rsp),%r8
lea    0x90(%rsp),%rcx
mov    %rcx,%rsi
mov    %rcx,%r9
call   1040 <concat@plt>
lea    0xe9c(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
ret

LLVM IR (-O0):
@__const.main.t_sep = [20 x i8] c",\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch1 = [20 x i8] c"ON\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch2 = [20 x i8] c"OFF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch3 = [20 x i8] c"OFF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch4 = [20 x i8] c"ON\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [12 x i8] c"result: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca i8*
store i32 0, i32* %1
%8 = bitcast [20 x i8]* %2 to i8*
%9 = bitcast [20 x i8]* %3 to i8*
%10 = bitcast [20 x i8]* %4 to i8*
%11 = bitcast [20 x i8]* %5 to i8*
%12 = bitcast [20 x i8]* %6 to i8*
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%20 = call i8* @concat(i8* %13, i8* %14, i8* %15, i8* %16, i8* %17, i8* %18, i8* %19)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.t_sep = [20 x i8] c",\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch3 = [20 x i8] c"OFF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ch4 = [20 x i8] c"ON\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [12 x i8] c"result: %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%11 = call i8* @concat(i8* %7, i8* %6, i8* %8, i8* %6, i8* %9, i8* %6, i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %11)
ret i32 0
}