#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*/ fd_nprintf(int, int, char *, ...);
void write_header(int fd, const char *dest, const char *command, int jobid,
                  int errorlevel) {
  fd_nprintf(fd, 100, "From: Task Spooler <taskspooler>\n");
  fd_nprintf(fd, 500, "To: %s\n", dest);
  fd_nprintf(fd, 500, "Subject: the task %i finished with error %i. \n", jobid,
             errorlevel);
  fd_nprintf(fd, 500, "\nCommand: %s\n", command);
  fd_nprintf(fd, 500, "Output:\n");
}


x86 assembly (clang, -O0):
<write_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x64,%esi
lea    0xec7(%rip),%rdx
mov    $0x0,%al
call   1030 <fd_nprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rcx
mov    $0x1f4,%esi
lea    0xecf(%rip),%rdx
mov    $0x0,%al
call   1030 <fd_nprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    $0x1f4,%esi
lea    0xeba(%rip),%rdx
mov    $0x0,%al
call   1030 <fd_nprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rcx
mov    $0x1f4,%esi
lea    0xecf(%rip),%rdx
mov    $0x0,%al
call   1030 <fd_nprintf@plt>
mov    -0x4(%rbp),%edi
mov    $0x1f4,%esi
lea    0xec7(%rip),%rdx
mov    $0x0,%al
call   1030 <fd_nprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_header>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0xed3(%rip),%rdx
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <fd_nprintf@plt>
lea    0xee2(%rip),%rdx
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    %rbp,%rcx
xor    %eax,%eax
call   1030 <fd_nprintf@plt>
lea    0xed2(%rip),%rdx
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1030 <fd_nprintf@plt>
lea    0xee6(%rip),%rdx
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <fd_nprintf@plt>
lea    0xedc(%rip),%rdx
mov    %ebx,%edi
mov    $0x1f4,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fd_nprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"From: Task Spooler <taskspooler>\0A\00"
@.str.1 = [8 x i8] c"To: %s\0A\00"
@.str.2 = [47 x i8] c"Subject: the task %i finished with error %i. \0A\00"
@.str.3 = [14 x i8] c"\0ACommand: %s\0A\00"
@.str.4 = [9 x i8] c"Output:\0A\00"
define void @write_header(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 (i32, i32, i8*, ...) @fd_nprintf(i32 %11, i32 100, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = load i8*, i8** %7
%15 = call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %13, i32 500, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %6
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %16, i32 500, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %6
%21 = load i8*, i8** %8
%22 = call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %20, i32 500, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %6
%24 = call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %23, i32 500, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"From: Task Spooler <taskspooler>\0A\00"
@.str.1 = [8 x i8] c"To: %s\0A\00"
@.str.2 = [47 x i8] c"Subject: the task %i finished with error %i. \0A\00"
@.str.3 = [14 x i8] c"\0ACommand: %s\0A\00"
@.str.4 = [9 x i8] c"Output:\0A\00"
define void @write_header(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %0, i32 100, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %0, i32 500, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%8 = tail call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %0, i32 500, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
%9 = tail call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %0, i32 500, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%10 = tail call i32 (i32, i32, i8*, ...) @fd_nprintf(i32 %0, i32 500, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
ret void
}