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

/* Variables and functions */
scalar_t__ uwsgi_response_add_header(struct wsgi_request *, char *, int, char *,
                                     int);
scalar_t__ uwsgi_response_prepare_headers(struct wsgi_request *, char *, int);
int /*<<< orphan*/ uwsgi_response_write_body_do(struct wsgi_request *, char *,
                                                int);
void uwsgi_500(struct wsgi_request *wsgi_req) {
  if (uwsgi_response_prepare_headers(wsgi_req, "500 Internal Server Error", 25))
    return;
  if (uwsgi_response_add_header(wsgi_req, (char *)"Connection", 10,
                                (char *)"close", 5))
    return;
  uwsgi_response_write_body_do(wsgi_req, "Internal Server Error", 21);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x19,%edx
call   1050 <uwsgi_response_prepare_headers@plt>
cmp    $0x0,%rax
je     1160 <uwsgi_500+0x30>
jmp    11a6 <uwsgi_500+0x76>
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0xa,%edx
lea    0xeae(%rip),%rcx
mov    $0x5,%r8d
call   1030 <uwsgi_response_add_header@plt>
cmp    $0x0,%rax
je     1191 <uwsgi_500+0x61>
jmp    11a6 <uwsgi_500+0x76>
mov    -0x8(%rbp),%rdi
lea    0xe68(%rip),%rsi
mov    $0x15,%edx
call   1040 <uwsgi_response_write_body_do@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
mov    $0x19,%edx
call   1050 <uwsgi_response_prepare_headers@plt>
test   %rax,%rax
jne    1170 <uwsgi_500+0x40>
lea    0xec9(%rip),%rsi
lea    0xecd(%rip),%rcx
mov    %rbx,%rdi
mov    $0xa,%edx
mov    $0x5,%r8d
call   1030 <uwsgi_response_add_header@plt>
test   %rax,%rax
je     1172 <uwsgi_500+0x42>
pop    %rbx
ret
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x15,%edx
pop    %rbx
jmp    1040 <uwsgi_response_write_body_do@plt>

LLVM IR (-O0):
%struct.wsgi_request = type { i32 }
@.str = [26 x i8] c"500 Internal Server Error\00"
@.str.1 = [11 x i8] c"Connection\00"
@.str.2 = [6 x i8] c"close\00"
@.str.3 = [22 x i8] c"Internal Server Error\00"
define void @uwsgi_500(%struct.wsgi_request* %0) {
%2 = alloca %struct.wsgi_request*
store %struct.wsgi_request* %0, %struct.wsgi_request** %2
%3 = load %struct.wsgi_request*, %struct.wsgi_request** %2
%4 = call i64 @uwsgi_response_prepare_headers(%struct.wsgi_request* %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 25)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %15
7: ; preds = %1
%8 = load %struct.wsgi_request*, %struct.wsgi_request** %2
%9 = call i64 @uwsgi_response_add_header(%struct.wsgi_request* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %15
12: ; preds = %7
%13 = load %struct.wsgi_request*, %struct.wsgi_request** %2
%14 = call i32 @uwsgi_response_write_body_do(%struct.wsgi_request* %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 21)
br label %15
15: ; preds = %12, %11, %6
ret void
}

LLVM IR (-O2):
%struct.wsgi_request = type { i32 }
@.str = [26 x i8] c"500 Internal Server Error\00"
@.str.1 = [11 x i8] c"Connection\00"
@.str.2 = [6 x i8] c"close\00"
@.str.3 = [22 x i8] c"Internal Server Error\00"
define void @uwsgi_500(%struct.wsgi_request* %0) {
%2 = tail call i64 @uwsgi_response_prepare_headers(%struct.wsgi_request* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 25)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i64 @uwsgi_response_add_header(%struct.wsgi_request* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @uwsgi_response_write_body_do(%struct.wsgi_request* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 21)
br label %9
9: ; preds = %4, %1, %7
ret void
}