#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*/ printf(char *, char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen0(char *);
int strlen1(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  char h0[] = {'S', 't', 'r', 'i', 'n', 'g', '\0'};
  char h1[] = "String";
  char h2[7] = "String";
  char *h3 = "String";
  puts(h0);
  puts(h1);
  puts(h2);
  puts(h3);
  printf(" %s : %d\n", h0, strlen0(h0));
  printf(" %s : %d\n", h0, strlen1(h0));
  char *h4 = "One string";
  char h5[11] = {0};
  strcpy(h5, h4);
  puts(h5);
  char *h6 = "0123456789";
  char h7[11] = {0};
  strncpy(h7, h6, 5);
  puts(h7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe7b(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xe75(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe6d(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xe5e(%rip),%eax
mov    %eax,-0x12(%rbp)
mov    0xe58(%rip),%ax
mov    %ax,-0xe(%rbp)
mov    0xe50(%rip),%al
mov    %al,-0xc(%rbp)
mov    0xe41(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe3b(%rip),%ax
mov    %ax,-0x15(%rbp)
mov    0xe33(%rip),%al
mov    %al,-0x13(%rbp)
lea    0xe23(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0xb(%rbp),%rdi
call   1060 <puts@plt>
lea    -0x12(%rbp),%rdi
call   1060 <puts@plt>
lea    -0x19(%rbp),%rdi
call   1060 <puts@plt>
mov    -0x28(%rbp),%rdi
call   1060 <puts@plt>
lea    -0xb(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0xb(%rbp),%rdi
call   1090 <strlen0@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0xde4(%rip),%rdi
call   1070 <printf@plt>
lea    -0xb(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0xb(%rbp),%rdi
call   1030 <strlen1@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    0xdc1(%rip),%rdi
call   1070 <printf@plt>
lea    0xdbf(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x3b(%rbp),%rdi
xor    %esi,%esi
mov    $0xb,%edx
call   1080 <memset@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x3b(%rbp),%rdi
call   1060 <puts@plt>
lea    0xd99(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x53(%rbp),%rdi
xor    %esi,%esi
mov    $0xb,%edx
call   1080 <memset@plt>
lea    -0x53(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    $0x5,%edx
call   1040 <strncpy@plt>
lea    -0x53(%rbp),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movl   $0x676e69,0x13(%rsp)
movl   $0x69727453,0x10(%rsp)
69
lea    0xe82(%rip),%r14
movl   $0x676e69,0xb(%rsp)
movl   $0x69727453,0x8(%rsp)
69
movl   $0x676e69,0x3(%rsp)
movl   $0x69727453,(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <puts@plt>
lea    0x8(%rsp),%rdi
call   1060 <puts@plt>
mov    %rsp,%rdi
call   1060 <puts@plt>
mov    %r14,%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
call   1080 <strlen0@plt>
lea    0xe34(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen1@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1070 <printf@plt>
movl   $0x0,0x2f(%rsp)
movq   $0x0,0x28(%rsp)
lea    0xe04(%rip),%rsi
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <puts@plt>
movl   $0x0,0x1f(%rsp)
movq   $0x0,0x18(%rsp)
lea    0xde2(%rip),%rsi
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%edx
call   1040 <strncpy@plt>
mov    %rbx,%rdi
call   1060 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.h0 = [7 x i8] c"String\00"
@__const.main.h1 = [7 x i8] c"String\00"
@__const.main.h2 = [7 x i8] c"String\00"
@.str = [7 x i8] c"String\00"
@.str.1 = [10 x i8] c" %s : %d\0A\00"
@.str.2 = [11 x i8] c"One string\00"
@.str.3 = [11 x i8] c"0123456789\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [7 x i8]
%4 = alloca [7 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [11 x i8]
%8 = alloca i8*
%9 = alloca [11 x i8]
store i32 0, i32* %1
%10 = bitcast [7 x i8]* %2 to i8*
%11 = bitcast [7 x i8]* %3 to i8*
%12 = bitcast [7 x i8]* %4 to i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %5
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%18 = call i32 @puts(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @puts(i8* %19)
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%23 = call i32 @strlen0(i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %23)
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%27 = call i32 @strlen1(i8* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %25, i32 %27)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %6
%29 = bitcast [11 x i8]* %7 to i8*
%30 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%31 = load i8*, i8** %6
%32 = call i32 @strcpy(i8* %30, i8* %31)
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%34 = call i32 @puts(i8* %33)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %8
%35 = bitcast [11 x i8]* %9 to i8*
%36 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%37 = load i8*, i8** %8
%38 = call i32 @strncpy(i8* %36, i8* %37, i32 5)
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%40 = call i32 @puts(i8* %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"String\00"
@.str.1 = [10 x i8] c" %s : %d\0A\00"
@.str.2 = [11 x i8] c"One string\00"
@.str.3 = [11 x i8] c"0123456789\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [7 x i8]
%3 = alloca [7 x i8]
%4 = alloca [11 x i8]
%5 = alloca [11 x i8]
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%9 = call i32 @puts(i8* %6)
%10 = call i32 @puts(i8* %7)
%11 = call i32 @puts(i8* %8)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @strlen0(i8* %6)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 %13)
%15 = call i32 @strlen1(i8* %6)
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 %15)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @puts(i8* %17)
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%21 = call i32 @strncpy(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 5)
%22 = call i32 @puts(i8* %20)
ret i32 0
}