#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*/ sendError(int, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlcpy(char *, char *);
void sendGenError(int clientsd) {
  char title[30], content[128];
  printf("Generic Error\n");
  strlcpy(title, "500 Internal Server Error\n");
  strlcpy(content, "<html><body>\n");
  strcat(content, "<h2>Oops. That didn't work.</h2>\n");
  strcat(content, "Something bad happened.\n");
  strcat(content, "</body></html>\n");
  sendError(clientsd, title, content);
}


x86 assembly (clang, -O0):
<sendGenError>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <strlcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <strlcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1050 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1050 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1060 <sendError@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendGenError>:
push   %rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %edi,%ebp
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlcpy@plt>
lea    0xea9(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlcpy@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <sendError@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Generic Error\0A\00"
@.str.1 = [27 x i8] c"500 Internal Server Error\0A\00"
@.str.2 = [14 x i8] c"<html><body>\0A\00"
@.str.3 = [34 x i8] c"<h2>Oops. That didn't work.</h2>\0A\00"
@.str.4 = [25 x i8] c"Something bad happened.\0A\00"
@.str.5 = [16 x i8] c"</body></html>\0A\00"
define void @sendGenError(i32 %0) {
%2 = alloca i32
%3 = alloca [30 x i8]
%4 = alloca [128 x i8]
store i32 %0, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlcpy(i8* %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%9 = call i32 @strlcpy(i8* %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%19 = call i32 @sendError(i32 %16, i8* %17, i8* %18)
ret void
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"500 Internal Server Error\0A\00"
@.str.2 = [14 x i8] c"<html><body>\0A\00"
@.str.3 = [34 x i8] c"<h2>Oops. That didn't work.</h2>\0A\00"
@.str.4 = [25 x i8] c"Something bad happened.\0A\00"
@.str.5 = [16 x i8] c"</body></html>\0A\00"
@str = [14 x i8] c"Generic Error\00"
define void @sendGenError(i32 %0) {
%2 = alloca [30 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%7 = call i32 @strlcpy(i8* %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @strlcpy(i8* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @sendError(i32 %0, i8* %4, i8* %5)
ret void
}