#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*/ sendError(int, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlcpy(char *, char *);
void sendGenError(int clientsd) {
  char title[30], content[128];
  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    -0x30(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strlcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strlcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1040 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1050 <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    0xebc(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strlcpy@plt>
lea    0xec5(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlcpy@plt>
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <sendError@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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