#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 organisation[20] = "FH Dortmund";
  char string2[20];
  printf("organisation = \"%s\"\n", organisation);
  printf("string2      = \"%s\"\n", string2);
  printf("\nRunning: strcpy(string2, organisation)\n");
  strcpy(string2, organisation);
  printf("organisation = \"%s\"\n", organisation);
  printf("string2      = \"%s\"\n", string2);
  printf("\nRunning: strlen(string2)\n");
  printf("strlen(string2) = %ld\n", strlen(string2));
  printf("\nRunning: strcmp(string2, organisation)\n");
  printf("strcmp(string2, organisation) = %d\n", strcmp(string2, organisation));
  printf("\nRunning: strcat(string2, organisation)\n");
  strcat(string2, organisation);
  printf("organisation = \"%s\"\n", organisation);
  printf("string2      = \"%s\"\n", string2);
  printf("\nRunning: strcmp(string2, organisation)\n");
  printf("strcmp(string2, organisation) = %d\n", strcmp(string2, organisation));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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)
lea    -0x20(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x20(%rbp),%rsi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe8c(%rip),%r15
mov    %rsp,%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe8a(%rip),%r12
lea    0x20(%rsp),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe41(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xed6(%rip),%r13
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
lea    0xe2e(%rip),%rbp
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.organisation = [20 x i8] c"FH Dortmund\00\00\00\00\00\00\00\00\00"
@.str = [21 x i8] c"organisation = \22%s\22\0A\00"
@.str.1 = [21 x i8] c"string2 = \22%s\22\0A\00"
@.str.2 = [41 x i8] c"\0ARunning: strcpy(string2, organisation)\0A\00"
@.str.3 = [27 x i8] c"\0ARunning: strlen(string2)\0A\00"
@.str.4 = [23 x i8] c"strlen(string2) = %ld\0A\00"
@.str.5 = [41 x i8] c"\0ARunning: strcmp(string2, organisation)\0A\00"
@.str.6 = [36 x i8] c"strcmp(string2, organisation) = %d\0A\00"
@.str.7 = [41 x i8] c"\0ARunning: strcat(string2, organisation)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = bitcast [20 x i8]* %2 to i8*
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%24 = call i32 @strcmp(i8* %22, i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%29 = call i32 @strcat(i8* %27, i8* %28)
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%37 = call i32 @strcmp(i8* %35, i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@__const.main.organisation = [20 x i8] c"FH Dortmund\00\00\00\00\00\00\00\00\00"
@.str = [21 x i8] c"organisation = \22%s\22\0A\00"
@.str.1 = [21 x i8] c"string2 = \22%s\22\0A\00"
@.str.4 = [23 x i8] c"strlen(string2) = %ld\0A\00"
@.str.6 = [36 x i8] c"strcmp(string2, organisation) = %d\0A\00"
@str = [40 x i8] c"\0ARunning: strcpy(string2, organisation)\00"
@str.8 = [26 x i8] c"\0ARunning: strlen(string2)\00"
@str.10 = [40 x i8] c"\0ARunning: strcat(string2, organisation)\00"
@str.11 = [40 x i8] c"\0ARunning: strcmp(string2, organisation)\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%8 = call i32 @strcpy(i8* %4, i8* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
%12 = call i32 @strlen(i8* %4)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
%15 = call i32 @strcmp(i8* %4, i8* %3)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.10, i64 0, i64 0))
%18 = call i32 @strcat(i8* %4, i8* %3)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
%22 = call i32 @strcmp(i8* %4, i8* %3)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %22)
ret i32 0
}