#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *fo;
  unsigned char table[0x100];
  fo = fopen("../asm/file1.bin", "wb+");
  for (int i = 0; i < 0x100; i++)
    table[i] = i & 0x07 | i >> 3 & 0x18 | i << 2 & 0xe0;
  fwrite(table, 1, 0x100, fo);
  fclose(fo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x124(%rbp)
cmpl   $0x100,-0x124(%rbp)
jge    11c6 <main+0x96>
mov    -0x124(%rbp),%eax
and    $0x7,%eax
mov    -0x124(%rbp),%ecx
sar    $0x3,%ecx
and    $0x18,%ecx
or     %ecx,%eax
mov    -0x124(%rbp),%ecx
shl    $0x2,%ecx
and    $0xe0,%ecx
or     %ecx,%eax
mov    %al,%cl
movslq -0x124(%rbp),%rax
mov    %cl,-0x120(%rbp,%rax,1)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    116a <main+0x3a>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x100,%edx
call   1050 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x150,%rsp
lea    0xf61(%rip),%rdi
lea    0xf6b(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
movdqa 0xea9(%rip),%xmm8
movdqa 0xeb0(%rip),%xmm9
movdqa 0xeb7(%rip),%xmm15
movdqa 0xebe(%rip),%xmm12
xor    %eax,%eax
movdqa %xmm12,%xmm1
movdqa %xmm15,%xmm2
movdqa %xmm9,%xmm4
movdqa %xmm8,%xmm11
movdqa 0xecf(%rip),%xmm13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa %xmm4,(%rsp)
movdqa %xmm2,0x10(%rsp)
movdqa %xmm1,0x20(%rsp)
movdqa %xmm9,%xmm4
movdqa 0xe82(%rip),%xmm0
pand   %xmm0,%xmm4
movdqa %xmm8,%xmm1
pand   %xmm0,%xmm1
movdqa %xmm1,%xmm10
movdqa %xmm12,%xmm1
pand   %xmm0,%xmm1
movdqa %xmm1,%xmm3
movdqa %xmm1,0x30(%rsp)
movdqa %xmm15,%xmm1
pand   %xmm0,%xmm1
movdqa %xmm1,%xmm6
movdqa %xmm1,0x40(%rsp)
movdqa %xmm15,%xmm2
psrld  $0x3,%xmm2
movdqa %xmm12,%xmm7
psrld  $0x3,%xmm7
movdqa %xmm8,%xmm0
psrld  $0x3,%xmm0
movdqa %xmm9,%xmm1
psrld  $0x3,%xmm1
movdqa 0xe2a(%rip),%xmm5
pand   %xmm5,%xmm1
pand   %xmm5,%xmm0
pand   %xmm5,%xmm7
pand   %xmm5,%xmm2
por    %xmm6,%xmm2
por    %xmm3,%xmm7
por    %xmm10,%xmm0
movdqa %xmm10,%xmm3
por    %xmm4,%xmm1
movdqa (%rsp),%xmm6
pslld  $0x2,%xmm6
movdqa 0x20(%rsp),%xmm14
pslld  $0x2,%xmm14
movdqa 0x10(%rsp),%xmm10
pslld  $0x2,%xmm10
movdqa %xmm10,%xmm5
pand   %xmm13,%xmm5
por    %xmm2,%xmm5
movdqa %xmm14,%xmm2
pand   %xmm13,%xmm2
por    %xmm7,%xmm2
movdqa %xmm11,%xmm7
pslld  $0x2,%xmm7
packuswb %xmm5,%xmm2
movdqa %xmm7,%xmm5
pand   %xmm13,%xmm5
por    %xmm0,%xmm5
movdqa %xmm6,%xmm0
pand   %xmm13,%xmm0
por    %xmm1,%xmm0
packuswb %xmm5,%xmm0
packuswb %xmm0,%xmm2
movdqa %xmm2,0x50(%rsp,%rax,1)
movdqa 0xdb6(%rip),%xmm2
paddd  %xmm2,%xmm6
pand   %xmm13,%xmm6
por    %xmm4,%xmm6
movdqa %xmm9,%xmm0
movdqa 0xd8c(%rip),%xmm1
paddd  %xmm1,%xmm0
psrld  $0x3,%xmm0
movdqa 0xd5b(%rip),%xmm4
pand   %xmm4,%xmm0
por    %xmm0,%xmm6
paddd  %xmm2,%xmm7
pand   %xmm13,%xmm7
por    %xmm3,%xmm7
movdqa %xmm8,%xmm0
paddd  %xmm1,%xmm0
psrld  $0x3,%xmm0
pand   %xmm4,%xmm0
por    %xmm0,%xmm7
packuswb %xmm7,%xmm6
paddd  %xmm2,%xmm14
pand   %xmm13,%xmm14
por    0x30(%rsp),%xmm14
movdqa %xmm12,%xmm0
paddd  %xmm1,%xmm0
psrld  $0x3,%xmm0
pand   %xmm4,%xmm0
por    %xmm0,%xmm14
paddd  %xmm2,%xmm10
pand   %xmm13,%xmm10
por    0x40(%rsp),%xmm10
movdqa %xmm15,%xmm0
paddd  %xmm1,%xmm0
psrld  $0x3,%xmm0
pand   %xmm4,%xmm0
por    %xmm0,%xmm10
packuswb %xmm10,%xmm14
movdqa 0x10(%rsp),%xmm2
packuswb %xmm6,%xmm14
movdqa (%rsp),%xmm4
movdqa %xmm14,0x60(%rsp,%rax,1)
movdqa 0x20(%rsp),%xmm1
add    $0x20,%rax
movdqa 0xcee(%rip),%xmm0
paddd  %xmm0,%xmm12
paddd  %xmm0,%xmm15
paddd  %xmm0,%xmm9
paddd  %xmm0,%xmm8
paddd  %xmm0,%xmm1
paddd  %xmm0,%xmm2
paddd  %xmm0,%xmm4
paddd  %xmm0,%xmm11
cmp    $0x100,%rax
jne    11a0 <main+0x70>
lea    0x50(%rsp),%rdi
mov    $0x1,%esi
mov    $0x100,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"../asm/file1.bin\00"
@.str.1 = [4 x i8] c"wb+\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [256 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %6
store i32 0, i32* %8
br label %10
10: ; preds = %28, %2
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %31
13: ; preds = %10
%14 = load i32, i32* %8
%15 = and i32 %14, 7
%16 = load i32, i32* %8
%17 = ashr i32 %16, 3
%18 = and i32 %17, 24
%19 = or i32 %15, %18
%20 = load i32, i32* %8
%21 = shl i32 %20, 2
%22 = and i32 %21, 224
%23 = or i32 %19, %22
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %26
store i8 %24, i8* %27
br label %28
28: ; preds = %13
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %10
31: ; preds = %10
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i32 @fwrite(i8* %32, i32 1, i32 256, i32* %33)
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [17 x i8] c"../asm/file1.bin\00"
@.str.1 = [4 x i8] c"wb+\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %6, %2
%7 = phi i64 [ 0, %2 ], [ %33, %6 ]
%8 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %2 ], [ %34, %6 ]
%9 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %2 ], [ %35, %6 ]
%10 = and <16 x i32> %8, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
%11 = lshr <16 x i32> %8, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%12 = and <16 x i32> %11, <i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24>
%13 = or <16 x i32> %12, %10
%14 = shl <16 x i32> %9, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
%15 = and <16 x i32> %14, <i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224>
%16 = or <16 x i32> %13, %15
%17 = trunc <16 x i32> %16 to <16 x i8>
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %7
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> %17, <16 x i8>* %19
%20 = or i64 %7, 16
%21 = add <16 x i32> %8, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%22 = and <16 x i32> %8, <i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7>
%23 = lshr <16 x i32> %21, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
%24 = and <16 x i32> %23, <i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24, i32 24>
%25 = or <16 x i32> %24, %22
%26 = shl <16 x i32> %9, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
%27 = add <16 x i32> %26, <i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64>
%28 = and <16 x i32> %27, <i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224, i32 224>
%29 = or <16 x i32> %25, %28
%30 = trunc <16 x i32> %29 to <16 x i8>
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %20
%32 = bitcast i8* %31 to <16 x i8>*
store <16 x i8> %30, <16 x i8>* %32
%33 = add nuw nsw i64 %7, 32
%34 = add <16 x i32> %8, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
%35 = add <16 x i32> %9, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
%36 = icmp eq i64 %33, 256
br i1 %36, label %37, label %6
37: ; preds = %6
%38 = call i32 @fwrite(i8* %4, i32 1, i32 256, i32* %5)
%39 = tail call i32 @fclose(i32* %5)
ret i32 0
}