#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*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void failure(char *type, int socketfd) {
  char buffer[128];
  printf(" - FAILED");
  sprintf(buffer,
          "HTTP/1.1 %s\r\nServer: nanorestfile\r\nConnection: close\r\n\r\n",
          type);
  write(socketfd, buffer, strlen(buffer));
}


x86 assembly (clang, -O0):
<failure>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xea7(%rip),%rdi
call   1050 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe9a(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failure>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
lea    0xea6(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c" - FAILED\00"
@.str.1 = [57 x i8] c"HTTP/1.1 %s\0D\0AServer: nanorestfile\0D\0AConnection: close\0D\0A\0D\0A\00"
define void @failure(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [128 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %4
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = call i32 @write(i32 %10, i8* %11, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c" - FAILED\00"
@.str.1 = [57 x i8] c"HTTP/1.1 %s\0D\0AServer: nanorestfile\0D\0AConnection: close\0D\0A\0D\0A\00"
define void @failure(i8* %0, i32 %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = call i32 @strlen(i8* %4)
%8 = call i32 @write(i32 %1, i8* %4, i32 %7)
ret void
}