#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 *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char s1[20] = {'t', 'e', 's', 't', 0};
  char s2[] = {'d', 'e', 'n', 'e', 'm', 'e', 0};
  char s3[] = "string test";
  char *cp = s3;
  printf("%s %d\n", s1, strlen(s1));
  printf("%s %d\n", s2, strlen(s2));
  printf("%s %d\n", s3, strlen(s3));
  printf("%s\n", cp);
  printf("\nstrcpy:\n");
  strcpy(s1, s2);
  printf("%s %d\n", s1, strlen(s1));
  printf("\nstrcat:\n");
  strcat(s1, s3);
  printf("%s %d\n", s1, strlen(s1));
  printf("\nstrcmp:\n");
  printf("s1: %s\n", s1);
  s2[0] = 'a';
  printf("s2: %s\n", s2);
  printf("s1-s1 %d\n", strcmp(s1, s1));
  printf("s1-s2 %d\n", strcmp(s1, s2));
  printf("s2-s1 %d\n", strcmp(s2, s1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe95(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xe90(%rip),%eax
mov    %eax,-0x27(%rbp)
mov    0xe8a(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe82(%rip),%al
mov    %al,-0x21(%rbp)
mov    0xe79(%rip),%rax
mov    %rax,-0x33(%rbp)
mov    0xe77(%rip),%eax
mov    %eax,-0x2b(%rbp)
lea    -0x33(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x27(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x27(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x33(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x33(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x33(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movb   $0x61,-0x27(%rbp)
lea    -0x27(%rbp),%rsi
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x27(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0xe9f(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x656d65,0xb(%rsp)
movl   $0x656e6564,0x8(%rsp)
65
movabs $0x7420676e69727473,%rax
67 20 74
mov    %rax,0x10(%rsp)
movl   $0x747365,0x18(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe6b(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe25(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe00(%rip),%rdi
call   1040 <puts@plt>
lea    0xdb4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x61,0x8(%rsp)
lea    0xda6(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd9d(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
lea    0xd8c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
lea    0xd7b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.s1 = <{ i8, i8, i8, i8, [16 x i8] }> <{ i8 116, i8 101, i8 115, i8 116, [16 x i8] zeroinitializer }>
@__const.main.s2 = [7 x i8] c"deneme\00"
@__const.main.s3 = [12 x i8] c"string test\00"
@.str = [7 x i8] c"%s %d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [10 x i8] c"\0Astrcpy:\0A\00"
@.str.3 = [10 x i8] c"\0Astrcat:\0A\00"
@.str.4 = [10 x i8] c"\0Astrcmp:\0A\00"
@.str.5 = [8 x i8] c"s1: %s\0A\00"
@.str.6 = [8 x i8] c"s2: %s\0A\00"
@.str.7 = [10 x i8] c"s1-s1 %d\0A\00"
@.str.8 = [10 x i8] c"s1-s2 %d\0A\00"
@.str.9 = [10 x i8] c"s2-s1 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [7 x i8]
%4 = alloca [12 x i8]
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [20 x i8]* %2 to i8*
%7 = bitcast [7 x i8]* %3 to i8*
%8 = bitcast [12 x i8]* %4 to i8*
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
store i8* %9, i8** %5
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %12)
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %16)
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %20)
%22 = load i8*, i8** %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%27 = call i32 @strcpy(i8* %25, i8* %26)
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %28, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%35 = call i32 @strcat(i8* %33, i8* %34)
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %36, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%41 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %41)
%43 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 97, i8* %43
%44 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %44)
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%48 = call i32 @strcmp(i8* %46, i8* %47)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%51 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%52 = call i32 @strcmp(i8* %50, i8* %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%56 = call i32 @strcmp(i8* %54, i8* %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %56)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s1 = <{ i8, i8, i8, i8, [16 x i8] }> <{ i8 116, i8 101, i8 115, i8 116, [16 x i8] zeroinitializer }>
@__const.main.s2 = [7 x i8] c"deneme\00"
@__const.main.s3 = [12 x i8] c"string test\00"
@.str = [7 x i8] c"%s %d\0A\00"
@.str.5 = [8 x i8] c"s1: %s\0A\00"
@.str.6 = [8 x i8] c"s2: %s\0A\00"
@.str.7 = [10 x i8] c"s1-s1 %d\0A\00"
@.str.8 = [10 x i8] c"s1-s2 %d\0A\00"
@.str.9 = [10 x i8] c"s2-s1 %d\0A\00"
@str = [9 x i8] c"\0Astrcpy:\00"
@str.10 = [9 x i8] c"\0Astrcat:\00"
@str.11 = [9 x i8] c"\0Astrcmp:\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [7 x i8]
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %7)
%9 = call i32 @strlen(i8* %5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %9)
%11 = call i32 @strlen(i8* %6)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %11)
%13 = call i32 @puts(i8* %6)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%15 = call i32 @strcpy(i8* %4, i8* %5)
%16 = call i32 @strlen(i8* %4)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
%19 = call i32 @strcat(i8* %4, i8* %6)
%20 = call i32 @strlen(i8* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %20)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %4)
store i8 97, i8* %5
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %5)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 0)
%26 = call i32 @strcmp(i8* %4, i8* %5)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %26)
%28 = call i32 @strcmp(i8* %5, i8* %4)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %28)
ret i32 0
}