#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char name[] = {'M', 'E', 'M', 'M', 'E', 'M', '\0'};
  char myname[12];
  char course[] = "MEM";
  strcpy(myname, name);
  printf("name = %s\n", name);
  printf("myname = %s\n", myname);
  printf("course = %s\n", course);
  printf("strlen(name) = %d\n", strlen(name));
  printf("strcmp(name, myname) = %d", strcmp(name, myname));
  printf("strcmp(course, name) = %d", strcmp(course, name));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xe91(%rip),%eax
mov    %eax,-0x1b(%rbp)
lea    -0x17(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xb(%rbp),%rsi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x17(%rbp),%rsi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0x4d454d,0xf(%rsp)
movl   $0x4d4d454d,0xc(%rsp)
4d
movl   $0x4d454d,0x8(%rsp)
lea    0x14(%rsp),%r14
lea    0xc(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe75(%rip),%rdi
lea    0x8(%rsp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
lea    0xe5c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.name = [7 x i8] c"MEMMEM\00"
@__const.main.course = [4 x i8] c"MEM\00"
@.str = [11 x i8] c"name = %s\0A\00"
@.str.1 = [13 x i8] c"myname = %s\0A\00"
@.str.2 = [13 x i8] c"course = %s\0A\00"
@.str.3 = [19 x i8] c"strlen(name) = %d\0A\00"
@.str.4 = [26 x i8] c"strcmp(name, myname) = %d\00"
@.str.5 = [26 x i8] c"strcmp(course, name) = %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [12 x i8]
%4 = alloca [4 x i8]
store i32 0, i32* %1
%5 = bitcast [7 x i8]* %2 to i8*
%6 = bitcast [4 x i8]* %4 to i8*
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%21 = call i32 @strcmp(i8* %19, i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%25 = call i32 @strcmp(i8* %23, i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}

LLVM IR (-O2):
@__const.main.name = [7 x i8] c"MEMMEM\00"
@.str = [11 x i8] c"name = %s\0A\00"
@.str.1 = [13 x i8] c"myname = %s\0A\00"
@.str.2 = [13 x i8] c"course = %s\0A\00"
@.str.3 = [19 x i8] c"strlen(name) = %d\0A\00"
@.str.4 = [26 x i8] c"strcmp(name, myname) = %d\00"
@.str.5 = [26 x i8] c"strcmp(course, name) = %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [12 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
store i32 5064013, i32* %3
%7 = call i32 @strcpy(i8* %5, i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = call i32 @strlen(i8* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 @strcmp(i8* %4, i8* %5)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = call i32 @strcmp(i8* %6, i8* %4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}