long usage(flag)
short flag;
{
  printf(
      "USAGE: thin inimg outimg [-k K] [-n MAXITER] [-d DISPLAY] [-I] [-L]\n");
  if (flag == 0)
    return (-1);
  printf("\nthin performs iterative thinning of binary objects\n");
  printf("in input image to produce skeleton image with values\n");
  printf("OFF (0) anf ON (255)\n\n");
  printf("ARGUMENTS:\n");
  printf("    inimg: input image filename (TIF)\n");
  printf("   outimg: output image filename (TIF)\n\n");
  printf("OPTIONS:\n");
  printf("     -k K: window size for kxk mask (k >= 3, default = %d)\n", 3);
  printf(" -n NITER: maximum number of iterations (default max = %d)\n", 50);
  printf("       -d: to display results of each iteration (< 40x40 image)\n");
  printf("       -I: invert input image before processing\n");
  printf("       -L: print Software License for this module\n");
  return (-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0xa(%rbp),%eax
cmp    $0x0,%eax
jne    1147 <usage+0x37>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1201 <usage+0xf1>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf7d(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa6(%rip),%rdi
mov    $0x32,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1002(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1025(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
lea    0xf4e(%rip),%rdi
call   1030 <puts@plt>
test   %bx,%bx
je     11d6 <usage+0xb6>
lea    0xf7d(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa5(%rip),%rdi
call   1030 <puts@plt>
lea    0xfce(%rip),%rdi
call   1030 <puts@plt>
lea    0xfd8(%rip),%rdi
call   1030 <puts@plt>
lea    0xfd7(%rip),%rdi
call   1030 <puts@plt>
lea    0xff1(%rip),%rdi
call   1030 <puts@plt>
lea    0x100d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfe4(%rip),%rdi
call   1030 <puts@plt>
lea    0x1018(%rip),%rdi
call   1030 <puts@plt>
lea    0x103c(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffffffffffff,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [69 x i8] c"USAGE: thin inimg outimg [-k K] [-n MAXITER] [-d DISPLAY] [-I] [-L]\0A\00"
@.str.1 = [53 x i8] c"\0Athin performs iterative thinning of binary objects\0A\00"
@.str.2 = [54 x i8] c"in input image to produce skeleton image with values\0A\00"
@.str.3 = [23 x i8] c"OFF (0) anf ON (255)\0A\0A\00"
@.str.4 = [12 x i8] c"ARGUMENTS:\0A\00"
@.str.5 = [39 x i8] c" inimg: input image filename (TIF)\0A\00"
@.str.6 = [41 x i8] c" outimg: output image filename (TIF)\0A\0A\00"
@.str.7 = [10 x i8] c"OPTIONS:\0A\00"
@.str.8 = [60 x i8] c" -k K: window size for kxk mask (k >= 3, default = %d)\0A\00"
@.str.9 = [60 x i8] c" -n NITER: maximum number of iterations (default max = %d)\0A\00"
@.str.10 = [65 x i8] c" -d: to display results of each iteration (< 40x40 image)\0A\00"
@.str.11 = [49 x i8] c" -I: invert input image before processing\0A\00"
@.str.12 = [51 x i8] c" -L: print Software License for this module\0A\00"
define i64 @usage(i32 %0) {
%2 = alloca i64
%3 = alloca i16
%4 = trunc i32 %0 to i16
store i16 %4, i16* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%6 = load i16, i16* %3
%7 = sext i16 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i64 -1, i64* %2
br label %23
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 3)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 50)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0))
store i64 -1, i64* %2
br label %23
23: ; preds = %10, %9
%24 = load i64, i64* %2
ret i64 %24
}

LLVM IR (-O2):
@.str.8 = [60 x i8] c" -k K: window size for kxk mask (k >= 3, default = %d)\0A\00"
@.str.9 = [60 x i8] c" -n NITER: maximum number of iterations (default max = %d)\0A\00"
@str = [68 x i8] c"USAGE: thin inimg outimg [-k K] [-n MAXITER] [-d DISPLAY] [-I] [-L]\00"
@str.13 = [52 x i8] c"\0Athin performs iterative thinning of binary objects\00"
@str.14 = [53 x i8] c"in input image to produce skeleton image with values\00"
@str.15 = [22 x i8] c"OFF (0) anf ON (255)\0A\00"
@str.16 = [11 x i8] c"ARGUMENTS:\00"
@str.17 = [38 x i8] c" inimg: input image filename (TIF)\00"
@str.18 = [40 x i8] c" outimg: output image filename (TIF)\0A\00"
@str.19 = [9 x i8] c"OPTIONS:\00"
@str.20 = [64 x i8] c" -d: to display results of each iteration (< 40x40 image)\00"
@str.21 = [48 x i8] c" -I: invert input image before processing\00"
@str.22 = [50 x i8] c" -L: print Software License for this module\00"
define i64 @usage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%3 = and i32 %0, 65535
%4 = icmp eq i32 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.16, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.17, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.18, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 50)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.20, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.21, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.22, i64 0, i64 0))
br label %18
18: ; preds = %1, %5
ret i64 -1
}