#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ element_carrot_replace(char *);
char *format_initial_capital(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void element_drop_down_text_item_output(FILE *output_file, char *element_name,
                                        char *data, int row,
                                        char *background_color) {
  char format_buffer[512];
  if (!data)
    data = "";
  fprintf(output_file, "<td>");
  fprintf(output_file, "<input type=text value=\"%s\" readonly=1",
          format_initial_capital(format_buffer, element_carrot_replace(data)));
  if (background_color && *background_color) {
    fprintf(output_file, " style=\"{background:%s}\"", background_color);
  }
  fprintf(output_file, "></td>\n");
  fprintf(output_file, "<input name=\"%s_%d\" type=hidden value=\"%s\">\n",
          element_name, row, data);
}


x86 assembly (clang, -O0):
<element_drop_down_text_item_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <element_drop_down_text_item_output+0x34>
lea    0xf19(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0x230(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <element_carrot_replace@plt>
mov    -0x240(%rbp),%rdi
mov    %eax,%esi
call   1030 <format_initial_capital@plt>
mov    -0x238(%rbp),%rdi
mov    %rax,%rdx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x28(%rbp)
je     11ef <element_drop_down_text_item_output+0xbf>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ef <element_drop_down_text_item_output+0xbf>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_drop_down_text_item_output>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %r8,%r12
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
test   %rdx,%rdx
lea    0xf14(%rip),%rbp
cmovne %rdx,%rbp
lea    0xe90(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbp,%rdi
call   1050 <element_carrot_replace@plt>
mov    %rsp,%rdi
mov    %eax,%esi
call   1030 <format_initial_capital@plt>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r12,%r12
je     11c8 <element_drop_down_text_item_output+0x88>
cmpb   $0x0,(%r12)
je     11c8 <element_drop_down_text_item_output+0x88>
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe76(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %rbp,%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"<td>\00"
@.str.2 = [39 x i8] c"<input type=text value=\22%s\22=1\00"
@.str.3 = [25 x i8] c" style=\22{background:%s}\22\00"
@.str.4 = [8 x i8] c"></td>\0A\00"
@.str.5 = [45 x i8] c"<input name=\22%s_%d\22 type=hidden value=\22%s\22>\0A\00"
define void @element_drop_down_text_item_output(i32* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [512 x i8]
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %15, label %14
14: ; preds = %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
br label %15
15: ; preds = %14, %5
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32*, i32** %6
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%20 = load i8*, i8** %8
%21 = call i32 @element_carrot_replace(i8* %20)
%22 = call i8* @format_initial_capital(i8* %19, i32 %21)
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %10
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %35
26: ; preds = %15
%27 = load i8*, i8** %10
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = load i32*, i32** %6
%33 = load i8*, i8** %10
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %31, %26, %15
%36 = load i32*, i32** %6
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32*, i32** %6
%39 = load i8*, i8** %7
%40 = load i32, i32* %9
%41 = load i8*, i8** %8
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %39, i32 %40, i8* %41)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"<td>\00"
@.str.2 = [39 x i8] c"<input type=text value=\22%s\22=1\00"
@.str.3 = [25 x i8] c" style=\22{background:%s}\22\00"
@.str.4 = [8 x i8] c"></td>\0A\00"
@.str.5 = [45 x i8] c"<input name=\22%s_%d\22 type=hidden value=\22%s\22>\0A\00"
define void @element_drop_down_text_item_output(i32* nocapture %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%8 = icmp eq i8* %2, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4, i64 1, i32* %0)
%11 = tail call i32 @element_carrot_replace(i8* %9)
%12 = call i8* @format_initial_capital(i8* %7, i32 %11)
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = icmp eq i8* %4, null
br i1 %14, label %20, label %15
15: ; preds = %5
%16 = load i8, i8* %4
%17 = icmp eq i8 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %4)
br label %20
20: ; preds = %18, %15, %5
%21 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i64 7, i64 1, i32* %0)
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %1, i32 %3, i8* %9)
ret void
}