#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 */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void help() {
  char msg1[] = "Please, do not take me to Melkor !\n";
  char msg2[] = "He'll corrupt me !\n";
  char msg[strlen(msg1) + strlen(msg2) + 1];
  strncpy(msg, msg1, sizeof(msg) - 1);
  strncat(msg, msg2, sizeof(msg) - 1);
  fprintf(stdout, "%s", msg);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movaps 0xebe(%rip),%xmm0
movaps %xmm0,-0x20(%rbp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movl   $0xa2120,-0x10(%rbp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movl   $0xa2120,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x78(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x78(%rbp),%rcx
mov    %rax,%rdx
lea    0x1(%rcx,%rdx,1),%rax
mov    %rax,-0x70(%rbp)
mov    %rsp,%rsi
mov    %rsi,-0x58(%rbp)
lea    0x10(%rcx,%rdx,1),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x68(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x60(%rbp)
lea    -0x30(%rbp),%rsi
sub    $0x1,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rax
lea    -0x50(%rbp),%rsi
sub    $0x1,%rax
mov    %eax,%edx
call   1050 <strncat@plt>
mov    -0x68(%rbp),%rdx
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movl   $0xa2120,-0x50(%rbp)
movaps 0xebb(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
movl   $0xa2120,-0x30(%rbp)
lea    -0x70(%rbp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
lea    -0x40(%rbp),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rsp,%r13
lea    (%rax,%rbx,1),%r12
add    %rbx,%rax
add    $0x10,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1050 <strncat@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.help.msg1 = [36 x i8] c"Please, do not take me to Melkor !\0A\00"
@__const.help.msg2 = [20 x i8] c"He'll corrupt me !\0A\00"
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @help() {
%1 = alloca [36 x i8]
%2 = alloca [20 x i8]
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast [36 x i8]* %1 to i8*
%6 = bitcast [20 x i8]* %2 to i8*
%7 = getelementptr inbounds [36 x i8], [36 x i8]* %1, i64 0, i64 0
%8 = call i64 @strlen(i8* %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %8, %10
%12 = add nsw i64 %11, 1
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %3
%14 = alloca i8, i64 %12
store i64 %12, i64* %4
%15 = getelementptr inbounds [36 x i8], [36 x i8]* %1, i64 0, i64 0
%16 = sub i64 %12, 1
%17 = trunc i64 %16 to i32
%18 = call i32 @strncpy(i8* %14, i8* %15, i32 %17)
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%20 = sub i64 %12, 1
%21 = trunc i64 %20 to i32
%22 = call i32 @strncat(i8* %14, i8* %19, i32 %21)
%23 = load i32, i32* @stdout
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%25 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@__const.help.msg1 = [36 x i8] c"Please, do not take me to Melkor !\0A\00"
@__const.help.msg2 = [20 x i8] c"He'll corrupt me !\0A\00"
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @help() {
%1 = alloca [36 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [36 x i8], [36 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i64 @strlen(i8* %3)
%6 = call i64 @strlen(i8* %4)
%7 = add nsw i64 %6, %5
%8 = add nsw i64 %7, 1
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %8
%11 = trunc i64 %7 to i32
%12 = call i32 @strncpy(i8* %10, i8* %3, i32 %11)
%13 = call i32 @strncat(i8* %10, i8* %4, i32 %11)
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}