#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 EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stderr;
int test_canonicalize_path(char *, char *);
int test_do_dirname(char *, char *);
int main(void) {
  do {
    int __my_ret__ = test_canonicalize_path("", NULL);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 42,
              "test_canonicalize_path(\"\", NULL)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("./foo", NULL);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 43,
              "test_canonicalize_path(\"./foo\", NULL)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("/tmp//foo", "/tmp/foo");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 44,
              "test_canonicalize_path(\"/tmp//foo\", \"/tmp/foo\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("////tmp/////foo/", "/tmp/foo");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 45,
              "test_canonicalize_path(\"////tmp/////foo/\", \"/tmp/foo\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("/tmp/foo", "/tmp/foo");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 46,
              "test_canonicalize_path(\"/tmp/foo\", \"/tmp/foo\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("/long/path/that/ends/in/a/slash/",
                                            "/long/path/that/ends/in/a/slash");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 47,
              "test_canonicalize_path(\"/long/path/that/ends/in/a/slash/\", "
              "\"/long/path/that/ends/in/a/slash\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_canonicalize_path("/", "/");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 49,
              "test_canonicalize_path(\"/\", \"/\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_do_dirname("/", "/");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 51,
              "test_do_dirname(\"/\", \"/\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_do_dirname("/tmp/foo", "/tmp");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 52,
              "test_do_dirname(\"/tmp/foo\", \"/tmp\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_do_dirname("/longer/path/here", "/longer/path");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 53,
              "test_do_dirname(\"/longer/path/here\", \"/longer/path\")");
      return __my_ret__;
    }
  } while (0);
  ;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1188 <main+0x58>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
