#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 */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ http_code_description(int);
int /*<<< orphan*/ mg_printf(struct mg_connection *, char *, int,
                             int /*<<< orphan*/, int, char *);
scalar_t__ strlen(char *);
void send_http_response(struct mg_connection *conn, int resultCode,
                        char *content) {
  mg_printf(conn,
            "HTTP/1.1 %d %s\r\n"
            "Content-Type: text/plain\r\n"
            "Content-Length: %u\r\n"
            "\r\n"
            "%s",
            resultCode, http_code_description(resultCode), (int)strlen(content),
            content);
}


x86 assembly (clang, -O0):
<send_http_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <http_code_description@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    %eax,%r8d
mov    -0x18(%rbp),%r9
lea    0xe83(%rip),%rsi
call   1030 <mg_printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_http_response>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1050 <http_code_description@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xea8(%rip),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %eax,%r8d
mov    %rbx,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <mg_printf@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [67 x i8] c"HTTP/1.1 %d %s\0D\0AContent-Type: text/plain\0D\0AContent-Length: %u\0D\0A\0D\0A%s\00"
define void @send_http_response(%struct.mg_connection* %0, i32 %1, i8* %2) {
%4 = alloca %struct.mg_connection*
%5 = alloca i32
%6 = alloca i8*
store %struct.mg_connection* %0, %struct.mg_connection** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.mg_connection*, %struct.mg_connection** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @http_code_description(i32 %9)
%11 = load i8*, i8** %6
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
%14 = load i8*, i8** %6
%15 = call i32 @mg_printf(%struct.mg_connection* %7, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %13, i8* %14)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [67 x i8] c"HTTP/1.1 %d %s\0D\0AContent-Type: text/plain\0D\0AContent-Length: %u\0D\0A\0D\0A%s\00"
define void @send_http_response(%struct.mg_connection* %0, i32 %1, i8* %2) {
%4 = tail call i32 @http_code_description(i32 %1)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%6 = trunc i64 %5 to i32
%7 = tail call i32 @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %4, i32 %6, i8* %2)
ret void
}