#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 */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ bzero(char **, int);
int /*<<< orphan*/ memset(char **, char, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[10] = {'a', 'b', 'c', 'd'};
  printf("%s\n", str);
  bzero(&str, 4);
  printf("%s\n", str);
  memset(&str, '*', sizeof(str) - 1);
  printf("%s\n", str);
  bzero(&str, sizeof(str));
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0x4,%esi
call   1050 <bzero@plt>
lea    -0xa(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0x2a,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
lea    -0xa(%rbp),%rsi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1050 <bzero@plt>
lea    -0xa(%rbp),%rsi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movw   $0x0,0x10(%rsp)
movq   $0x64636261,0x8(%rsp)
63 64
lea    0xebc(%rip),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <bzero@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <bzero@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str = [10 x i8] c"abcd\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = bitcast [10 x i8]* %1 to i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = bitcast [10 x i8]* %1 to i8**
%6 = call i32 @bzero(i8** %5, i32 4)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = bitcast [10 x i8]* %1 to i8**
%10 = call i32 @memset(i8** %9, i8 signext 42, i32 9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = bitcast [10 x i8]* %1 to i8**
%14 = call i32 @bzero(i8** %13, i32 10)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [10 x i8] c"abcd\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = bitcast [10 x i8]* %1 to i8**
%5 = call i32 @bzero(i8** %4, i32 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @memset(i8** %4, i8 signext 42, i32 9)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @bzero(i8** %4, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}