#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*/ PutNum(long, int, int, int);
int /*<<< orphan*/ write(int, char *, int);
void WriteAifc(int f, long bytes) {
  long size = bytes + 86;
  long frames = bytes / 4;
  write(f, "FORM", 4);
  PutNum(size - 8, f, 1, 4);
  write(f, "AIFC", 4);
  write(f, "FVER", 4);
  PutNum(4, f, 1, 4);
  PutNum(2726318400UL, f, 1, 4);
  write(f, "COMM", 4);
  PutNum(38, f, 1, 4);
  PutNum(2, f, 1, 2);
  PutNum(frames, f, 1, 4);
  PutNum(16, f, 1, 2);
  write(f, "@\016\254D\0\0\0\0\0\0", 10);
  write(f, "NONE", 4);
  PutNum(14, f, 1, 1);
  write(f, "not compressed", 14);
  PutNum(0, f, 1, 1);
  write(f, "SSND", 4);
  PutNum(bytes + 8, f, 1, 4);
  PutNum(0, f, 1, 4);
  PutNum(0, f, 1, 4);
}


x86 assembly (clang, -O0):
<WriteAifc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x56,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    0xea9(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x18(%rbp),%rdi
sub    $0x8,%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%edi
lea    0xe80(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
lea    0xe71(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%esi
mov    $0xa2805140,%edi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%edi
lea    0xe34(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%esi
mov    $0x26,%edi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1040 <PutNum@plt>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%esi
mov    $0x10,%edi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%edi
lea    0xde3(%rip),%rsi
mov    $0xa,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
lea    0xdb6(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%esi
mov    $0xe,%edi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%edi
lea    0xd93(%rip),%rsi
mov    $0xe,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%edi
lea    0xd7b(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteAifc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
lea    0x3(%rsi),%r15
test   %rsi,%rsi
cmovns %rsi,%r15
sar    $0x2,%r15
lea    0xec0(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
lea    0x4e(%r14),%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
lea    0xe9f(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
lea    0xe91(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    $0x4,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    $0xa2805140,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
lea    0xe57(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    $0x26,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    $0x2,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1040 <PutNum@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
mov    $0x10,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1040 <PutNum@plt>
lea    0xe0c(%rip),%rsi
mov    %ebx,%edi
mov    $0xa,%edx
call   1030 <write@plt>
lea    0xde0(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    $0xe,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1040 <PutNum@plt>
lea    0xdbc(%rip),%rsi
mov    %ebx,%edi
mov    $0xe,%edx
call   1030 <write@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1040 <PutNum@plt>
lea    0xda5(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x8,%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
call   1040 <PutNum@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <PutNum@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"FORM\00"
@.str.1 = [5 x i8] c"AIFC\00"
@.str.2 = [5 x i8] c"FVER\00"
@.str.3 = [5 x i8] c"COMM\00"
@.str.4 = [11 x i8] c"@\0E\ACD\00\00\00\00\00\00\00"
@.str.5 = [5 x i8] c"NONE\00"
@.str.6 = [15 x i8] c"not compressed\00"
@.str.7 = [5 x i8] c"SSND\00"
define void @WriteAifc(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = add nsw i64 %7, 86
store i64 %8, i64* %5
%9 = load i64, i64* %4
%10 = sdiv i64 %9, 4
store i64 %10, i64* %6
%11 = load i32, i32* %3
%12 = call i32 @write(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = load i64, i64* %5
%14 = sub nsw i64 %13, 8
%15 = load i32, i32* %3
%16 = call i32 @PutNum(i64 %14, i32 %15, i32 1, i32 4)
%17 = load i32, i32* %3
%18 = call i32 @write(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%19 = load i32, i32* %3
%20 = call i32 @write(i32 %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%21 = load i32, i32* %3
%22 = call i32 @PutNum(i64 4, i32 %21, i32 1, i32 4)
%23 = load i32, i32* %3
%24 = call i32 @PutNum(i64 2726318400, i32 %23, i32 1, i32 4)
%25 = load i32, i32* %3
%26 = call i32 @write(i32 %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%27 = load i32, i32* %3
%28 = call i32 @PutNum(i64 38, i32 %27, i32 1, i32 4)
%29 = load i32, i32* %3
%30 = call i32 @PutNum(i64 2, i32 %29, i32 1, i32 2)
%31 = load i64, i64* %6
%32 = load i32, i32* %3
%33 = call i32 @PutNum(i64 %31, i32 %32, i32 1, i32 4)
%34 = load i32, i32* %3
%35 = call i32 @PutNum(i64 16, i32 %34, i32 1, i32 2)
%36 = load i32, i32* %3
%37 = call i32 @write(i32 %36, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 10)
%38 = load i32, i32* %3
%39 = call i32 @write(i32 %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%40 = load i32, i32* %3
%41 = call i32 @PutNum(i64 14, i32 %40, i32 1, i32 1)
%42 = load i32, i32* %3
%43 = call i32 @write(i32 %42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 14)
%44 = load i32, i32* %3
%45 = call i32 @PutNum(i64 0, i32 %44, i32 1, i32 1)
%46 = load i32, i32* %3
%47 = call i32 @write(i32 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%48 = load i64, i64* %4
%49 = add nsw i64 %48, 8
%50 = load i32, i32* %3
%51 = call i32 @PutNum(i64 %49, i32 %50, i32 1, i32 4)
%52 = load i32, i32* %3
%53 = call i32 @PutNum(i64 0, i32 %52, i32 1, i32 4)
%54 = load i32, i32* %3
%55 = call i32 @PutNum(i64 0, i32 %54, i32 1, i32 4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"FORM\00"
@.str.1 = [5 x i8] c"AIFC\00"
@.str.2 = [5 x i8] c"FVER\00"
@.str.3 = [5 x i8] c"COMM\00"
@.str.4 = [11 x i8] c"@\0E\ACD\00\00\00\00\00\00\00"
@.str.5 = [5 x i8] c"NONE\00"
@.str.6 = [15 x i8] c"not compressed\00"
@.str.7 = [5 x i8] c"SSND\00"
define void @WriteAifc(i32 %0, i64 %1) {
%3 = sdiv i64 %1, 4
%4 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = add nsw i64 %1, 78
%6 = tail call i32 @PutNum(i64 %5, i32 %0, i32 1, i32 4)
%7 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%8 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%9 = tail call i32 @PutNum(i64 4, i32 %0, i32 1, i32 4)
%10 = tail call i32 @PutNum(i64 2726318400, i32 %0, i32 1, i32 4)
%11 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%12 = tail call i32 @PutNum(i64 38, i32 %0, i32 1, i32 4)
%13 = tail call i32 @PutNum(i64 2, i32 %0, i32 1, i32 2)
%14 = tail call i32 @PutNum(i64 %3, i32 %0, i32 1, i32 4)
%15 = tail call i32 @PutNum(i64 16, i32 %0, i32 1, i32 2)
%16 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 10)
%17 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4)
%18 = tail call i32 @PutNum(i64 14, i32 %0, i32 1, i32 1)
%19 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 14)
%20 = tail call i32 @PutNum(i64 0, i32 %0, i32 1, i32 1)
%21 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%22 = add nsw i64 %1, 8
%23 = tail call i32 @PutNum(i64 %22, i32 %0, i32 1, i32 4)
%24 = tail call i32 @PutNum(i64 0, i32 %0, i32 1, i32 4)
%25 = tail call i32 @PutNum(i64 0, i32 %0, i32 1, i32 4)
ret void
}