#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*/ bzero(char *, size_t);
int /*<<< orphan*/ memcpy(char *, char *, size_t);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void internal_error(char *buf, size_t buflen) {
  char buffer[buflen];
  bzero(buffer, buflen);
  strncpy(buffer, "HTTP/1.1 500 Internal Server Error\r\n", 36);
  strncat(buffer, "Content-type: text/html\n\n", 25);
  strncat(buffer, "<html>\n", 7);
  strncat(buffer, " <body>\n", 8);
  strncat(buffer, "  <h1>500 Internal Server Error</h1>\n", 37);
  strncat(buffer,
          "  <p>The proxy server had an error and the connection was "
          "aborted.</p>\n",
          71);
  strncat(buffer, " <body>\n", 8);
  strncat(buffer, "<html>\n", 7);
  strncat(buffer, "\r\n", 2);
  strncat(buffer, "\r\n", 2);
  memcpy(buf, buffer, buflen);
}


x86 assembly (clang, -O0):
<internal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
call   1060 <bzero@plt>
mov    -0x28(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x24,%edx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rdi
lea    0xe85(%rip),%rsi
mov    $0x19,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x25,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x47,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe21(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xdef(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rdi
lea    0xdda(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncat@plt>
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_error>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%rbx
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1060 <bzero@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x24,%edx
call   1030 <strncpy@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x19,%edx
call   1040 <strncat@plt>
lea    0xea3(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
call   1040 <strncat@plt>
lea    0xe94(%rip),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
mov    $0x25,%edx
call   1040 <strncat@plt>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
mov    $0x47,%edx
call   1040 <strncat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x8,%edx
call   1040 <strncat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
call   1040 <strncat@plt>
lea    0xe10(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
call   1040 <strncat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
call   1040 <strncat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"HTTP/1.1 500 Internal Server Error\0D\0A\00"
@.str.1 = [26 x i8] c"Content-type: text/html\0A\0A\00"
@.str.2 = [8 x i8] c"<html>\0A\00"
@.str.3 = [9 x i8] c" <body>\0A\00"
@.str.4 = [38 x i8] c" <h1>500 Internal Server Error</h1>\0A\00"
@.str.5 = [72 x i8] c" <p>The proxy server had an error and the connection was aborted.</p>\0A\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
define void @internal_error(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %5
%9 = alloca i8, i64 %7
store i64 %7, i64* %6
%10 = load i64, i64* %4
%11 = call i32 @bzero(i8* %9, i64 %10)
%12 = call i32 @strncpy(i8* %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 36)
%13 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 25)
%14 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%15 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%16 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 37)
%17 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), i32 71)
%18 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%19 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%20 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%21 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%22 = load i8*, i8** %3
%23 = load i64, i64* %4
%24 = call i32 @memcpy(i8* %22, i8* %9, i64 %23)
%25 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"HTTP/1.1 500 Internal Server Error\0D\0A\00"
@.str.1 = [26 x i8] c"Content-type: text/html\0A\0A\00"
@.str.2 = [8 x i8] c"<html>\0A\00"
@.str.3 = [9 x i8] c" <body>\0A\00"
@.str.4 = [38 x i8] c" <h1>500 Internal Server Error</h1>\0A\00"
@.str.5 = [72 x i8] c" <p>The proxy server had an error and the connection was aborted.</p>\0A\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
define void @internal_error(i8* %0, i64 %1) {
%3 = alloca i8, i64 %1
%4 = call i32 @bzero(i8* %3, i64 %1)
%5 = call i32 @strncpy(i8* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 36)
%6 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 25)
%7 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%8 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%9 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 37)
%10 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), i32 71)
%11 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%12 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%13 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%14 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%15 = call i32 @memcpy(i8* %0, i8* %3, i64 %1)
ret void
}