#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*/ blank_column;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t const, char *, double const);
size_t strlen(char *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t const);
size_t fillin_text_column(const double val, char data[], const size_t sz_data,
                          const int is_monitored, const int is_column_present) {
  const char blank_column[] = "            ";
  size_t offset = 0;
  if (sz_data <= sizeof(blank_column))
    return 0;
  if (is_monitored) {
    snprintf(data, sz_data - 1, " %11.1f", val);
    offset = strlen(data);
  } else if (is_column_present) {
    strncpy(data, blank_column, sz_data - 1);
    offset = strlen(data);
  }
  return offset;
}


x86 assembly (clang, -O0):
<fillin_text_column>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %ecx,-0x28(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x35(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x2d(%rbp)
mov    0xea7(%rip),%al
mov    %al,-0x29(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0xd,-0x20(%rbp)
ja     1188 <fillin_text_column+0x58>
movq   $0x0,-0x8(%rbp)
jmp    11fa <fillin_text_column+0xca>
cmpl   $0x0,-0x24(%rbp)
je     11c1 <fillin_text_column+0x91>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
sub    $0x1,%rsi
movsd  -0x10(%rbp),%xmm0
lea    0xe63(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x40(%rbp)
jmp    11f2 <fillin_text_column+0xc2>
cmpl   $0x0,-0x28(%rbp)
je     11ed <fillin_text_column+0xbd>
mov    -0x18(%rbp),%rdi
lea    -0x35(%rbp),%rsi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x40(%rbp)
jmp    11f2 <fillin_text_column+0xc2>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillin_text_column>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
movabs $0x20202020202020,%rsi
mov    %rsi,0x5(%rsp)
movabs $0x2020202020202020,%rsi
20 20 20
mov    %rsi,(%rsp)
cmp    $0xe,%rax
jae    1163 <fillin_text_column+0x33>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %rdi,%rbx
test   %edx,%edx
je     118d <fillin_text_column+0x5d>
add    $0xffffffffffffffff,%rax
lea    0xe98(%rip),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <snprintf@plt>
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <strlen@plt>
test   %ecx,%ecx
je     115b <fillin_text_column+0x2b>
add    $0xffffffffffffffff,%rax
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
jmp    115d <fillin_text_column+0x2d>

LLVM IR (-O0):
@__const.fillin_text_column.blank_column = [13 x i8] c" \00"
@.str = [8 x i8] c" %11.1f\00"
define i64 @fillin_text_column(double %0, i8* %1, i64 %2, i32 %3, i32 %4) {
%6 = alloca i64
%7 = alloca double
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca [13 x i8]
%13 = alloca i64
store double %0, double* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%14 = bitcast [13 x i8]* %12 to i8*
store i64 0, i64* %13
%15 = load i64, i64* %9
%16 = icmp ule i64 %15, 13
br i1 %16, label %17, label %18
17: ; preds = %5
store i64 0, i64* %6
br label %43
18: ; preds = %5
%19 = load i32, i32* %10
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i8*, i8** %8
%23 = load i64, i64* %9
%24 = sub i64 %23, 1
%25 = load double, double* %7
%26 = call i32 @snprintf(i8* %22, i64 %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %25)
%27 = load i8*, i8** %8
%28 = call i64 @strlen(i8* %27)
store i64 %28, i64* %13
br label %41
29: ; preds = %18
%30 = load i32, i32* %11
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = load i8*, i8** %8
%34 = getelementptr inbounds [13 x i8], [13 x i8]* %12, i64 0, i64 0
%35 = load i64, i64* %9
%36 = sub i64 %35, 1
%37 = call i32 @strncpy(i8* %33, i8* %34, i64 %36)
%38 = load i8*, i8** %8
%39 = call i64 @strlen(i8* %38)
store i64 %39, i64* %13
br label %40
40: ; preds = %32, %29
br label %41
41: ; preds = %40, %21
%42 = load i64, i64* %13
store i64 %42, i64* %6
br label %43
43: ; preds = %41, %17
%44 = load i64, i64* %6
ret i64 %44
}

LLVM IR (-O2):
@__const.fillin_text_column.blank_column = [13 x i8] c" \00"
@.str = [8 x i8] c" %11.1f\00"
define i64 @fillin_text_column(double %0, i8* %1, i64 %2, i32 %3, i32 %4) {
%6 = alloca [13 x i8]
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%8 = icmp ult i64 %2, 14
br i1 %8, label %21, label %9
9: ; preds = %5
%10 = icmp eq i32 %3, 0
br i1 %10, label %15, label %11
11: ; preds = %9
%12 = add i64 %2, -1
%13 = tail call i32 @snprintf(i8* %1, i64 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %0)
%14 = tail call i64 @strlen(i8* dereferenceable(1) %1)
br label %21
15: ; preds = %9
%16 = icmp eq i32 %4, 0
br i1 %16, label %21, label %17
17: ; preds = %15
%18 = add i64 %2, -1
%19 = call i32 @strncpy(i8* %1, i8* %7, i64 %18)
%20 = call i64 @strlen(i8* dereferenceable(1) %1)
br label %21
21: ; preds = %11, %17, %15, %5
%22 = phi i64 [ 0, %5 ], [ %14, %11 ], [ %20, %17 ], [ 0, %15 ]
ret i64 %22
}