#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 *, ...);
int strlen(char *);
void printHtmlField(char *buf, int width) {
  int ii;
  int leadingSpaces = 1;
  if (width < 0) {
    width = -width;
    leadingSpaces = 0;
  }
  int len = strlen(buf);
  int numSpaces = width - len;
  if (numSpaces <= 0) {
    printf("%s", buf);
    return;
  }
  if (leadingSpaces == 0)
    printf("%s", buf);
  for (ii = 0; ii < numSpaces; ++ii)
    printf("&nbsp;");
  if (leadingSpaces == 1)
    printf("%s", buf);
}


x86 assembly (clang, -O0):
<printHtmlField>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114f <printHtmlField+0x2f>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     1185 <printHtmlField+0x65>
mov    -0x8(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ec <printHtmlField+0xcc>
cmpl   $0x0,-0x14(%rbp)
jne    11a1 <printHtmlField+0x81>
mov    -0x8(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d0 <printHtmlField+0xb0>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a8 <printHtmlField+0x88>
cmpl   $0x1,-0x14(%rbp)
jne    11ec <printHtmlField+0xcc>
mov    -0x8(%rbp),%rsi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHtmlField>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%ebp
neg    %ebp
cmovs  %esi,%ebp
call   1030 <strlen@plt>
sub    %eax,%ebp
test   %ebp,%ebp
jle    1174 <printHtmlField+0x54>
test   %r15d,%r15d
jns    1155 <printHtmlField+0x35>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea7(%rip),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1160 <printHtmlField+0x40>
test   %r15d,%r15d
js     118f <printHtmlField+0x6f>
lea    0xe85(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"&nbsp;\00"
define void @printHtmlField(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 1, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sub nsw i32 0, %12
store i32 %13, i32* %4
store i32 0, i32* %6
br label %14
14: ; preds = %11, %2
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %4
%18 = load i32, i32* %7
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i8*, i8** %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %47
25: ; preds = %14
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i8*, i8** %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %25
store i32 0, i32* %5
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %5
%34 = load i32, i32* %8
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %32
41: ; preds = %32
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i8*, i8** %3
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %22, %44, %41
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"&nbsp;\00"
define void @printHtmlField(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = sub nsw i32 0, %1
%5 = select i1 %3, i32 %4, i32 %1
%6 = tail call i32 @strlen(i8* %0)
%7 = sub i32 %5, %6
%8 = icmp slt i32 %7, 1
br i1 %8, label %19, label %9
9: ; preds = %2
br i1 %3, label %10, label %12
10: ; preds = %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %9, %10
br label %13
13: ; preds = %12, %13
%14 = phi i32 [ %16, %13 ], [ 0, %12 ]
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %7
br i1 %17, label %18, label %13
18: ; preds = %13
br i1 %3, label %21, label %19
19: ; preds = %18, %2
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %21
21: ; preds = %19, %18
ret void
}