#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 *, ...);
int strlen(char *);
void op_binarize_short(char *name, int nameWidth, FILE *f, char *indent) {
  int nameFill = nameWidth - 2 - strlen(name);
  if (indent == NULL)
    indent = "";
  if (nameFill > 0)
    fprintf(f, "%s%s:%*s", indent, name, nameFill + 1, " ");
  else
    fprintf(f, "%s%s: ", indent, name);
  fprintf(f, "apply a threshold filter\n");
}


x86 assembly (clang, -O0):
<op_binarize_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1169 <op_binarize_short+0x49>
lea    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11a1 <op_binarize_short+0x81>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x24(%rbp),%r8d
add    $0x1,%r8d
lea    0xe72(%rip),%rsi
lea    0xe79(%rip),%r9
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11bb <op_binarize_short+0x9b>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_binarize_short>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
call   1030 <strlen@plt>
sub    %eax,%ebp
add    $0xfffffffe,%ebp
test   %rbx,%rbx
lea    0xed3(%rip),%rdx
cmovne %rbx,%rdx
test   %ebp,%ebp
jle    1181 <op_binarize_short+0x51>
add    $0x1,%ebp
lea    0xe98(%rip),%rsi
lea    0xe9f(%rip),%r9
mov    %r14,%rdi
mov    %r15,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1195 <op_binarize_short+0x65>
lea    0xe81(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe74(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"%s%s:%*s\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [7 x i8] c"%s%s: \00"
@.str.4 = [26 x i8] c"apply a threshold filter\0A\00"
define void @op_binarize_short(i8* %0, i32 %1, i32* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 2
%12 = load i8*, i8** %5
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %11, %13
store i32 %14, i32* %9
%15 = load i8*, i8** %8
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %4
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
br label %18
18: ; preds = %17, %4
%19 = load i32, i32* %9
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32*, i32** %7
%23 = load i8*, i8** %8
%24 = load i8*, i8** %5
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %24, i32 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %33
28: ; preds = %18
%29 = load i32*, i32** %7
%30 = load i8*, i8** %8
%31 = load i8*, i8** %5
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %30, i8* %31)
br label %33
33: ; preds = %28, %21
%34 = load i32*, i32** %7
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"%s%s:%*s\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [7 x i8] c"%s%s: \00"
@.str.4 = [26 x i8] c"apply a threshold filter\0A\00"
define void @op_binarize_short(i8* %0, i32 %1, i32* nocapture %2, i8* %3) {
%5 = add nsw i32 %1, -2
%6 = tail call i32 @strlen(i8* %0)
%7 = sub i32 %5, %6
%8 = icmp eq i8* %3, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %3
%10 = icmp sgt i32 %7, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = add nuw nsw i32 %7, 1
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %0, i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %4
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8* %0)
br label %16
16: ; preds = %14, %11
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 25, i64 1, i32* %2)
ret void
}