#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 EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getchar();
scalar_t__ isatty(int /*<<< orphan*/);
scalar_t__ isblank(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int strtoll(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int max_width = -1;
  int cur_width = 0;
  int start = 1;
  int c;
  int count = 0;
  int single = 0;
  int tabsize = 4;
  for (int ac = 1; ac < argc; ac++) {
    if (strcmp(argv[ac], "-s") == 0) {
      single = 1;
    } else if (strcmp(argv[ac], "-t") == 0 && (ac + 1) < argc) {
      ac++;
      tabsize = strtoul(argv[ac], NULL, 10);
    } else if (strcmp(argv[ac], "-w") == 0 && (ac + 1) < argc) {
      max_width = strtoll(argv[ac + 1], NULL, 0);
      ac++;
    } else {
      printf("%s usage:\n", argv[0]);
      printf("\t%s [options]\n\n", argv[0]);
      printf("Read from stdin, strip leading and trailing whitespace and print "
             "to stdout.\n\n");
      printf("Options:\n");
      printf("\t-s: If multiple whitespace detected in the middle of the "
             "string, only print one space.\n");
      printf("\t-t: Number of spaces in a tab. (default: 4).");
      return EXIT_SUCCESS;
    }
  }
  if (isatty(fileno(stdin))) {
    fprintf(
        stderr,
        "Trim needs to take it input from a pipe or redirect, not a tty.\n");
    return EXIT_FAILURE;
  }
  while ((c = getchar()) != EOF) {
    if (start) {
      if (isblank(c)) {
        continue;
      }
      putchar(c);
      start = 0;
      continue;
    }
    if (c == '\n') {
      cur_width = 0;
      start = 1;
      count = 0;
      putchar(c);
      fflush(stdout);
    }
    if (c == ' ') {
      count++;
    } else if (c == '\t') {
      count += tabsize;
    } else {
      if (count) {
        for (; count > 0; count--) {
          putchar(' ');
          if (single) {
            count = 0;
          }
        }
      }
      cur_width++;
      if (!(max_width > 0 && cur_width >= max_width)) {
        putchar(c);
      }
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x4,-0x2c(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    137b <main+0x1cb>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdea(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1231 <main+0x81>
movl   $0x1,-0x28(%rbp)
jmp    1368 <main+0x1b8>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    128d <main+0xdd>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    128d <main+0xdd>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x2c(%rbp)
jmp    1363 <main+0x1b3>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd66(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12eb <main+0x13b>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jge    12eb <main+0x13b>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1090 <strtoll@plt>
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    135e <main+0x1ae>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1506 <main+0x356>
jmp    1363 <main+0x1b3>
jmp    1368 <main+0x1b8>
jmp    136d <main+0x1bd>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11f7 <main+0x47>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   10b0 <fileno@plt>
mov    %eax,%edi
call   1040 <isatty@plt>
cmp    $0x0,%rax
je     13c0 <main+0x210>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1506 <main+0x356>
jmp    13c5 <main+0x215>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %eax,-0x20(%rbp)
mov    0x2c0a(%rip),%rcx
cmp    (%rcx),%eax
je     14fa <main+0x34a>
cmpl   $0x0,-0x1c(%rbp)
je     1413 <main+0x263>
mov    -0x20(%rbp),%edi
call   1060 <isblank@plt>
cmp    $0x0,%rax
je     13ff <main+0x24f>
jmp    13c5 <main+0x215>
mov    -0x20(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x1c(%rbp)
jmp    13c5 <main+0x215>
cmpl   $0xa,-0x20(%rbp)
jne    1448 <main+0x298>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <putchar@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
cmpl   $0x20,-0x20(%rbp)
jne    1460 <main+0x2b0>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f5 <main+0x345>
cmpl   $0x9,-0x20(%rbp)
jne    1478 <main+0x2c8>
mov    -0x2c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    14f0 <main+0x340>
cmpl   $0x0,-0x24(%rbp)
je     14c4 <main+0x314>
jmp    1487 <main+0x2d7>
cmpl   $0x0,-0x24(%rbp)
jle    14bf <main+0x30f>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x28(%rbp)
je     14ac <main+0x2fc>
movl   $0x0,-0x24(%rbp)
jmp    14b1 <main+0x301>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1487 <main+0x2d7>
jmp    14c4 <main+0x314>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    14e3 <main+0x333>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14eb <main+0x33b>
mov    -0x20(%rbp),%edi
call   1030 <putchar@plt>
jmp    14f0 <main+0x340>
jmp    14f5 <main+0x345>
jmp    13c5 <main+0x215>
mov    0x2ab7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     12af <main+0xef>
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0xffffffff,0x8(%rsp)
ff
xor    %eax,%eax
mov    %rax,0x10(%rsp)
movl   $0x4,0xc(%rsp)
mov    $0x1,%r15d
lea    0xe00(%rip),%r12
movslq %r15d,%r13
mov    (%rbx,%r13,8),%rdi
mov    %r12,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1290 <main+0xd0>
mov    (%rbx,%r13,8),%rdi
lea    0xde4(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1250 <main+0x90>
lea    0x1(%r15),%r14d
cmp    %ebp,%r14d
jge    1250 <main+0x90>
movslq %r14d,%rax
mov    (%rbx,%rax,8),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10e0 <strtoul@plt>
mov    %eax,0xc(%rsp)
jmp    129d <main+0xdd>
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r13,8),%rdi
lea    0xdab(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1448 <main+0x288>
add    $0x1,%r15d
cmp    %ebp,%r15d
jge    1448 <main+0x288>
movslq %r15d,%rax
mov    (%rbx,%rax,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <strtoll@plt>
mov    %eax,0x8(%rsp)
jmp    129a <main+0xda>
nopl   0x0(%rax)
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
mov    %r15d,%r14d
add    $0x1,%r14d
mov    %r14d,%r15d
cmp    %ebp,%r14d
jl     1200 <main+0x40>
jmp    12c6 <main+0x106>
movl   $0x4,0xc(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
call   10c0 <fileno@plt>
mov    %eax,%edi
call   1050 <isatty@plt>
test   %rax,%rax
je     1301 <main+0x141>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
lea    0xd62(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2ccc(%rip),%rax
jmp    14a3 <main+0x2e3>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebx
mov    0x2ccf(%rip),%rbp
mov    0x2ca0(%rip),%rax
cmp    0x0(%rbp),%ebx
je     14a3 <main+0x2e3>
mov    $0x1,%r13d
xor    %r12d,%r12d
xor    %ecx,%ecx
mov    0x10(%rsp),%rax
mov    %ecx,%r15d
jmp    1358 <main+0x198>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebx
cmp    0x0(%rbp),%eax
mov    %r15d,%ecx
mov    %r14,%rax
je     149c <main+0x2dc>
test   %r13d,%r13d
je     137e <main+0x1be>
mov    %rax,%r14
mov    %ebx,%edi
call   1070 <isblank@plt>
mov    $0x1,%r13d
test   %rax,%rax
jne    1340 <main+0x180>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
jmp    1340 <main+0x180>
cmp    $0x9,%ebx
mov    %rax,0x10(%rsp)
mov    %rbp,%r14
je     13ba <main+0x1fa>
cmp    $0x20,%ebx
je     13c4 <main+0x204>
cmp    $0xa,%ebx
jne    13cd <main+0x20d>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
mov    $0x1,%r13d
xor    %ecx,%ecx
xor    %r12d,%r12d
jmp    140b <main+0x24b>
add    0xc(%rsp),%r12d
xor    %r13d,%r13d
jmp    1429 <main+0x269>
add    $0x1,%r12d
xor    %r13d,%r13d
jmp    1429 <main+0x269>
test   %r12d,%r12d
jle    1408 <main+0x248>
mov    %rax,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
test   %ebp,%ebp
mov    %r12d,%eax
cmovne %r13d,%eax
lea    -0x1(%rax),%r12d
cmp    $0x1,%eax
ja     13e0 <main+0x220>
mov    0x8(%rsp),%eax
mov    %r15d,%ecx
jmp    140f <main+0x24f>
xor    %r13d,%r13d
mov    0x8(%rsp),%eax
add    $0x1,%ecx
test   %eax,%eax
jle    141f <main+0x25f>
cmp    %eax,%ecx
jl     141f <main+0x25f>
mov    %ecx,%r15d
jmp    1429 <main+0x269>
mov    %ecx,%r15d
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebx
mov    %r14,%rbp
cmp    (%r14),%eax
mov    %r15d,%ecx
mov    0x10(%rsp),%rax
jne    1331 <main+0x171>
jmp    149c <main+0x2dc>
mov    (%rbx),%rsi
lea    0xbb7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%rsi
lea    0xbb1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc22(%rip),%rdi
call   1040 <puts@plt>
lea    0xc63(%rip),%rdi
call   1040 <puts@plt>
lea    0xc60(%rip),%rdi
call   1040 <puts@plt>
lea    0xb8f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2b15(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-s\00"
@.str.1 = [3 x i8] c"-t\00"
@.str.2 = [3 x i8] c"-w\00"
@.str.3 = [11 x i8] c"%s usage:\0A\00"
@.str.4 = [16 x i8] c"\09%s [options]\0A\0A\00"
@.str.5 = [78 x i8] c"Read from stdin, strip leading and trailing whitespace and print to stdout.\0A\0A\00"
@.str.6 = [10 x i8] c"Options:\0A\00"
@.str.7 = [89 x i8] c"\09-s: If multiple whitespace detected in the middle of the string, only print one space.\0A\00"
@.str.8 = [46 x i8] c"\09-t: Number of spaces in a tab. (default: 4).\00"
@EXIT_SUCCESS = global i32 0
@stdin = global i32 0
@stderr = global i32 0
@.str.9 = [65 x i8] c"Trim needs to take it input from a pipe or redirect, not a tty.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %10
store i32 0, i32* %11
store i32 4, i32* %12
store i32 1, i32* %13
br label %14
14: ; preds = %89, %2
%15 = load i32, i32* %13
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %92
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %13
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %18
store i32 1, i32* %11
br label %88
27: ; preds = %18
%28 = load i8**, i8*** %5
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %49
35: ; preds = %27
%36 = load i32, i32* %13
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %4
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %49
40: ; preds = %35
%41 = load i32, i32* %13
%42 = add nsw i32 %41, 1
store i32 %42, i32* %13
%43 = load i8**, i8*** %5
%44 = load i32, i32* %13
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 @strtoul(i8* %47, i32* null, i32 10)
store i32 %48, i32* %12
br label %87
49: ; preds = %35, %27
%50 = load i8**, i8*** %5
%51 = load i32, i32* %13
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %72
57: ; preds = %49
%58 = load i32, i32* %13
%59 = add nsw i32 %58, 1
%60 = load i32, i32* %4
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %72
62: ; preds = %57
%63 = load i8**, i8*** %5
%64 = load i32, i32* %13
%65 = add nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %63, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @strtoll(i8* %68, i32* null, i32 0)
store i32 %69, i32* %6
%70 = load i32, i32* %13
%71 = add nsw i32 %70, 1
store i32 %71, i32* %13
br label %86
72: ; preds = %57, %49
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 0
%75 = load i8*, i8** %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %75)
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 0
%79 = load i8*, i8** %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.5, i64 0, i64 0))
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.7, i64 0, i64 0))
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
%85 = load i32, i32* @EXIT_SUCCESS
store i32 %85, i32* %3
br label %172
86: ; preds = %62
br label %87
87: ; preds = %86, %40
br label %88
88: ; preds = %87, %26
br label %89
89: ; preds = %88
%90 = load i32, i32* %13
%91 = add nsw i32 %90, 1
store i32 %91, i32* %13
br label %14
92: ; preds = %14
%93 = load i32, i32* @stdin
%94 = call i32 @fileno(i32 %93)
%95 = call i64 @isatty(i32 %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %92
%98 = load i32, i32* @stderr
%99 = call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
store i32 %100, i32* %3
br label %172
101: ; preds = %92
br label %102
102: ; preds = %169, %114, %113, %101
%103 = call i32 (...) @getchar()
store i32 %103, i32* %9
%104 = load i32, i32* @EOF
%105 = icmp ne i32 %103, %104
br i1 %105, label %106, label %170
106: ; preds = %102
%107 = load i32, i32* %8
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %117
109: ; preds = %106
%110 = load i32, i32* %9
%111 = call i64 @isblank(i32 %110)
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %114
113: ; preds = %109
br label %102
114: ; preds = %109
%115 = load i32, i32* %9
%116 = call i32 @putchar(i32 %115)
store i32 0, i32* %8
br label %102
117: ; preds = %106
%118 = load i32, i32* %9
%119 = icmp eq i32 %118, 10
br i1 %119, label %120, label %125
120: ; preds = %117
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %10
%121 = load i32, i32* %9
%122 = call i32 @putchar(i32 %121)
%123 = load i32, i32* @stdout
%124 = call i32 @fflush(i32 %123)
br label %125
125: ; preds = %120, %117
%126 = load i32, i32* %9
%127 = icmp eq i32 %126, 32
br i1 %127, label %128, label %131
128: ; preds = %125
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 1
store i32 %130, i32* %10
br label %169
131: ; preds = %125
%132 = load i32, i32* %9
%133 = icmp eq i32 %132, 9
br i1 %133, label %134, label %138
134: ; preds = %131
%135 = load i32, i32* %12
%136 = load i32, i32* %10
%137 = add nsw i32 %136, %135
store i32 %137, i32* %10
br label %168
138: ; preds = %131
%139 = load i32, i32* %10
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %155
141: ; preds = %138
br label %142
142: ; preds = %151, %141
%143 = load i32, i32* %10
%144 = icmp sgt i32 %143, 0
br i1 %144, label %145, label %154
145: ; preds = %142
%146 = call i32 @putchar(i32 32)
%147 = load i32, i32* %11
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %145
store i32 0, i32* %10
br label %150
150: ; preds = %149, %145
br label %151
151: ; preds = %150
%152 = load i32, i32* %10
%153 = add nsw i32 %152, -1
store i32 %153, i32* %10
br label %142
154: ; preds = %142
br label %155
155: ; preds = %154, %138
%156 = load i32, i32* %7
%157 = add nsw i32 %156, 1
store i32 %157, i32* %7
%158 = load i32, i32* %6
%159 = icmp sgt i32 %158, 0
br i1 %159, label %160, label %164
160: ; preds = %155
%161 = load i32, i32* %7
%162 = load i32, i32* %6
%163 = icmp sge i32 %161, %162
br i1 %163, label %167, label %164
164: ; preds = %160, %155
%165 = load i32, i32* %9
%166 = call i32 @putchar(i32 %165)
br label %167
167: ; preds = %164, %160
br label %168
168: ; preds = %167, %134
br label %169
169: ; preds = %168, %128
br label %102
170: ; preds = %102
%171 = load i32, i32* @EXIT_SUCCESS
store i32 %171, i32* %3
br label %172
172: ; preds = %170, %97, %72
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
@.str = [3 x i8] c"-s\00"
@.str.1 = [3 x i8] c"-t\00"
@.str.2 = [3 x i8] c"-w\00"
@.str.3 = [11 x i8] c"%s usage:\0A\00"
@.str.4 = [16 x i8] c"\09%s [options]\0A\0A\00"
@.str.8 = [46 x i8] c"\09-t: Number of spaces in a tab. (default: 4).\00"
@EXIT_SUCCESS = global i32 0
@stdin = global i32 0
@stderr = global i32 0
@.str.9 = [65 x i8] c"Trim needs to take it input from a pipe or redirect, not a tty.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
@stdout = global i32 0
@str = [77 x i8] c"Read from stdin, strip leading and trailing whitespace and print to stdout.\0A\00"
@str.10 = [9 x i8] c"Options:\00"
@str.11 = [88 x i8] c"\09-s: If multiple whitespace detected in the middle of the string, only print one space.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %54
4: ; preds = %2, %47
%5 = phi i32 [ %52, %47 ], [ 1, %2 ]
%6 = phi i32 [ %50, %47 ], [ 4, %2 ]
%7 = phi i32 [ %49, %47 ], [ 0, %2 ]
%8 = phi i32 [ %48, %47 ], [ -1, %2 ]
%9 = sext i32 %5 to i64
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %47, label %14
14: ; preds = %4
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = add nsw i32 %5, 1
%20 = icmp slt i32 %19, %0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = sext i32 %19 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @strtoul(i8* nocapture %24, i32* null, i32 10)
br label %47
26: ; preds = %18, %14
%27 = load i8*, i8** %10
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %26
%31 = add nsw i32 %5, 1
%32 = icmp slt i32 %31, %0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = sext i32 %31 to i64
%35 = getelementptr inbounds i8*, i8** %1, i64 %34
%36 = load i8*, i8** %35
%37 = tail call i32 @strtoll(i8* nocapture %36, i32* null, i32 0)
br label %47
38: ; preds = %26, %30
%39 = load i8*, i8** %1
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %1
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %41)
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str, i64 0, i64 0))
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str.11, i64 0, i64 0))
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
br label %124
47: ; preds = %4, %33, %21
%48 = phi i32 [ %8, %21 ], [ %37, %33 ], [ %8, %4 ]
%49 = phi i32 [ %7, %21 ], [ %7, %33 ], [ 1, %4 ]
%50 = phi i32 [ %25, %21 ], [ %6, %33 ], [ %6, %4 ]
%51 = phi i32 [ %19, %21 ], [ %31, %33 ], [ %5, %4 ]
%52 = add nsw i32 %51, 1
%53 = icmp slt i32 %52, %0
br i1 %53, label %4, label %54
54: ; preds = %47, %2
%55 = phi i32 [ -1, %2 ], [ %48, %47 ]
%56 = phi i32 [ 0, %2 ], [ %49, %47 ]
%57 = phi i32 [ 4, %2 ], [ %50, %47 ]
%58 = load i32, i32* @stdin
%59 = tail call i32 @fileno(i32 %58)
%60 = tail call i64 @isatty(i32 %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %69
62: ; preds = %54
%63 = tail call i32 (...) @getchar()
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %63, %64
br i1 %65, label %124, label %66
66: ; preds = %62
%67 = icmp eq i32 %56, 0
%68 = icmp slt i32 %55, 1
br label %119
69: ; preds = %54
%70 = load i32, i32* @stderr
%71 = tail call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
br label %124
72: ; preds = %119, %81
%73 = phi i32 [ %120, %119 ], [ %83, %81 ]
%74 = phi i32 [ %122, %119 ], [ %82, %81 ]
%75 = icmp eq i32 %74, 0
br i1 %75, label %86, label %76
76: ; preds = %72
%77 = tail call i64 @isblank(i32 %73)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = tail call i32 @putchar(i32 %73)
br label %81
81: ; preds = %79, %76
%82 = phi i32 [ 1, %76 ], [ 0, %79 ]
%83 = tail call i32 (...) @getchar()
%84 = load i32, i32* @EOF
%85 = icmp eq i32 %83, %84
br i1 %85, label %124, label %72
86: ; preds = %72
switch i32 %73, label %95 [
i32 10, label %87
i32 32, label %91
i32 9, label %93
]
87: ; preds = %86
%88 = tail call i32 @putchar(i32 10)
%89 = load i32, i32* @stdout
%90 = tail call i32 @fflush(i32 %89)
br label %103
91: ; preds = %86
%92 = add nsw i32 %121, 1
br label %112
93: ; preds = %86
%94 = add nsw i32 %121, %57
br label %112
95: ; preds = %86
%96 = icmp sgt i32 %121, 0
br i1 %96, label %97, label %103
97: ; preds = %95, %97
%98 = phi i32 [ %101, %97 ], [ %121, %95 ]
%99 = tail call i32 @putchar(i32 32)
%100 = select i1 %67, i32 %98, i32 0
%101 = add nsw i32 %100, -1
%102 = icmp ugt i32 %100, 1
br i1 %102, label %97, label %103
103: ; preds = %97, %87, %95
%104 = phi i32 [ %123, %95 ], [ 0, %87 ], [ %123, %97 ]
%105 = phi i32 [ 0, %95 ], [ 1, %87 ], [ 0, %97 ]
%106 = phi i32 [ %121, %95 ], [ 0, %87 ], [ %101, %97 ]
%107 = add nsw i32 %104, 1
%108 = icmp slt i32 %107, %55
%109 = select i1 %68, i1 true, i1 %108
br i1 %109, label %110, label %112
110: ; preds = %103
%111 = tail call i32 @putchar(i32 %73)
br label %112
112: ; preds = %103, %93, %110, %91
%113 = phi i32 [ 0, %91 ], [ 0, %93 ], [ %105, %110 ], [ %105, %103 ]
%114 = phi i32 [ %123, %91 ], [ %123, %93 ], [ %107, %110 ], [ %107, %103 ]
%115 = phi i32 [ %92, %91 ], [ %94, %93 ], [ %106, %110 ], [ %106, %103 ]
%116 = tail call i32 (...) @getchar()
%117 = load i32, i32* @EOF
%118 = icmp eq i32 %116, %117
br i1 %118, label %124, label %119
119: ; preds = %66, %112
%120 = phi i32 [ %63, %66 ], [ %116, %112 ]
%121 = phi i32 [ 0, %66 ], [ %115, %112 ]
%122 = phi i32 [ 1, %66 ], [ %113, %112 ]
%123 = phi i32 [ 0, %66 ], [ %114, %112 ]
br label %72
124: ; preds = %112, %81, %62, %38, %69
%125 = phi i32* [ @EXIT_FAILURE, %69 ], [ @EXIT_SUCCESS, %38 ], [ @EXIT_SUCCESS, %62 ], [ @EXIT_SUCCESS, %81 ], [ @EXIT_SUCCESS, %112 ]
%126 = load i32, i32* %125
ret i32 %126
}