#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void element_upload_filename_output(FILE *output_file, int attribute_width,
                                    int row, char *name) {
  int size;
  int maxlength = attribute_width;
  if (maxlength > 30)
    size = 30;
  else
    size = maxlength;
  if (row == -1) {
    fprintf(output_file, "<td><input name=\"%s\"", name);
  } else {
    fprintf(output_file, "<td><input name=\"%s_%d\"", name, row);
  }
  fprintf(output_file, " type=\"file\" size=\"%d\"", size);
  fprintf(output_file, " accept=\"*\"");
  fprintf(output_file, " maxlength=\"%d\"", maxlength);
  fprintf(output_file, "></td>\n");
}


x86 assembly (clang, -O0):
<element_upload_filename_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1e,-0x20(%rbp)
jle    1142 <element_upload_filename_output+0x32>
movl   $0x1e,-0x1c(%rbp)
jmp    1148 <element_upload_filename_output+0x38>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    116d <element_upload_filename_output+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1186 <element_upload_filename_output+0x76>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%ecx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_upload_filename_output>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    $0xffffffff,%edx
je     1147 <element_upload_filename_output+0x27>
mov    %edx,%eax
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
mov    %rcx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    115b <element_upload_filename_output+0x3b>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x1e,%ebp
mov    $0x1e,%edx
cmovl  %ebp,%edx
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xec6(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"<td><input name=\22%s\22\00"
@.str.1 = [24 x i8] c"<td><input name=\22%s_%d\22\00"
@.str.2 = [23 x i8] c" type=\22file\22 size=\22%d\22\00"
@.str.3 = [12 x i8] c" accept=\22*\22\00"
@.str.4 = [16 x i8] c" maxlength=\22%d\22\00"
@.str.5 = [8 x i8] c"></td>\0A\00"
define void @element_upload_filename_output(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%11 = load i32, i32* %6
store i32 %11, i32* %10
%12 = load i32, i32* %10
%13 = icmp sgt i32 %12, 30
br i1 %13, label %14, label %15
14: ; preds = %4
store i32 30, i32* %9
br label %17
15: ; preds = %4
%16 = load i32, i32* %10
store i32 %16, i32* %9
br label %17
17: ; preds = %15, %14
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32*, i32** %5
%22 = load i8*, i8** %8
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %29
24: ; preds = %17
%25 = load i32*, i32** %5
%26 = load i8*, i8** %8
%27 = load i32, i32* %7
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %27)
br label %29
29: ; preds = %24, %20
%30 = load i32*, i32** %5
%31 = load i32, i32* %9
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = load i32*, i32** %5
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32*, i32** %5
%36 = load i32, i32* %10
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32*, i32** %5
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"<td><input name=\22%s\22\00"
@.str.1 = [24 x i8] c"<td><input name=\22%s_%d\22\00"
@.str.2 = [23 x i8] c" type=\22file\22 size=\22%d\22\00"
@.str.3 = [12 x i8] c" accept=\22*\22\00"
@.str.4 = [16 x i8] c" maxlength=\22%d\22\00"
@.str.5 = [8 x i8] c"></td>\0A\00"
define void @element_upload_filename_output(i32* nocapture %0, i32 %1, i32 %2, i8* %3) {
%5 = icmp eq i32 %2, -1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %10
8: ; preds = %4
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %2)
br label %10
10: ; preds = %8, %6
%11 = icmp slt i32 %1, 30
%12 = select i1 %11, i32 %1, i32 30
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %0)
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 7, i64 1, i32* %0)
ret void
}