#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ const member_1;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int coord_transform(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
#define no_argument 129
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printf(char *);
int raster_transform(char *, char *, char *, char *, int);
#define required_argument 128
int /*<<< orphan*/ stderr;
int vector_transform(char *, char *, char *, char *, char *, char *, char *,
                     char *, char *, int);
int main(int argc, const char *argv[]) {
  int c;
  int ok;
  char *infile, *morphfile, *outfile, *format, *input_layer, *output_layer;
  char *attrs, *spatial_filter, *attr_filter;
  int raster, back_transform;
  extern int optind;
  extern int optopt;
  extern char *optarg;
  if (argc < 2) {
    printUsage();
    return (0);
  }
  infile = morphfile = outfile = input_layer = NULL;
  attrs = spatial_filter = attr_filter = NULL;
  format = NULL;
  raster = 0;
  output_layer = "transformed_layer";
  back_transform = 0;
  while (1) {
    static struct option long_options[] = {
        {"help", no_argument, 0, 'h'},
        {"input", required_argument, 0, 'i'},
        {"morphfile", required_argument, 0, 'm'},
        {"output", required_argument, 0, 'o'},
        {"format", required_argument, 0, 'f'},
        {"raster", no_argument, 0, 'r'},
        {"input_layer", required_argument, 0, '1'},
        {"spatial_filter", required_argument, 0, 's'},
        {"attr_filter", required_argument, 0, 'w'},
        {"output_layer", required_argument, 0, '2'},
        {"attrs", required_argument, 0, 'a'},
        {"back", no_argument, 0, 'b'},
        {0, 0, 0, 0}};
    c = getopt_long(argc, (char **)argv, "hi:m:o:f:r1:s:w:a:2:b", long_options,
                    NULL);
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'h':
      printUsage();
      return 0;
    case 'i':
      infile = optarg;
      break;
    case 'o':
      outfile = optarg;
      break;
    case 'm':
      morphfile = optarg;
      break;
    case 'f':
      format = optarg;
      break;
    case '1':
      input_layer = optarg;
      break;
    case 's':
      spatial_filter = optarg;
      break;
    case 'a':
      attrs = optarg;
      break;
    case 'w':
      attr_filter = optarg;
      break;
    case '2':
      output_layer = optarg;
      break;
    case 'r':
      raster = 1;
      break;
    case 'b':
      back_transform = 1;
      break;
    case '?':
      return 1;
    default:
      printUsage();
      abort();
    }
  }
  if (morphfile == NULL) {
    fprintf(stderr, "Error. You must supply a morph file.\n");
    exit(1);
  }
  if ((infile == NULL && outfile != NULL) ||
      (infile != NULL && outfile == NULL)) {
    fprintf(stderr, "Error. Specify an input and an output file.\n");
    exit(1);
  }
  if (infile == NULL && outfile == NULL) {
    ok = coord_transform(morphfile, back_transform);
    return ok;
  }
  printf("r.morph.transform starting\n");
  if (raster) {
    ok = raster_transform(infile, morphfile, outfile, format, back_transform);
  } else {
    ok = vector_transform(infile, input_layer, spatial_filter, attr_filter,
                          morphfile, outfile, attrs, format, output_layer,
                          back_transform);
  }
  printf("r.morph.transform done\n");
  return ok;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x98,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    11c7 <main+0x37>
