#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*/ ft_bzero(char *, int);
int /*<<< orphan*/ printf(char *, ...);
char *strdup(char *);
int main(int ac, char **av) {
  printf("-----------------------\n");
  printf("         bzero         \n");
  printf("-----------------------\n");
  char *str = strdup("abcdef");
  printf("__ STR = '%s' __\n", str);
  printf("AVANT :\n");
  printf("%d - %d - %d - %d - %d - %d\n", str[0], str[1], str[2], str[3],
         str[4], str[5]);
  ft_bzero(str, 4);
  printf("\nft_bzero(str, 4)\n\n");
  printf("APRES :\n");
  printf("%d - %d - %d - %d - %d - %d\n", str[0], str[1], str[2], str[3],
         str[4], str[5]);
  printf("\n\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%edx
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%ecx
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%r8d
mov    -0x18(%rbp),%rax
movsbl 0x4(%rax),%r9d
mov    -0x18(%rbp),%rax
movsbl 0x5(%rax),%eax
lea    0xe7c(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x4,%esi
call   1030 <ft_bzero@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%edx
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%ecx
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%r8d
mov    -0x18(%rbp),%rax
movsbl 0x4(%rax),%r9d
mov    -0x18(%rbp),%rax
movsbl 0x5(%rax),%eax
lea    0xe10(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf03(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rdi
call   1060 <strdup@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
movsbl (%rbx),%esi
movsbl 0x1(%rbx),%edx
movsbl 0x2(%rbx),%ecx
movsbl 0x3(%rbx),%r8d
movsbl 0x4(%rbx),%r9d
movsbl 0x5(%rbx),%eax
mov    %eax,(%rsp)
lea    0xe63(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <ft_bzero@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
movsbl (%rbx),%esi
movsbl 0x1(%rbx),%edx
movsbl 0x2(%rbx),%ecx
movsbl 0x3(%rbx),%r8d
movsbl 0x4(%rbx),%r9d
movsbl 0x5(%rbx),%eax
mov    %eax,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"-----------------------\0A\00"
@.str.1 = [25 x i8] c" bzero \0A\00"
@.str.2 = [7 x i8] c"abcdef\00"
@.str.3 = [18 x i8] c"__ STR = '%s' __\0A\00"
@.str.4 = [9 x i8] c"AVANT :\0A\00"
@.str.5 = [29 x i8] c"%d - %d - %d - %d - %d - %d\0A\00"
@.str.6 = [20 x i8] c"\0Aft_bzero(str, 4)\0A\0A\00"
@.str.7 = [9 x i8] c"APRES :\0A\00"
@.str.8 = [3 x i8] c"\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = call i8* @strdup(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = load i8*, i8** %6
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i64 4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i64 5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %17, i32 %21, i32 %25, i32 %29, i32 %33, i32 %37)
%39 = load i8*, i8** %6
%40 = call i32 @ft_bzero(i8* %39, i32 4)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%43 = load i8*, i8** %6
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = load i8*, i8** %6
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i8*, i8** %6
%52 = getelementptr inbounds i8, i8* %51, i64 2
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = load i8*, i8** %6
%56 = getelementptr inbounds i8, i8* %55, i64 3
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = load i8*, i8** %6
%60 = getelementptr inbounds i8, i8* %59, i64 4
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = load i8*, i8** %6
%64 = getelementptr inbounds i8, i8* %63, i64 5
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %46, i32 %50, i32 %54, i32 %58, i32 %62, i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"abcdef\00"
@.str.3 = [18 x i8] c"__ STR = '%s' __\0A\00"
@.str.5 = [29 x i8] c"%d - %d - %d - %d - %d - %d\0A\00"
@str.9 = [24 x i8] c" bzero \00"
@str.10 = [24 x i8] c"-----------------------\00"
@str.11 = [8 x i8] c"AVANT :\00"
@str.12 = [19 x i8] c"\0Aft_bzero(str, 4)\0A\00"
@str.13 = [8 x i8] c"APRES :\00"
@str.14 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%6 = tail call dereferenceable_or_null(7) i8* @strdup(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.11, i64 0, i64 0))
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %6, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = getelementptr inbounds i8, i8* %6, i64 3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = getelementptr inbounds i8, i8* %6, i64 4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = getelementptr inbounds i8, i8* %6, i64 5
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %10, i32 %13, i32 %16, i32 %19, i32 %22, i32 %25)
%27 = tail call i32 @ft_bzero(i8* %6, i32 4)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
%32 = load i8, i8* %11
%33 = sext i8 %32 to i32
%34 = load i8, i8* %14
%35 = sext i8 %34 to i32
%36 = load i8, i8* %17
%37 = sext i8 %36 to i32
%38 = load i8, i8* %20
%39 = sext i8 %38 to i32
%40 = load i8, i8* %23
%41 = sext i8 %40 to i32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %31, i32 %33, i32 %35, i32 %37, i32 %39, i32 %41)
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}