mov    $0x2a,%edx
lea    0xe9f(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    118d <main+0x5d>
jmp    1192 <main+0x62>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11db <main+0xab>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x2b,%edx
lea    0xe73(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    11e0 <main+0xb0>
jmp    11e5 <main+0xb5>
lea    0xe78(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1231 <main+0x101>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
mov    $0x2c,%edx
lea    0xe56(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    1236 <main+0x106>
jmp    123b <main+0x10b>
lea    0xe65(%rip),%rdi
lea    0xe25(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1287 <main+0x157>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
lea    0xd95(%rip),%rsi
mov    $0x2d,%edx
lea    0xe41(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    128c <main+0x15c>
jmp    1291 <main+0x161>
lea    0xdd6(%rip),%rsi
mov    %rsi,%rdi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     12d9 <main+0x1a9>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
lea    0xd43(%rip),%rsi
mov    $0x2e,%edx
lea    0xe26(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    12de <main+0x1ae>
jmp    12e3 <main+0x1b3>
lea    0xe34(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     132f <main+0x1ff>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
lea    0xced(%rip),%rsi
mov    $0x2f,%edx
lea    0xe40(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    1334 <main+0x204>
jmp    1339 <main+0x209>
lea    0xdfd(%rip),%rsi
mov    %rsi,%rdi
call   1050 <test_canonicalize_path@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1381 <main+0x251>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
lea    0xc9b(%rip),%rsi
mov    $0x31,%edx
lea    0xe4c(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    1386 <main+0x256>
jmp    138b <main+0x25b>
lea    0xdab(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_do_dirname@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     13d3 <main+0x2a3>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
lea    0xc49(%rip),%rsi
mov    $0x33,%edx
lea    0xe1b(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    13d8 <main+0x2a8>
jmp    13dd <main+0x2ad>
lea    0xc8a(%rip),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <test_do_dirname@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1429 <main+0x2f9>
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
lea    0xbf3(%rip),%rsi
mov    $0x34,%edx
lea    0xde4(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    142e <main+0x2fe>
jmp    1433 <main+0x303>
lea    0xde7(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   1030 <test_do_dirname@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     147f <main+0x34f>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
lea    0xb9d(%rip),%rsi
mov    $0x35,%edx
lea    0xdd1(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1490 <main+0x360>
jmp    1484 <main+0x354>
mov    0x2b4d(%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   %rbx
lea    0xede(%rip),%rdi
xor    %esi,%esi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     116b <main+0x3b>
mov    %eax,%ebx
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
lea    0xebb(%rip),%rcx
mov    $0x2a,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xec6(%rip),%rdi
xor    %esi,%esi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     11a5 <main+0x75>
mov    %eax,%ebx
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
lea    0xea8(%rip),%rcx
mov    $0x2b,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xeb8(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     11e4 <main+0xb4>
mov    %eax,%ebx
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe32(%rip),%rsi
lea    0xea2(%rip),%rcx
mov    $0x2c,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xebc(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     1223 <main+0xf3>
mov    %eax,%ebx
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
lea    0xea4(%rip),%rcx
mov    $0x2d,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xe44(%rip),%rdi
mov    %rdi,%rsi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     125e <main+0x12e>
mov    %eax,%ebx
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
lea    0xea0(%rip),%rcx
mov    $0x2e,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xeb9(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     129d <main+0x16d>
mov    %eax,%ebx
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
lea    0xed1(%rip),%rcx
mov    $0x2f,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xe99(%rip),%rdi
mov    %rdi,%rsi
call   1050 <test_canonicalize_path@plt>
test   %eax,%eax
je     12d8 <main+0x1a8>
mov    %eax,%ebx
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
lea    0xef4(%rip),%rcx
mov    $0x31,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xe5e(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_do_dirname@plt>
test   %eax,%eax
je     1313 <main+0x1e3>
mov    %eax,%ebx
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
lea    0xd03(%rip),%rsi
lea    0xeda(%rip),%rcx
mov    $0x33,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xd54(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <test_do_dirname@plt>
test   %eax,%eax
je     134f <main+0x21f>
mov    %eax,%ebx
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
lea    0xcc4(%rip),%rsi
lea    0xeba(%rip),%rcx
mov    $0x34,%edx
call   1040 <fprintf@plt>
jmp    1396 <main+0x266>
lea    0xecb(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <test_do_dirname@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1389 <main+0x259>
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
lea    0xc88(%rip),%rsi
lea    0xec1(%rip),%rcx
mov    $0x35,%edx
call   1040 <fprintf@plt>
test   %ebx,%ebx
jne    1396 <main+0x266>
mov    0x2c44(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.2 = [33 x i8] c"test_canonicalize_path(\22\22, NULL)\00"
@.str.3 = [6 x i8] c"./foo\00"
@.str.4 = [38 x i8] c"test_canonicalize_path(\22./foo\22, NULL)\00"
@.str.5 = [10 x i8] c"/tmp//foo\00"
@.str.6 = [9 x i8] c"/tmp/foo\00"
@.str.7 = [48 x i8] c"test_canonicalize_path(\22/tmp//foo\22, \22/tmp/foo\22)\00"
@.str.8 = [17 x i8] c"////tmp/////foo/\00"
@.str.9 = [55 x i8] c"test_canonicalize_path(\22////tmp/////foo/\22, \22/tmp/foo\22)\00"
@.str.10 = [47 x i8] c"test_canonicalize_path(\22/tmp/foo\22, \22/tmp/foo\22)\00"
@.str.11 = [33 x i8] c"/long/path/that/ends/in/a/slash/\00"
@.str.12 = [32 x i8] c"/long/path/that/ends/in/a/slash\00"
@.str.13 = [94 x i8] c"test_canonicalize_path(\22/long/path/that/ends/in/a/slash/\22, \22/long/path/that/ends/in/a/slash\22)\00"
@.str.14 = [2 x i8] c"/\00"
@.str.15 = [33 x i8] c"test_canonicalize_path(\22/\22, \22/\22)\00"
@.str.16 = [26 x i8] c"test_do_dirname(\22/\22, \22/\22)\00"
@.str.17 = [5 x i8] c"/tmp\00"
@.str.18 = [36 x i8] c"test_do_dirname(\22/tmp/foo\22, \22/tmp\22)\00"
@.str.19 = [18 x i8] c"/longer/path/here\00"
@.str.20 = [13 x i8] c"/longer/path\00"
@.str.21 = [53 x i8] c"test_do_dirname(\22/longer/path/here\22, \22/longer/path\22)\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
br label %12
12: ; preds = %0
%13 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* null)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* %2
store i32 %19, i32* %1
br label %113
20: ; preds = %12
br label %21
21: ; preds = %20
br label %22
22: ; preds = %21
%23 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32, i32* %3
store i32 %29, i32* %1
br label %113
30: ; preds = %22
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 %33, i32* %4
%34 = load i32, i32* %4
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0))
%39 = load i32, i32* %4
store i32 %39, i32* %1
br label %113
40: ; preds = %32
br label %41
41: ; preds = %40
br label %42
42: ; preds = %41
%43 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 %43, i32* %5
%44 = load i32, i32* %5
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0))
%49 = load i32, i32* %5
store i32 %49, i32* %1
br label %113
50: ; preds = %42
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51
%53 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 %53, i32* %6
%54 = load i32, i32* %6
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0))
%59 = load i32, i32* %6
store i32 %59, i32* %1
br label %113
60: ; preds = %52
br label %61
61: ; preds = %60
br label %62
62: ; preds = %61
%63 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
store i32 %63, i32* %7
%64 = load i32, i32* %7
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 47, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.13, i64 0, i64 0))
%69 = load i32, i32* %7
store i32 %69, i32* %1
br label %113
70: ; preds = %62
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
%73 = call i32 @test_canonicalize_path(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 %73, i32* %8
%74 = load i32, i32* %8
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.15, i64 0, i64 0))
%79 = load i32, i32* %8
store i32 %79, i32* %1
br label %113
80: ; preds = %72
br label %81
81: ; preds = %80
br label %82
82: ; preds = %81
%83 = call i32 @test_do_dirname(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 %83, i32* %9
%84 = load i32, i32* %9
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %82
%87 = load i32, i32* @stderr
%88 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0))
%89 = load i32, i32* %9
store i32 %89, i32* %1
br label %113
90: ; preds = %82
br label %91
91: ; preds = %90
br label %92
92: ; preds = %91
%93 = call i32 @test_do_dirname(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
store i32 %93, i32* %10
%94 = load i32, i32* %10
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %92
%97 = load i32, i32* @stderr
%98 = call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
%99 = load i32, i32* %10
store i32 %99, i32* %1
br label %113
100: ; preds = %92
br label %101
101: ; preds = %100
br label %102
102: ; preds = %101
%103 = call i32 @test_do_dirname(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
store i32 %103, i32* %11
%104 = load i32, i32* %11
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %110
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.21, i64 0, i64 0))
%109 = load i32, i32* %11
store i32 %109, i32* %1
br label %113
110: ; preds = %102
br label %111
111: ; preds = %110
%112 = load i32, i32* @EXIT_SUCCESS
store i32 %112, i32* %1
br label %113
113: ; preds = %111, %106, %96, %86, %76, %66, %56, %46, %36, %26, %16
%114 = load i32, i32* %1
ret i32 %114
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.2 = [33 x i8] c"test_canonicalize_path(\22\22, NULL)\00"
@.str.3 = [6 x i8] c"./foo\00"
@.str.4 = [38 x i8] c"test_canonicalize_path(\22./foo\22, NULL)\00"
@.str.5 = [10 x i8] c"/tmp//foo\00"
@.str.6 = [9 x i8] c"/tmp/foo\00"
@.str.7 = [48 x i8] c"test_canonicalize_path(\22/tmp//foo\22, \22/tmp/foo\22)\00"
@.str.8 = [17 x i8] c"////tmp/////foo/\00"
@.str.9 = [55 x i8] c"test_canonicalize_path(\22////tmp/////foo/\22, \22/tmp/foo\22)\00"
@.str.10 = [47 x i8] c"test_canonicalize_path(\22/tmp/foo\22, \22/tmp/foo\22)\00"
@.str.11 = [33 x i8] c"/long/path/that/ends/in/a/slash/\00"
@.str.12 = [32 x i8] c"/long/path/that/ends/in/a/slash\00"
@.str.13 = [94 x i8] c"test_canonicalize_path(\22/long/path/that/ends/in/a/slash/\22, \22/long/path/that/ends/in/a/slash\22)\00"
@.str.14 = [2 x i8] c"/\00"
@.str.15 = [33 x i8] c"test_canonicalize_path(\22/\22, \22/\22)\00"
@.str.16 = [26 x i8] c"test_do_dirname(\22/\22, \22/\22)\00"
@.str.17 = [5 x i8] c"/tmp\00"
@.str.18 = [36 x i8] c"test_do_dirname(\22/tmp/foo\22, \22/tmp\22)\00"
@.str.19 = [18 x i8] c"/longer/path/here\00"
@.str.20 = [13 x i8] c"/longer/path\00"
@.str.21 = [53 x i8] c"test_do_dirname(\22/longer/path/here\22, \22/longer/path\22)\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* null)
%2 = icmp eq i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %63
6: ; preds = %0
%7 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %63
12: ; preds = %6
%13 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0))
br label %63
18: ; preds = %12
%19 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0))
br label %63
24: ; preds = %18
%25 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0))
br label %63
30: ; preds = %24
%31 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = tail call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 47, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.13, i64 0, i64 0))
br label %63
36: ; preds = %30
%37 = tail call i32 @test_canonicalize_path(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = tail call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.15, i64 0, i64 0))
br label %63
42: ; preds = %36
%43 = tail call i32 @test_do_dirname(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0))
br label %63
48: ; preds = %42
%49 = tail call i32 @test_do_dirname(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
%50 = icmp eq i32 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = load i32, i32* @stderr
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
br label %63
54: ; preds = %48
%55 = tail call i32 @test_do_dirname(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
%56 = icmp eq i32 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = tail call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.21, i64 0, i64 0))
br label %60
60: ; preds = %54, %57
%61 = load i32, i32* @EXIT_SUCCESS
%62 = select i1 %56, i32 %61, i32 %55
br label %63
63: ; preds = %51, %45, %39, %33, %27, %21, %15, %9, %3, %60
%64 = phi i32 [ %1, %3 ], [ %7, %9 ], [ %13, %15 ], [ %19, %21 ], [ %25, %27 ], [ %31, %33 ], [ %37, %39 ], [ %43, %45 ], [ %49, %51 ], [ %62, %60 ]
ret i32 %64
}