#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*/ puts(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strstr(char *, char *);
int main() {
  char *s0 = "One String";
  char *s1 = strchr(s0, 'S');
  puts(s1);
  char *s2 = "One long string";
  char *s3 = strstr(s2, "long");
  puts(s3);
  char s4[64] = {0};
  strcpy(s4, "One");
  puts(s4);
  strcat(s4, ", Two");
  puts(s4);
  strncat(s4, ", Three, Four", 7);
  puts(s4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x53,%esi
call   1050 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <puts@plt>
lea    0xe5f(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1090 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rdi
lea    0xe10(%rip),%rsi
mov    $0x7,%edx
call   1070 <strncat@plt>
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xea1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1050 <strncat@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"One String\00"
@.str.1 = [16 x i8] c"One long string\00"
@.str.2 = [5 x i8] c"long\00"
@.str.3 = [4 x i8] c"One\00"
@.str.4 = [6 x i8] c", Two\00"
@.str.5 = [14 x i8] c", Three, Four\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [64 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @strchr(i8* %7, i8 signext 83)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @puts(i8* %9)
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %4
%11 = load i8*, i8** %4
%12 = call i8* @strstr(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = call i32 @puts(i8* %13)
%15 = bitcast [64 x i8]* %6 to i8*
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%19 = call i32 @puts(i8* %18)
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%23 = call i32 @puts(i8* %22)
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%25 = call i32 @strncat(i8* %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 7)
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%27 = call i32 @puts(i8* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"One String\00"
@.str.1 = [16 x i8] c"One long string\00"
@.str.3 = [4 x i8] c"One\00"
@.str.4 = [6 x i8] c", Two\00"
@.str.5 = [14 x i8] c", Three, Four\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 4))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 4))
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @puts(i8* %4)
%7 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @puts(i8* %4)
%9 = call i32 @strncat(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 7)
%10 = call i32 @puts(i8* %4)
ret i32 0
}