#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*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char buf1[32];
  char buf2[32];
  memset(buf1, '\0', 32);
  memset(buf2, '\0', 32);
  printf("buf1 = %s\n", buf1);
  printf("buf2 = %s\n", buf2);
  strcpy(buf1, "ABCDE");
  memset(buf2, 'A', 5);
  printf("buf1 = %s\n", buf1);
  printf("buf2 = %s\n", buf2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x41,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    0xe98(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe91(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xe8a(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"buf1 = %s\0A\00"
@.str.1 = [11 x i8] c"buf2 = %s\0A\00"
@.str.2 = [6 x i8] c"ABCDE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 0, i32 32)
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i8 signext 0, i32 32)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i8 signext 65, i32 5)
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"buf1 = %s\0A\00"
@.str.1 = [11 x i8] c"buf2 = %s\0A\00"
@.str.2 = [6 x i8] c"ABCDE\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %3, i8 signext 0, i32 32)
%6 = call i32 @memset(i8* %4, i8 signext 0, i32 32)
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @memset(i8* %4, i8 signext 65, i32 5)
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}