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

/* Variables and functions */
int /*<<< orphan*/ fat_string(int /*<<< orphan*/ *, char const *, int);
int /*<<< orphan*/ fat_uint16(int /*<<< orphan*/ *, unsigned int);
int /*<<< orphan*/ fat_uint32(int /*<<< orphan*/ *, unsigned int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void fat_plain_file(uint8_t *dest, const char *name, const char *ext,
                    unsigned first_cluster, unsigned filesize) {
  memset(dest, 0, 0x20);
  fat_string(dest, name, 8);
  fat_string(dest + 0x08, ext, 3);
  fat_uint16(dest + 0x1a, first_cluster);
  fat_uint32(dest + 0x1c, filesize);
}


x86 assembly (clang, -O0):
<fat_plain_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <fat_string@plt>
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
mov    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1040 <fat_string@plt>
mov    -0x8(%rbp),%rdi
add    $0x68,%rdi
mov    -0x1c(%rbp),%esi
call   1060 <fat_uint16@plt>
mov    -0x8(%rbp),%rdi
add    $0x70,%rdi
mov    -0x20(%rbp),%esi
call   1050 <fat_uint32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fat_plain_file>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x8,%edx
call   1040 <fat_string@plt>
lea    0x20(%rbx),%rdi
mov    %r12,%rsi
mov    $0x3,%edx
call   1040 <fat_string@plt>
lea    0x68(%rbx),%rdi
mov    %r15d,%esi
call   1060 <fat_uint16@plt>
add    $0x70,%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fat_uint32@plt>

LLVM IR (-O0):
define void @fat_plain_file(i32* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = call i32 @memset(i32* %11, i32 0, i32 32)
%13 = load i32*, i32** %6
%14 = load i8*, i8** %7
%15 = call i32 @fat_string(i32* %13, i8* %14, i32 8)
%16 = load i32*, i32** %6
%17 = getelementptr inbounds i32, i32* %16, i64 8
%18 = load i8*, i8** %8
%19 = call i32 @fat_string(i32* %17, i8* %18, i32 3)
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 26
%22 = load i32, i32* %9
%23 = call i32 @fat_uint16(i32* %21, i32 %22)
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 28
%26 = load i32, i32* %10
%27 = call i32 @fat_uint32(i32* %25, i32 %26)
ret void
}

LLVM IR (-O2):
define void @fat_plain_file(i32* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @memset(i32* %0, i32 0, i32 32)
%7 = tail call i32 @fat_string(i32* %0, i8* %1, i32 8)
%8 = getelementptr inbounds i32, i32* %0, i64 8
%9 = tail call i32 @fat_string(i32* %8, i8* %2, i32 3)
%10 = getelementptr inbounds i32, i32* %0, i64 26
%11 = tail call i32 @fat_uint16(i32* %10, i32 %3)
%12 = getelementptr inbounds i32, i32* %0, i64 28
%13 = tail call i32 @fat_uint32(i32* %12, i32 %4)
ret void
}