mov    $0x0,%al
call   10a0 <printUsage@plt>
movl   $0x0,-0xc(%rbp)
jmp    149e <main+0x30e>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x6c(%rbp)
lea    0xf07(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x70(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    0xf69(%rip),%rdx
lea    0x2e3b(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1251 <main+0xc1>
jmp    136f <main+0x1df>
mov    -0x1c(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x78(%rbp)
sub    $0x46,%eax
ja     135c <main+0x1cc>
mov    -0x78(%rbp),%rax
lea    0xd8f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <printUsage@plt>
movl   $0x0,-0xc(%rbp)
jmp    149e <main+0x30e>
mov    0x2d4c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    136a <main+0x1da>
mov    0x2d39(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    136a <main+0x1da>
mov    0x2d26(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    136a <main+0x1da>
mov    0x2d13(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    136a <main+0x1da>
mov    0x2d00(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    136a <main+0x1da>
mov    0x2ced(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    136a <main+0x1da>
mov    0x2cda(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    136a <main+0x1da>
mov    0x2cc7(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    136a <main+0x1da>
mov    0x2cb4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    136a <main+0x1da>
movl   $0x1,-0x6c(%rbp)
jmp    136a <main+0x1da>
movl   $0x1,-0x70(%rbp)
jmp    136a <main+0x1da>
movl   $0x1,-0xc(%rbp)
jmp    149e <main+0x30e>
mov    $0x0,%al
call   10a0 <printUsage@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1220 <main+0x90>
cmpq   $0x0,-0x30(%rbp)
jne    1399 <main+0x209>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jne    13af <main+0x21f>
cmpq   $0x0,-0x38(%rbp)
jne    13c5 <main+0x235>
cmpq   $0x0,-0x28(%rbp)
je     13e4 <main+0x254>
cmpq   $0x0,-0x38(%rbp)
jne    13e4 <main+0x254>
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jne    1414 <main+0x284>
cmpq   $0x0,-0x38(%rbp)
jne    1414 <main+0x284>
mov    -0x30(%rbp),%rdi
mov    -0x70(%rbp),%esi
call   1090 <coord_transform@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    149e <main+0x30e>
lea    0xde5(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x6c(%rbp)
je     144b <main+0x2bb>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x70(%rbp),%r8d
call   1060 <raster_transform@plt>
mov    %eax,-0x20(%rbp)
jmp    148c <main+0x2fc>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x58(%rbp),%rbx
mov    -0x40(%rbp),%r11
mov    -0x50(%rbp),%r10
mov    -0x70(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1080 <vector_transform@plt>
mov    %eax,-0x20(%rbp)
lea    0xd89(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%edi
jge    11bd <main+0x2d>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <printUsage@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%rbp
mov    %edi,%r14d
xor    %eax,%eax
mov    %rax,0x48(%rsp)
lea    0x1013(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0x1082(%rip),%r13
lea    0x2e8c(%rip),%r15
lea    0xe15(%rip),%r12
xor    %eax,%eax
mov    %rax,0x50(%rsp)
xor    %eax,%eax
mov    %rax,0x40(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %ecx,%ecx
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    1240 <main+0xb0>
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    %ebx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%ebx
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1050 <getopt_long@plt>
add    $0x1,%eax
cmp    $0x78,%eax
ja     13f6 <main+0x266>
mov    $0x1,%ecx
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x2d69(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x28(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2d56(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x38(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2d43(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2d30(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2d1d(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x48(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2d07(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x50(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2cf1(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x40(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2cdb(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    0x2cc5(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
mov    %ebx,%ecx
jmp    1240 <main+0xb0>
mov    $0x1,%ebx
jmp    11ac <main+0x1c>
mov    0x50(%rsp),%r14
test   %r14,%r14
je     1416 <main+0x286>
mov    0x48(%rsp),%rbp
test   %rbp,%rbp
mov    0x40(%rsp),%r15
jne    135a <main+0x1ca>
test   %r15,%r15
jne    1404 <main+0x274>
test   %rbp,%rbp
je     1368 <main+0x1d8>
test   %r15,%r15
je     1404 <main+0x274>
mov    %rbp,%rax
or     %r15,%rax
jne    138b <main+0x1fb>
mov    %r14,%rdi
mov    0x8(%rsp),%rsi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <coord_transform@plt>
lea    0xf36(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
test   %ebx,%ebx
je     13b5 <main+0x225>
mov    %r14,%rsi
mov    %r15,%rdx
mov    0x10(%rsp),%rcx
mov    0x8(%rsp),%r8
call   1060 <raster_transform@plt>
jmp    13e3 <main+0x253>
mov    0x28(%rsp),%rsi
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    %r14,%r8
mov    %r15,%r9
push   0x8(%rsp)
push   0x40(%rsp)
push   0x20(%rsp)
push   0x48(%rsp)
call   1080 <vector_transform@plt>
add    $0x20,%rsp
mov    %eax,%ebx
lea    0xef7(%rip),%rdi
call   1040 <puts@plt>
jmp    11ac <main+0x1c>
xor    %eax,%eax
call   10a0 <printUsage@plt>
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
jmp    1426 <main+0x296>
mov    0x2bbb(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [18 x i8] c"transformed_layer\00"
@main.long_options = internal global [13 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 109 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 111 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8 -127, i32 0, i32 114 }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8 -128, i32 0, i32 49 }, %struct.option { i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8 -128, i32 0, i32 115 }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i32 0, i32 0), i8 -128, i32 0, i32 119 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i32 0, i32 0), i8 -128, i32 0, i32 50 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i32 0, i32 0), i8 -128, i32 0, i32 97 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8 -127, i32 0, i32 98 }, %struct.option zeroinitializer]
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [6 x i8] c"input\00"
@.str.3 = [10 x i8] c"morphfile\00"
@.str.4 = [7 x i8] c"output\00"
@.str.5 = [7 x i8] c"format\00"
@.str.6 = [7 x i8] c"raster\00"
@.str.7 = [12 x i8] c"input_layer\00"
@.str.8 = [15 x i8] c"spatial_filter\00"
@.str.9 = [12 x i8] c"attr_filter\00"
@.str.10 = [13 x i8] c"output_layer\00"
@.str.11 = [6 x i8] c"attrs\00"
@.str.12 = [5 x i8] c"back\00"
@.str.13 = [22 x i8] c"hi:m:o:f:r1:s:w:a:2:b\00"
@optarg = external global i8*
@stderr = global i32 0
@.str.14 = [38 x i8] c"Error. You must supply a morph file.\0A\00"
@.str.15 = [45 x i8] c"Error. Specify an input and an output file.\0A\00"
@.str.16 = [28 x i8] c"r.morph.transform starting\0A\00"
@.str.17 = [24 x i8] c"r.morph.transform done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (...) @printUsage()
store i32 0, i32* %3
br label %120
23: ; preds = %2
store i8* null, i8** %12
store i8* null, i8** %10
store i8* null, i8** %9
store i8* null, i8** %8
store i8* null, i8** %16
store i8* null, i8** %15
store i8* null, i8** %14
store i8* null, i8** %11
store i32 0, i32* %17
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %13
store i32 0, i32* %18
br label %24
24: ; preds = %23, %59
%25 = load i32, i32* %4
%26 = load i8**, i8*** %5
%27 = call i32 @getopt_long(i32 %25, i8** %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0), %struct.option* getelementptr inbounds ([13 x %struct.option], [13 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %31
30: ; preds = %24
br label %60
31: ; preds = %24
%32 = load i32, i32* %6
switch i32 %32, label %56 [
i32 104, label %33
i32 105, label %35
i32 111, label %37
i32 109, label %39
i32 102, label %41
i32 49, label %43
i32 115, label %45
i32 97, label %47
i32 119, label %49
i32 50, label %51
i32 114, label %53
i32 98, label %54
i32 63, label %55
]
33: ; preds = %31
%34 = call i32 (...) @printUsage()
store i32 0, i32* %3
br label %120
35: ; preds = %31
%36 = load i8*, i8** @optarg
store i8* %36, i8** %8
br label %59
37: ; preds = %31
%38 = load i8*, i8** @optarg
store i8* %38, i8** %10
br label %59
39: ; preds = %31
%40 = load i8*, i8** @optarg
store i8* %40, i8** %9
br label %59
41: ; preds = %31
%42 = load i8*, i8** @optarg
store i8* %42, i8** %11
br label %59
43: ; preds = %31
%44 = load i8*, i8** @optarg
store i8* %44, i8** %12
br label %59
45: ; preds = %31
%46 = load i8*, i8** @optarg
store i8* %46, i8** %15
br label %59
47: ; preds = %31
%48 = load i8*, i8** @optarg
store i8* %48, i8** %14
br label %59
49: ; preds = %31
%50 = load i8*, i8** @optarg
store i8* %50, i8** %16
br label %59
51: ; preds = %31
%52 = load i8*, i8** @optarg
store i8* %52, i8** %13
br label %59
53: ; preds = %31
store i32 1, i32* %17
br label %59
54: ; preds = %31
store i32 1, i32* %18
br label %59
55: ; preds = %31
store i32 1, i32* %3
br label %120
56: ; preds = %31
%57 = call i32 (...) @printUsage()
%58 = call i32 (...) @abort()
unreachable
59: ; preds = %54, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35
br label %24
60: ; preds = %30
%61 = load i8*, i8** %9
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %60
%68 = load i8*, i8** %8
%69 = icmp eq i8* %68, null
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i8*, i8** %10
%72 = icmp ne i8* %71, null
br i1 %72, label %79, label %73
73: ; preds = %70, %67
%74 = load i8*, i8** %8
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %83
76: ; preds = %73
%77 = load i8*, i8** %10
%78 = icmp eq i8* %77, null
br i1 %78, label %79, label %83
79: ; preds = %76, %70
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %76, %73
%84 = load i8*, i8** %8
%85 = icmp eq i8* %84, null
br i1 %85, label %86, label %94
86: ; preds = %83
%87 = load i8*, i8** %10
%88 = icmp eq i8* %87, null
br i1 %88, label %89, label %94
89: ; preds = %86
%90 = load i8*, i8** %9
%91 = load i32, i32* %18
%92 = call i32 @coord_transform(i8* %90, i32 %91)
store i32 %92, i32* %7
%93 = load i32, i32* %7
store i32 %93, i32* %3
br label %120
94: ; preds = %86, %83
%95 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0))
%96 = load i32, i32* %17
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %105
98: ; preds = %94
%99 = load i8*, i8** %8
%100 = load i8*, i8** %9
%101 = load i8*, i8** %10
%102 = load i8*, i8** %11
%103 = load i32, i32* %18
%104 = call i32 @raster_transform(i8* %99, i8* %100, i8* %101, i8* %102, i32 %103)
store i32 %104, i32* %7
br label %117
105: ; preds = %94
%106 = load i8*, i8** %8
%107 = load i8*, i8** %12
%108 = load i8*, i8** %15
%109 = load i8*, i8** %16
%110 = load i8*, i8** %9
%111 = load i8*, i8** %10
%112 = load i8*, i8** %14
%113 = load i8*, i8** %11
%114 = load i8*, i8** %13
%115 = load i32, i32* %18
%116 = call i32 @vector_transform(i8* %106, i8* %107, i8* %108, i8* %109, i8* %110, i8* %111, i8* %112, i8* %113, i8* %114, i32 %115)
store i32 %116, i32* %7
br label %117
117: ; preds = %105, %98
%118 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0))
%119 = load i32, i32* %7
store i32 %119, i32* %3
br label %120
120: ; preds = %117, %89, %55, %33, %21
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [18 x i8] c"transformed_layer\00"
@main.long_options = internal global [13 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 109 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 111 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8 -127, i32 0, i32 114 }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8 -128, i32 0, i32 49 }, %struct.option { i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8 -128, i32 0, i32 115 }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i32 0, i32 0), i8 -128, i32 0, i32 119 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i32 0, i32 0), i8 -128, i32 0, i32 50 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i32 0, i32 0), i8 -128, i32 0, i32 97 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8 -127, i32 0, i32 98 }, %struct.option zeroinitializer]
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [6 x i8] c"input\00"
@.str.3 = [10 x i8] c"morphfile\00"
@.str.4 = [7 x i8] c"output\00"
@.str.5 = [7 x i8] c"format\00"
@.str.6 = [7 x i8] c"raster\00"
@.str.7 = [12 x i8] c"input_layer\00"
@.str.8 = [15 x i8] c"spatial_filter\00"
@.str.9 = [12 x i8] c"attr_filter\00"
@.str.10 = [13 x i8] c"output_layer\00"
@.str.11 = [6 x i8] c"attrs\00"
@.str.12 = [5 x i8] c"back\00"
@.str.13 = [22 x i8] c"hi:m:o:f:r1:s:w:a:2:b\00"
@optarg = external global i8*
@stderr = global i32 0
@.str.14 = [38 x i8] c"Error. You must supply a morph file.\0A\00"
@.str.15 = [45 x i8] c"Error. Specify an input and an output file.\0A\00"
@str = [27 x i8] c"r.morph.transform starting\00"
@str.18 = [23 x i8] c"r.morph.transform done\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @printUsage()
br label %87
6: ; preds = %2, %19
%7 = phi i8* [ %20, %19 ], [ null, %2 ]
%8 = phi i8* [ %21, %19 ], [ null, %2 ]
%9 = phi i8* [ %22, %19 ], [ null, %2 ]
%10 = phi i8* [ %23, %19 ], [ null, %2 ]
%11 = phi i8* [ %24, %19 ], [ null, %2 ]
%12 = phi i8* [ %25, %19 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %2 ]
%13 = phi i8* [ %26, %19 ], [ null, %2 ]
%14 = phi i8* [ %27, %19 ], [ null, %2 ]
%15 = phi i8* [ %28, %19 ], [ null, %2 ]
%16 = phi i32 [ %29, %19 ], [ 0, %2 ]
%17 = phi i32 [ %30, %19 ], [ 0, %2 ]
%18 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0), %struct.option* getelementptr inbounds ([13 x %struct.option], [13 x %struct.option]* @main.long_options, i64 0, i64 0), i32* null)
switch i32 %18, label %52 [
i32 -1, label %55
i32 104, label %31
i32 105, label %33
i32 111, label %35
i32 109, label %37
i32 102, label %39
i32 49, label %41
i32 115, label %43
i32 97, label %45
i32 119, label %47
i32 50, label %49
i32 114, label %19
i32 98, label %51
i32 63, label %87
]
19: ; preds = %6, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33
%20 = phi i8* [ %7, %51 ], [ %7, %49 ], [ %7, %47 ], [ %7, %45 ], [ %7, %43 ], [ %7, %41 ], [ %7, %39 ], [ %7, %37 ], [ %7, %35 ], [ %34, %33 ], [ %7, %6 ]
%21 = phi i8* [ %8, %51 ], [ %8, %49 ], [ %8, %47 ], [ %8, %45 ], [ %8, %43 ], [ %8, %41 ], [ %8, %39 ], [ %38, %37 ], [ %8, %35 ], [ %8, %33 ], [ %8, %6 ]
%22 = phi i8* [ %9, %51 ], [ %9, %49 ], [ %9, %47 ], [ %9, %45 ], [ %9, %43 ], [ %9, %41 ], [ %9, %39 ], [ %9, %37 ], [ %36, %35 ], [ %9, %33 ], [ %9, %6 ]
%23 = phi i8* [ %10, %51 ], [ %10, %49 ], [ %10, %47 ], [ %10, %45 ], [ %10, %43 ], [ %10, %41 ], [ %40, %39 ], [ %10, %37 ], [ %10, %35 ], [ %10, %33 ], [ %10, %6 ]
%24 = phi i8* [ %11, %51 ], [ %11, %49 ], [ %11, %47 ], [ %11, %45 ], [ %11, %43 ], [ %42, %41 ], [ %11, %39 ], [ %11, %37 ], [ %11, %35 ], [ %11, %33 ], [ %11, %6 ]
%25 = phi i8* [ %12, %51 ], [ %50, %49 ], [ %12, %47 ], [ %12, %45 ], [ %12, %43 ], [ %12, %41 ], [ %12, %39 ], [ %12, %37 ], [ %12, %35 ], [ %12, %33 ], [ %12, %6 ]
%26 = phi i8* [ %13, %51 ], [ %13, %49 ], [ %13, %47 ], [ %46, %45 ], [ %13, %43 ], [ %13, %41 ], [ %13, %39 ], [ %13, %37 ], [ %13, %35 ], [ %13, %33 ], [ %13, %6 ]
%27 = phi i8* [ %14, %51 ], [ %14, %49 ], [ %14, %47 ], [ %14, %45 ], [ %44, %43 ], [ %14, %41 ], [ %14, %39 ], [ %14, %37 ], [ %14, %35 ], [ %14, %33 ], [ %14, %6 ]
%28 = phi i8* [ %15, %51 ], [ %15, %49 ], [ %48, %47 ], [ %15, %45 ], [ %15, %43 ], [ %15, %41 ], [ %15, %39 ], [ %15, %37 ], [ %15, %35 ], [ %15, %33 ], [ %15, %6 ]
%29 = phi i32 [ %16, %51 ], [ %16, %49 ], [ %16, %47 ], [ %16, %45 ], [ %16, %43 ], [ %16, %41 ], [ %16, %39 ], [ %16, %37 ], [ %16, %35 ], [ %16, %33 ], [ 1, %6 ]
%30 = phi i32 [ 1, %51 ], [ %17, %49 ], [ %17, %47 ], [ %17, %45 ], [ %17, %43 ], [ %17, %41 ], [ %17, %39 ], [ %17, %37 ], [ %17, %35 ], [ %17, %33 ], [ %17, %6 ]
br label %6
31: ; preds = %6
%32 = tail call i32 (...) @printUsage()
br label %87
33: ; preds = %6
%34 = load i8*, i8** @optarg
br label %19
35: ; preds = %6
%36 = load i8*, i8** @optarg
br label %19
37: ; preds = %6
%38 = load i8*, i8** @optarg
br label %19
39: ; preds = %6
%40 = load i8*, i8** @optarg
br label %19
41: ; preds = %6
%42 = load i8*, i8** @optarg
br label %19
43: ; preds = %6
%44 = load i8*, i8** @optarg
br label %19
45: ; preds = %6
%46 = load i8*, i8** @optarg
br label %19
47: ; preds = %6
%48 = load i8*, i8** @optarg
br label %19
49: ; preds = %6
%50 = load i8*, i8** @optarg
br label %19
51: ; preds = %6
br label %19
52: ; preds = %6
%53 = tail call i32 (...) @printUsage()
%54 = tail call i32 (...) @abort()
unreachable
55: ; preds = %6
%56 = icmp eq i8* %8, null
br i1 %56, label %57, label %61
57: ; preds = %55
%58 = load i32, i32* @stderr
%59 = tail call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
%60 = tail call i32 @exit(i32 1)
unreachable
61: ; preds = %55
%62 = icmp eq i8* %7, null
%63 = icmp ne i8* %9, null
%64 = select i1 %62, i1 %63, i1 false
br i1 %64, label %69, label %65
65: ; preds = %61
%66 = icmp ne i8* %7, null
%67 = icmp eq i8* %9, null
%68 = select i1 %66, i1 %67, i1 false
br i1 %68, label %69, label %73
69: ; preds = %65, %61
%70 = load i32, i32* @stderr
%71 = tail call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%72 = tail call i32 @exit(i32 1)
unreachable
73: ; preds = %65
%74 = select i1 %62, i1 %67, i1 false
br i1 %74, label %75, label %77
75: ; preds = %73
%76 = tail call i32 @coord_transform(i8* %8, i32 %17)
br label %87
77: ; preds = %73
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%79 = icmp eq i32 %16, 0
br i1 %79, label %82, label %80
80: ; preds = %77
%81 = tail call i32 @raster_transform(i8* %7, i8* %8, i8* %9, i8* %10, i32 %17)
br label %84
82: ; preds = %77
%83 = tail call i32 @vector_transform(i8* %7, i8* %11, i8* %14, i8* %15, i8* %8, i8* %9, i8* %13, i8* %10, i8* %12, i32 %17)
br label %84
84: ; preds = %82, %80
%85 = phi i32 [ %81, %80 ], [ %83, %82 ]
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0))
br label %87
87: ; preds = %6, %84, %75, %31, %4
%88 = phi i32 [ 0, %4 ], [ %76, %75 ], [ %85, %84 ], [ 0, %31 ], [ 1, %6 ]
ret i32 %88
}