#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 httpd_session_data {
  int dummy;
};

/* Variables and functions */
char *httpd_get_error(struct httpd_session_data *, int *);
int /*<<< orphan*/ httpd_send(struct httpd_session_data *, int, char *, int,
                              char const *);
scalar_t__ strlen(char const *);
void httpd_send_error(struct httpd_session_data *sd, int status) {
  const char *msg = httpd_get_error(sd, &status);
  httpd_send(sd, status, "text/plain", (int)strlen(msg), msg);
}


x86 assembly (clang, -O0):
<httpd_send_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <httpd_get_error@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%ecx
mov    -0x18(%rbp),%r8
lea    0xe85(%rip),%rdx
call   1050 <httpd_send@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpd_send_error>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1040 <httpd_get_error@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%ebp
mov    %rax,%rdi
call   1030 <strlen@plt>
lea    0xea1(%rip),%rdx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%ecx
mov    %rbx,%r8
call   1050 <httpd_send@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.httpd_session_data = type { i32 }
@.str = [11 x i8] c"text/plain\00"
define void @httpd_send_error(%struct.httpd_session_data* %0, i32 %1) {
%3 = alloca %struct.httpd_session_data*
%4 = alloca i32
%5 = alloca i8*
store %struct.httpd_session_data* %0, %struct.httpd_session_data** %3
store i32 %1, i32* %4
%6 = load %struct.httpd_session_data*, %struct.httpd_session_data** %3
%7 = call i8* @httpd_get_error(%struct.httpd_session_data* %6, i32* %4)
store i8* %7, i8** %5
%8 = load %struct.httpd_session_data*, %struct.httpd_session_data** %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = trunc i64 %11 to i32
%13 = load i8*, i8** %5
%14 = call i32 @httpd_send(%struct.httpd_session_data* %8, i32 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
%struct.httpd_session_data = type { i32 }
@.str = [11 x i8] c"text/plain\00"
define void @httpd_send_error(%struct.httpd_session_data* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i8* @httpd_get_error(%struct.httpd_session_data* %0, i32* %3)
%5 = load i32, i32* %3
%6 = call i64 @strlen(i8* dereferenceable(1) %4)
%7 = trunc i64 %6 to i32
%8 = call i32 @httpd_send(%struct.httpd_session_data* %0, i32 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %4)
ret void
}