#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 *, ...);
void bad_request(char const *charset) {
  if (!charset)
    charset = "utf-8";
  printf("Content-Type: text/html; charset = %s\n\n", charset);
  printf("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; "
         "charset=%s\"><title>%s</title></head><body><h1>%s</h1><p>",
         charset, "Bad data", "Bad data");
  printf("Your browser has sent the data in the format"
         " that this program cannot parse."
         " Please, report this to address <a href=\"mailto:%s\">%s</a>.</p>",
         "cher@unicorn.cmc.msu.ru", "cher@unicorn.cmc.msu.ru");
  printf("</p></body></html>\n");
}


x86 assembly (clang, -O0):
<bad_request>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1132 <bad_request+0x22>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xedf(%rip),%rdi
lea    0xf51(%rip),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf49(%rip),%rdi
lea    0xfce(%rip),%rdx
mov    %rdx,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad_request>:
push   %rbx
test   %rdi,%rdi
lea    0xed5(%rip),%rbx
cmovne %rdi,%rbx
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0xf59(%rip),%rcx
mov    %rbx,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf4e(%rip),%rdi
lea    0xfd3(%rip),%rdx
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfda(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [40 x i8] c"Content-Type: text/html; charset = %s\0A\0A\00"
@.str.2 = [121 x i8] c"<html><head><meta http-equiv=\22Content-Type\22 content=\22text/html; charset=%s\22><title>%s</title></head><body><h1>%s</h1><p>\00"
@.str.3 = [9 x i8] c"Bad data\00"
@.str.4 = [140 x i8] c"Your browser has sent the data in the format that this program cannot parse. Please, report this to address <a href=\22mailto:%s\22>%s</a>.</p>\00"
@.str.5 = [24 x i8] c"cher@unicorn.cmc.msu.ru\00"
@.str.6 = [20 x i8] c"</p></body></html>\0A\00"
define void @bad_request(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %6
6: ; preds = %5, %1
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [40 x i8] c"Content-Type: text/html; charset = %s\0A\0A\00"
@.str.2 = [121 x i8] c"<html><head><meta http-equiv=\22Content-Type\22 content=\22text/html; charset=%s\22><title>%s</title></head><body><h1>%s</h1><p>\00"
@.str.3 = [9 x i8] c"Bad data\00"
@.str.4 = [140 x i8] c"Your browser has sent the data in the format that this program cannot parse. Please, report this to address <a href=\22mailto:%s\22>%s</a>.</p>\00"
@.str.5 = [24 x i8] c"cher@unicorn.cmc.msu.ru\00"
@str = [19 x i8] c"</p></body></html>\00"
define void @bad_request(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([121 x i8], [121 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([140 x i8], [140 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}