#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*/ close(int);
int /*<<< orphan*/ explicit_bzero(char *, int);
int /*<<< orphan*/ write(int, char *, int);
void doit(int fd) {
  char buf[100];
  int i;
  for (i = 0; i < 100; ++i)
    buf[i] = i;
  write(fd, buf, 100);
  close(fd);
  explicit_bzero(buf, 100);
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    116a <doit+0x3a>
mov    -0x74(%rbp),%eax
mov    %al,%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1145 <doit+0x15>
mov    -0x4(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1050 <explicit_bzero@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %edi,%ebx
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movl   $0x63626160,0x60(%rsp)
63
mov    %rsp,%r14
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <write@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %r14,%rdi
mov    $0x64,%esi
call   1050 <explicit_bzero@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @doit(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
br label %5
5: ; preds = %14, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %4
%10 = trunc i32 %9 to i8
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %12
store i8 %10, i8* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %5
17: ; preds = %5
%18 = load i32, i32* %2
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%20 = call i32 @write(i32 %18, i8* %19, i32 100)
%21 = load i32, i32* %2
%22 = call i32 @close(i32 %21)
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%24 = call i32 @explicit_bzero(i8* %23, i32 100)
ret void
}

LLVM IR (-O2):
define void @doit(i32 %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = bitcast [100 x i8]* %2 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 16
%6 = bitcast i8* %5 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 32
%8 = bitcast i8* %7 to <16 x i8>*
store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, <16 x i8>* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 48
%10 = bitcast i8* %9 to <16 x i8>*
store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, <16 x i8>* %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 64
%12 = bitcast i8* %11 to <16 x i8>*
store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, <16 x i8>* %12
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 80
%14 = bitcast i8* %13 to <16 x i8>*
store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, <16 x i8>* %14
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 96
store i8 96, i8* %15
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 97
store i8 97, i8* %16
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 98
store i8 98, i8* %17
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 99
store i8 99, i8* %18
%19 = call i32 @write(i32 %0, i8* %3, i32 100)
%20 = tail call i32 @close(i32 %0)
%21 = call i32 @explicit_bzero(i8* %3, i32 100)
ret void
}