#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 stat {
  int st_size;
  int st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ F_OK;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ access_test(char *, int /*<<< orphan*/);
int /*<<< orphan*/ close_test(int);
int expect_gez(int /*<<< orphan*/, int);
int expect_val(int, int);
int expect_zng(int, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ link_test(char *, char *);
int /*<<< orphan*/ lstat_test(char *, struct stat *);
int open_test(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int readlink_test(char *, char *, int);
int /*<<< orphan*/ stat_test(char *, struct stat *);
int /*<<< orphan*/ symlink_test(char *, char *);
int /*<<< orphan*/ testbreak();
int /*<<< orphan*/ unlink_test(char *);
int /*<<< orphan*/ xtmpnam(char *);
int BasicLink(void) {
  char tf[8192] = {0};
  char slink[8192] = {0};
  char hlink[8192] = {0};
  char readlink[8192] = {0};
  int fd;
  int passed;
  int block = 0;
  struct stat buf;
  struct stat buf2;
  int ls;
  xtmpnam(tf);
  xtmpnam(slink);
  xtmpnam(hlink);
  testbreak();
  passed =
      expect_gez(0, fd = open_test(tf, O_RDWR | O_TRUNC | O_CREAT, S_IRWXU));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(0, close_test(fd));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, symlink_test(tf, slink));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_gez(0, ls = readlink_test(slink, readlink, 8192));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, lstat_test(slink, &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_val(ls, buf.st_size);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(slink, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, lstat_test(slink, &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(slink));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(slink, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, lstat_test(slink, &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed =
      expect_gez(0, fd = open_test(tf, O_RDWR | O_TRUNC | O_CREAT, S_IRWXU));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(0, close_test(fd));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, link_test(tf, hlink));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(0, stat_test(tf, &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, lstat_test(hlink, &buf2));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_val(buf.st_size, buf2.st_size);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_val(buf.st_mode, buf2.st_mode);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, access_test(hlink, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, stat_test(hlink, &buf2));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_val(buf2.st_mode, buf.st_mode);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(hlink));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(hlink, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  return block;
}


x86 assembly (clang, -O0):
<BasicLink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8040,%rsp
lea    -0x2010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
lea    -0x4010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
lea    -0x6010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
lea    -0x8010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
movl   $0x0,-0x801c(%rbp)
lea    -0x2010(%rbp),%rdi
call   1030 <xtmpnam@plt>
lea    -0x4010(%rbp),%rdi
call   1030 <xtmpnam@plt>
lea    -0x6010(%rbp),%rdi
call   1030 <xtmpnam@plt>
mov    $0x0,%al
call   10c0 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
mov    0x2d3d(%rip),%rax
or     (%rax),%esi
mov    0x2d3c(%rip),%rax
or     (%rax),%esi
mov    0x2d13(%rip),%rax
mov    (%rax),%edx
call   1090 <open_test@plt>
mov    %eax,%esi
mov    %esi,-0x8014(%rbp)
xor    %edi,%edi
call   1120 <expect_gez@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     130d <BasicLink+0xfd>
lea    0xd0b(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x8018(%rbp)
jne    133d <BasicLink+0x12d>
lea    0xd15(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
mov    -0x8018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1bc4 <BasicLink+0x9b4>
mov    -0x8014(%rbp),%edi
call   1050 <close_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1383 <BasicLink+0x173>
lea    0xc95(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
lea    -0x4010(%rbp),%rsi
call   1130 <symlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     13d1 <BasicLink+0x1c1>
lea    0xc47(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x8018(%rbp)
jne    1401 <BasicLink+0x1f1>
lea    0xc51(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
mov    -0x8018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1bc4 <BasicLink+0x9b4>
lea    -0x4010(%rbp),%rdi
lea    -0x8010(%rbp),%rsi
mov    $0x2000,%edx
call   1110 <readlink_test@plt>
mov    %eax,%esi
mov    %esi,-0x8034(%rbp)
xor    %edi,%edi
call   1120 <expect_gez@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     145a <BasicLink+0x24a>
lea    0xbbe(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
lea    -0x8028(%rbp),%rsi
call   1080 <lstat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     14a8 <BasicLink+0x298>
lea    0xb70(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    -0x8034(%rbp),%edi
mov    -0x8028(%rbp),%esi
call   10d0 <expect_val@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     14eb <BasicLink+0x2db>
lea    0xb2d(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10e0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1532 <BasicLink+0x322>
lea    0xae6(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
mov    0x2a78(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1585 <BasicLink+0x375>
lea    0xa93(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
mov    0x2a25(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     15d8 <BasicLink+0x3c8>
lea    0xa40(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
lea    -0x8028(%rbp),%rsi
call   1080 <lstat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1626 <BasicLink+0x416>
lea    0x9f2(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
call   10e0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     166d <BasicLink+0x45d>
lea    0x9ab(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
mov    0x293d(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     16c0 <BasicLink+0x4b0>
lea    0x958(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x4010(%rbp),%rdi
lea    -0x8028(%rbp),%rsi
call   1080 <lstat_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1711 <BasicLink+0x501>
lea    0x907(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    $0x0,%al
call   10c0 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x28aa(%rip),%rax
mov    (%rax),%esi
mov    0x28c1(%rip),%rax
or     (%rax),%esi
mov    0x28c0(%rip),%rax
or     (%rax),%esi
mov    0x2897(%rip),%rax
mov    (%rax),%edx
call   1090 <open_test@plt>
mov    %eax,%esi
mov    %esi,-0x8014(%rbp)
xor    %edi,%edi
call   1120 <expect_gez@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1789 <BasicLink+0x579>
lea    0x88f(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x8018(%rbp)
jne    17b9 <BasicLink+0x5a9>
lea    0x899(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
mov    -0x8018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1bc4 <BasicLink+0x9b4>
mov    -0x8014(%rbp),%edi
call   1050 <close_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     17ff <BasicLink+0x5ef>
lea    0x819(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
lea    -0x6010(%rbp),%rsi
call   1040 <link_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     184d <BasicLink+0x63d>
lea    0x7cb(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x8018(%rbp)
jne    187d <BasicLink+0x66d>
lea    0x7d5(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
mov    -0x8018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1bc4 <BasicLink+0x9b4>
lea    -0x2010(%rbp),%rdi
lea    -0x8028(%rbp),%rsi
call   1100 <stat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     18cb <BasicLink+0x6bb>
lea    0x74d(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x6010(%rbp),%rdi
lea    -0x8030(%rbp),%rsi
call   1080 <lstat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1919 <BasicLink+0x709>
lea    0x6ff(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    -0x8028(%rbp),%edi
mov    -0x8030(%rbp),%esi
call   10d0 <expect_val@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     195c <BasicLink+0x74c>
lea    0x6bc(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    -0x8024(%rbp),%edi
mov    -0x802c(%rbp),%esi
call   10d0 <expect_val@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     199f <BasicLink+0x78f>
lea    0x679(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10e0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     19e6 <BasicLink+0x7d6>
lea    0x632(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
mov    0x25c4(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1a39 <BasicLink+0x829>
lea    0x5df(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x6010(%rbp),%rdi
mov    0x2571(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1a89 <BasicLink+0x879>
lea    0x58f(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x6010(%rbp),%rdi
lea    -0x8030(%rbp),%rsi
call   1100 <stat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1ad7 <BasicLink+0x8c7>
lea    0x541(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    -0x802c(%rbp),%edi
mov    -0x8024(%rbp),%esi
call   10d0 <expect_val@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1b1a <BasicLink+0x90a>
lea    0x4fe(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x6010(%rbp),%rdi
call   10e0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1b61 <BasicLink+0x951>
lea    0x4b7(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
lea    -0x6010(%rbp),%rdi
mov    0x2449(%rip),%rax
mov    (%rax),%esi
call   10f0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   10a0 <expect_zng@plt>
mov    %eax,-0x8018(%rbp)
cmpl   $0x0,-0x8018(%rbp)
je     1bb4 <BasicLink+0x9a4>
lea    0x464(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <fflush@plt>
movl   $0xffffffff,-0x801c(%rbp)
ff ff ff
mov    $0x0,%al
call   10c0 <testbreak@plt>
mov    -0x801c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BasicLink>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8018,%rsp
lea    0x2010(%rsp),%r15
xor    %r14d,%r14d
mov    $0x2000,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x10(%rsp),%rbx
mov    $0x2000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x4010(%rsp),%rbp
mov    $0x2000,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x6010(%rsp),%rdi
mov    $0x2000,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    %r15,%rdi
call   1040 <xtmpnam@plt>
mov    %rbx,%rdi
call   1040 <xtmpnam@plt>
mov    %rbp,%rdi
call   1040 <xtmpnam@plt>
xor    %eax,%eax
call   10c0 <testbreak@plt>
mov    0x2d30(%rip),%rax
mov    0x2d49(%rip),%r13
mov    0x0(%r13),%esi
or     (%rax),%esi
mov    0x2d44(%rip),%rax
or     (%rax),%esi
mov    0x2d1b(%rip),%r12
mov    (%r12),%edx
mov    %r15,%rdi
call   1090 <open_test@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %eax,%esi
call   1120 <expect_gez@plt>
test   %eax,%eax
je     12fc <BasicLink+0xec>
mov    %eax,%ebx
lea    0xd5c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     188b <BasicLink+0x67b>
mov    %ebp,%edi
call   1060 <close_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1329 <BasicLink+0x119>
lea    0xd26(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x2010(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1130 <symlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     136c <BasicLink+0x15c>
mov    %eax,%ebx
lea    0xcec(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     188b <BasicLink+0x67b>
lea    0x10(%rsp),%rdi
lea    0x6010(%rsp),%rsi
mov    $0x2000,%edx
call   1110 <readlink_test@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %eax,%esi
call   1120 <expect_gez@plt>
test   %eax,%eax
je     13ab <BasicLink+0x19b>
lea    0xca4(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <lstat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     13de <BasicLink+0x1ce>
lea    0xc71(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%rsp),%esi
mov    %ebp,%edi
call   10d0 <expect_val@plt>
test   %eax,%eax
je     1405 <BasicLink+0x1f5>
lea    0xc4a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x2010(%rsp),%rdi
call   10e0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1438 <BasicLink+0x228>
lea    0xc17(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    0x2b79(%rip),%r15
mov    (%r15),%esi
lea    0x2010(%rsp),%rdi
call   10f0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1478 <BasicLink+0x268>
lea    0xbd7(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
lea    0x10(%rsp),%rdi
call   10f0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     14ae <BasicLink+0x29e>
lea    0xba1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <lstat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     14e1 <BasicLink+0x2d1>
lea    0xb6e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x10(%rsp),%rdi
call   10e0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1511 <BasicLink+0x301>
lea    0xb3e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
lea    0x10(%rsp),%rdi
call   10f0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1547 <BasicLink+0x337>
lea    0xb08(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <lstat_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     157d <BasicLink+0x36d>
lea    0xad2(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   10c0 <testbreak@plt>
mov    0x0(%r13),%esi
mov    0x2a41(%rip),%rax
or     (%rax),%esi
mov    0x2a60(%rip),%rax
or     (%rax),%esi
mov    (%r12),%edx
lea    0x2010(%rsp),%rdi
call   1090 <open_test@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %eax,%esi
call   1120 <expect_gez@plt>
test   %eax,%eax
je     15de <BasicLink+0x3ce>
mov    %eax,%ebx
lea    0xa7a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     188b <BasicLink+0x67b>
mov    %ebp,%edi
call   1060 <close_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     160b <BasicLink+0x3fb>
lea    0xa44(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x2010(%rsp),%rdi
lea    0x4010(%rsp),%rsi
call   1050 <link_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1651 <BasicLink+0x441>
mov    %eax,%ebx
lea    0xa07(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     188b <BasicLink+0x67b>
lea    0x2010(%rsp),%rdi
mov    %rsp,%rsi
call   1100 <stat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1687 <BasicLink+0x477>
lea    0x9c8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x4010(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1080 <lstat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     16bf <BasicLink+0x4af>
lea    0x990(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%rsp),%edi
mov    0x8(%rsp),%esi
call   10d0 <expect_val@plt>
test   %eax,%eax
je     16e8 <BasicLink+0x4d8>
lea    0x967(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    0x4(%rsp),%edi
mov    0xc(%rsp),%esi
call   10d0 <expect_val@plt>
test   %eax,%eax
je     1712 <BasicLink+0x502>
lea    0x93d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x2010(%rsp),%rdi
call   10e0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1745 <BasicLink+0x535>
lea    0x90a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
lea    0x2010(%rsp),%rdi
call   10f0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     177e <BasicLink+0x56e>
lea    0x8d1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
lea    0x4010(%rsp),%rdi
call   10f0 <access_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     17b4 <BasicLink+0x5a4>
lea    0x89b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x4010(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1100 <stat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     17ec <BasicLink+0x5dc>
lea    0x863(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    0xc(%rsp),%edi
mov    0x4(%rsp),%esi
call   10d0 <expect_val@plt>
test   %eax,%eax
je     1816 <BasicLink+0x606>
lea    0x839(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
lea    0x4010(%rsp),%rdi
call   10e0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1849 <BasicLink+0x639>
lea    0x806(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
lea    0x4010(%rsp),%rdi
call   10f0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   10a0 <expect_zng@plt>
test   %eax,%eax
je     1882 <BasicLink+0x672>
lea    0x7cd(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   10c0 <testbreak@plt>
jmp    18a4 <BasicLink+0x694>
lea    0x76e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@.str = [54 x i8] c"\09Failed Phase 2: This call did something unexpected.\0A\00"
@.str.1 = [62 x i8] c"\09Fail Phase 2: Aborting test because of catastrophic failure\0A\00"
@F_OK = global i32 0
define i32 @BasicLink() {
%1 = alloca i32
%2 = alloca [8192 x i8]
%3 = alloca [8192 x i8]
%4 = alloca [8192 x i8]
%5 = alloca [8192 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.stat
%10 = alloca %struct.stat
%11 = alloca i32
%12 = bitcast [8192 x i8]* %2 to i8*
%13 = bitcast [8192 x i8]* %3 to i8*
%14 = bitcast [8192 x i8]* %4 to i8*
%15 = bitcast [8192 x i8]* %5 to i8*
store i32 0, i32* %8
%16 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%17 = call i32 @xtmpnam(i8* %16)
%18 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%19 = call i32 @xtmpnam(i8* %18)
%20 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%21 = call i32 @xtmpnam(i8* %20)
%22 = call i32 (...) @testbreak()
%23 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%24 = load i32, i32* @O_RDWR
%25 = load i32, i32* @O_TRUNC
%26 = or i32 %24, %25
%27 = load i32, i32* @O_CREAT
%28 = or i32 %26, %27
%29 = load i32, i32* @S_IRWXU
%30 = call i32 @open_test(i8* %23, i32 %28, i32 %29)
store i32 %30, i32* %6
%31 = call i32 @expect_gez(i32 0, i32 %30)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %0
%35 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%36 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %37
37: ; preds = %34, %0
%38 = load i32, i32* %7
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @fflush(i32* null)
%43 = load i32, i32* %7
store i32 %43, i32* %1
br label %325
44: ; preds = %37
%45 = load i32, i32* %6
%46 = call i32 @close_test(i32 %45)
%47 = call i32 @expect_zng(i32 0, i32 %46)
store i32 %47, i32* %7
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%52 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %53
53: ; preds = %50, %44
%54 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%55 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%56 = call i32 @symlink_test(i8* %54, i8* %55)
%57 = call i32 @expect_zng(i32 0, i32 %56)
store i32 %57, i32* %7
%58 = load i32, i32* %7
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %53
%61 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %63
63: ; preds = %60, %53
%64 = load i32, i32* %7
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%68 = call i32 @fflush(i32* null)
%69 = load i32, i32* %7
store i32 %69, i32* %1
br label %325
70: ; preds = %63
%71 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%72 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%73 = call i32 @readlink_test(i8* %71, i8* %72, i32 8192)
store i32 %73, i32* %11
%74 = call i32 @expect_gez(i32 0, i32 %73)
store i32 %74, i32* %7
%75 = load i32, i32* %7
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %70
%78 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%79 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %80
80: ; preds = %77, %70
%81 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%82 = call i32 @lstat_test(i8* %81, %struct.stat* %9)
%83 = call i32 @expect_zng(i32 0, i32 %82)
store i32 %83, i32* %7
%84 = load i32, i32* %7
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %80
%87 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%88 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %89
89: ; preds = %86, %80
%90 = load i32, i32* %11
%91 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%92 = load i32, i32* %91
%93 = call i32 @expect_val(i32 %90, i32 %92)
store i32 %93, i32* %7
%94 = load i32, i32* %7
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %89
%97 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%98 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %99
99: ; preds = %96, %89
%100 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%101 = call i32 @unlink_test(i8* %100)
%102 = call i32 @expect_zng(i32 0, i32 %101)
store i32 %102, i32* %7
%103 = load i32, i32* %7
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %99
%106 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%107 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %108
108: ; preds = %105, %99
%109 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%110 = load i32, i32* @F_OK
%111 = call i32 @access_test(i8* %109, i32 %110)
%112 = call i32 @expect_zng(i32 -1, i32 %111)
store i32 %112, i32* %7
%113 = load i32, i32* %7
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %108
%116 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%117 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %118
118: ; preds = %115, %108
%119 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%120 = load i32, i32* @F_OK
%121 = call i32 @access_test(i8* %119, i32 %120)
%122 = call i32 @expect_zng(i32 -1, i32 %121)
store i32 %122, i32* %7
%123 = load i32, i32* %7
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %128
125: ; preds = %118
%126 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%127 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %128
128: ; preds = %125, %118
%129 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%130 = call i32 @lstat_test(i8* %129, %struct.stat* %9)
%131 = call i32 @expect_zng(i32 0, i32 %130)
store i32 %131, i32* %7
%132 = load i32, i32* %7
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %128
%135 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%136 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %137
137: ; preds = %134, %128
%138 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%139 = call i32 @unlink_test(i8* %138)
%140 = call i32 @expect_zng(i32 0, i32 %139)
store i32 %140, i32* %7
%141 = load i32, i32* %7
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %146
143: ; preds = %137
%144 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%145 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %146
146: ; preds = %143, %137
%147 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%148 = load i32, i32* @F_OK
%149 = call i32 @access_test(i8* %147, i32 %148)
%150 = call i32 @expect_zng(i32 -1, i32 %149)
store i32 %150, i32* %7
%151 = load i32, i32* %7
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %156
153: ; preds = %146
%154 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%155 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %156
156: ; preds = %153, %146
%157 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%158 = call i32 @lstat_test(i8* %157, %struct.stat* %9)
%159 = call i32 @expect_zng(i32 -1, i32 %158)
store i32 %159, i32* %7
%160 = load i32, i32* %7
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %165
162: ; preds = %156
%163 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%164 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %165
165: ; preds = %162, %156
%166 = call i32 (...) @testbreak()
%167 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%168 = load i32, i32* @O_RDWR
%169 = load i32, i32* @O_TRUNC
%170 = or i32 %168, %169
%171 = load i32, i32* @O_CREAT
%172 = or i32 %170, %171
%173 = load i32, i32* @S_IRWXU
%174 = call i32 @open_test(i8* %167, i32 %172, i32 %173)
store i32 %174, i32* %6
%175 = call i32 @expect_gez(i32 0, i32 %174)
store i32 %175, i32* %7
%176 = load i32, i32* %7
%177 = icmp ne i32 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %165
%179 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%180 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %181
181: ; preds = %178, %165
%182 = load i32, i32* %7
%183 = icmp eq i32 %182, -1
br i1 %183, label %184, label %188
184: ; preds = %181
%185 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%186 = call i32 @fflush(i32* null)
%187 = load i32, i32* %7
store i32 %187, i32* %1
br label %325
188: ; preds = %181
%189 = load i32, i32* %6
%190 = call i32 @close_test(i32 %189)
%191 = call i32 @expect_zng(i32 0, i32 %190)
store i32 %191, i32* %7
%192 = load i32, i32* %7
%193 = icmp ne i32 %192, 0
br i1 %193, label %194, label %197
194: ; preds = %188
%195 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%196 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %197
197: ; preds = %194, %188
%198 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%199 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%200 = call i32 @link_test(i8* %198, i8* %199)
%201 = call i32 @expect_zng(i32 0, i32 %200)
store i32 %201, i32* %7
%202 = load i32, i32* %7
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %207
204: ; preds = %197
%205 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%206 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %207
207: ; preds = %204, %197
%208 = load i32, i32* %7
%209 = icmp eq i32 %208, -1
br i1 %209, label %210, label %214
210: ; preds = %207
%211 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%212 = call i32 @fflush(i32* null)
%213 = load i32, i32* %7
store i32 %213, i32* %1
br label %325
214: ; preds = %207
%215 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%216 = call i32 @stat_test(i8* %215, %struct.stat* %9)
%217 = call i32 @expect_zng(i32 0, i32 %216)
store i32 %217, i32* %7
%218 = load i32, i32* %7
%219 = icmp ne i32 %218, 0
br i1 %219, label %220, label %223
220: ; preds = %214
%221 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%222 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %223
223: ; preds = %220, %214
%224 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%225 = call i32 @lstat_test(i8* %224, %struct.stat* %10)
%226 = call i32 @expect_zng(i32 0, i32 %225)
store i32 %226, i32* %7
%227 = load i32, i32* %7
%228 = icmp ne i32 %227, 0
br i1 %228, label %229, label %232
229: ; preds = %223
%230 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%231 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %232
232: ; preds = %229, %223
%233 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%234 = load i32, i32* %233
%235 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%236 = load i32, i32* %235
%237 = call i32 @expect_val(i32 %234, i32 %236)
store i32 %237, i32* %7
%238 = load i32, i32* %7
%239 = icmp ne i32 %238, 0
br i1 %239, label %240, label %243
240: ; preds = %232
%241 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%242 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %243
243: ; preds = %240, %232
%244 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 1
%245 = load i32, i32* %244
%246 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%247 = load i32, i32* %246
%248 = call i32 @expect_val(i32 %245, i32 %247)
store i32 %248, i32* %7
%249 = load i32, i32* %7
%250 = icmp ne i32 %249, 0
br i1 %250, label %251, label %254
251: ; preds = %243
%252 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%253 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %254
254: ; preds = %251, %243
%255 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%256 = call i32 @unlink_test(i8* %255)
%257 = call i32 @expect_zng(i32 0, i32 %256)
store i32 %257, i32* %7
%258 = load i32, i32* %7
%259 = icmp ne i32 %258, 0
br i1 %259, label %260, label %263
260: ; preds = %254
%261 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%262 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %263
263: ; preds = %260, %254
%264 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%265 = load i32, i32* @F_OK
%266 = call i32 @access_test(i8* %264, i32 %265)
%267 = call i32 @expect_zng(i32 -1, i32 %266)
store i32 %267, i32* %7
%268 = load i32, i32* %7
%269 = icmp ne i32 %268, 0
br i1 %269, label %270, label %273
270: ; preds = %263
%271 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%272 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %273
273: ; preds = %270, %263
%274 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%275 = load i32, i32* @F_OK
%276 = call i32 @access_test(i8* %274, i32 %275)
%277 = call i32 @expect_zng(i32 0, i32 %276)
store i32 %277, i32* %7
%278 = load i32, i32* %7
%279 = icmp ne i32 %278, 0
br i1 %279, label %280, label %283
280: ; preds = %273
%281 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%282 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %283
283: ; preds = %280, %273
%284 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%285 = call i32 @stat_test(i8* %284, %struct.stat* %10)
%286 = call i32 @expect_zng(i32 0, i32 %285)
store i32 %286, i32* %7
%287 = load i32, i32* %7
%288 = icmp ne i32 %287, 0
br i1 %288, label %289, label %292
289: ; preds = %283
%290 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%291 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %292
292: ; preds = %289, %283
%293 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%294 = load i32, i32* %293
%295 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 1
%296 = load i32, i32* %295
%297 = call i32 @expect_val(i32 %294, i32 %296)
store i32 %297, i32* %7
%298 = load i32, i32* %7
%299 = icmp ne i32 %298, 0
br i1 %299, label %300, label %303
300: ; preds = %292
%301 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%302 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %303
303: ; preds = %300, %292
%304 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%305 = call i32 @unlink_test(i8* %304)
%306 = call i32 @expect_zng(i32 0, i32 %305)
store i32 %306, i32* %7
%307 = load i32, i32* %7
%308 = icmp ne i32 %307, 0
br i1 %308, label %309, label %312
309: ; preds = %303
%310 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%311 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %312
312: ; preds = %309, %303
%313 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%314 = load i32, i32* @F_OK
%315 = call i32 @access_test(i8* %313, i32 %314)
%316 = call i32 @expect_zng(i32 -1, i32 %315)
store i32 %316, i32* %7
%317 = load i32, i32* %7
%318 = icmp ne i32 %317, 0
br i1 %318, label %319, label %322
319: ; preds = %312
%320 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%321 = call i32 @fflush(i32* null)
store i32 -1, i32* %8
br label %322
322: ; preds = %319, %312
%323 = call i32 (...) @testbreak()
%324 = load i32, i32* %8
store i32 %324, i32* %1
br label %325
325: ; preds = %322, %210, %184, %66, %40
%326 = load i32, i32* %1
ret i32 %326
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@F_OK = global i32 0
@str.30 = [61 x i8] c"\09Fail Phase 2: Aborting test because of catastrophic failure\00"
@str.31 = [53 x i8] c"\09Failed Phase 2: This call did something unexpected.\00"
define i32 @BasicLink() {
%1 = alloca [8192 x i8]
%2 = alloca [8192 x i8]
%3 = alloca [8192 x i8]
%4 = alloca [8192 x i8]
%5 = alloca %struct.stat
%6 = alloca %struct.stat
%7 = getelementptr inbounds [8192 x i8], [8192 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%11 = bitcast %struct.stat* %5 to i8*
%12 = bitcast %struct.stat* %6 to i8*
%13 = call i32 @xtmpnam(i8* %7)
%14 = call i32 @xtmpnam(i8* %8)
%15 = call i32 @xtmpnam(i8* %9)
%16 = call i32 (...) @testbreak()
%17 = load i32, i32* @O_RDWR
%18 = load i32, i32* @O_TRUNC
%19 = or i32 %18, %17
%20 = load i32, i32* @O_CREAT
%21 = or i32 %19, %20
%22 = load i32, i32* @S_IRWXU
%23 = call i32 @open_test(i8* %7, i32 %21, i32 %22)
%24 = call i32 @expect_gez(i32 0, i32 %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %0
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%28 = call i32 @fflush(i32* null)
%29 = icmp eq i32 %24, -1
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.30, i64 0, i64 0))
%32 = call i32 @fflush(i32* null)
br label %276
33: ; preds = %0, %26
%34 = phi i32 [ -1, %26 ], [ 0, %0 ]
%35 = call i32 @close_test(i32 %23)
%36 = call i32 @expect_zng(i32 0, i32 %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%40 = call i32 @fflush(i32* null)
br label %41
41: ; preds = %38, %33
%42 = phi i32 [ -1, %38 ], [ %34, %33 ]
%43 = call i32 @symlink_test(i8* %7, i8* %8)
%44 = call i32 @expect_zng(i32 0, i32 %43)
%45 = icmp eq i32 %44, 0
br i1 %45, label %53, label %46
46: ; preds = %41
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%48 = call i32 @fflush(i32* null)
%49 = icmp eq i32 %44, -1
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.30, i64 0, i64 0))
%52 = call i32 @fflush(i32* null)
br label %276
53: ; preds = %41, %46
%54 = phi i32 [ -1, %46 ], [ %42, %41 ]
%55 = call i32 @readlink_test(i8* %8, i8* %10, i32 8192)
%56 = call i32 @expect_gez(i32 0, i32 %55)
%57 = icmp eq i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %53
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%60 = call i32 @fflush(i32* null)
br label %61
61: ; preds = %58, %53
%62 = phi i32 [ -1, %58 ], [ %54, %53 ]
%63 = call i32 @lstat_test(i8* %8, %struct.stat* %5)
%64 = call i32 @expect_zng(i32 0, i32 %63)
%65 = icmp eq i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %61
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%68 = call i32 @fflush(i32* null)
br label %69
69: ; preds = %66, %61
%70 = phi i32 [ -1, %66 ], [ %62, %61 ]
%71 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%72 = load i32, i32* %71
%73 = call i32 @expect_val(i32 %55, i32 %72)
%74 = icmp eq i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %69
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%77 = call i32 @fflush(i32* null)
br label %78
78: ; preds = %75, %69
%79 = phi i32 [ -1, %75 ], [ %70, %69 ]
%80 = call i32 @unlink_test(i8* %7)
%81 = call i32 @expect_zng(i32 0, i32 %80)
%82 = icmp eq i32 %81, 0
br i1 %82, label %86, label %83
83: ; preds = %78
%84 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%85 = call i32 @fflush(i32* null)
br label %86
86: ; preds = %83, %78
%87 = phi i32 [ -1, %83 ], [ %79, %78 ]
%88 = load i32, i32* @F_OK
%89 = call i32 @access_test(i8* %7, i32 %88)
%90 = call i32 @expect_zng(i32 -1, i32 %89)
%91 = icmp eq i32 %90, 0
br i1 %91, label %95, label %92
92: ; preds = %86
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%94 = call i32 @fflush(i32* null)
br label %95
95: ; preds = %92, %86
%96 = phi i32 [ -1, %92 ], [ %87, %86 ]
%97 = load i32, i32* @F_OK
%98 = call i32 @access_test(i8* %8, i32 %97)
%99 = call i32 @expect_zng(i32 -1, i32 %98)
%100 = icmp eq i32 %99, 0
br i1 %100, label %104, label %101
101: ; preds = %95
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%103 = call i32 @fflush(i32* null)
br label %104
104: ; preds = %101, %95
%105 = phi i32 [ -1, %101 ], [ %96, %95 ]
%106 = call i32 @lstat_test(i8* %8, %struct.stat* %5)
%107 = call i32 @expect_zng(i32 0, i32 %106)
%108 = icmp eq i32 %107, 0
br i1 %108, label %112, label %109
109: ; preds = %104
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%111 = call i32 @fflush(i32* null)
br label %112
112: ; preds = %109, %104
%113 = phi i32 [ -1, %109 ], [ %105, %104 ]
%114 = call i32 @unlink_test(i8* %8)
%115 = call i32 @expect_zng(i32 0, i32 %114)
%116 = icmp eq i32 %115, 0
br i1 %116, label %120, label %117
117: ; preds = %112
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%119 = call i32 @fflush(i32* null)
br label %120
120: ; preds = %117, %112
%121 = phi i32 [ -1, %117 ], [ %113, %112 ]
%122 = load i32, i32* @F_OK
%123 = call i32 @access_test(i8* %8, i32 %122)
%124 = call i32 @expect_zng(i32 -1, i32 %123)
%125 = icmp eq i32 %124, 0
br i1 %125, label %129, label %126
126: ; preds = %120
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%128 = call i32 @fflush(i32* null)
br label %129
129: ; preds = %126, %120
%130 = phi i32 [ -1, %126 ], [ %121, %120 ]
%131 = call i32 @lstat_test(i8* %8, %struct.stat* %5)
%132 = call i32 @expect_zng(i32 -1, i32 %131)
%133 = icmp eq i32 %132, 0
br i1 %133, label %137, label %134
134: ; preds = %129
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%136 = call i32 @fflush(i32* null)
br label %137
137: ; preds = %134, %129
%138 = phi i32 [ -1, %134 ], [ %130, %129 ]
%139 = call i32 (...) @testbreak()
%140 = load i32, i32* @O_RDWR
%141 = load i32, i32* @O_TRUNC
%142 = or i32 %141, %140
%143 = load i32, i32* @O_CREAT
%144 = or i32 %142, %143
%145 = load i32, i32* @S_IRWXU
%146 = call i32 @open_test(i8* %7, i32 %144, i32 %145)
%147 = call i32 @expect_gez(i32 0, i32 %146)
%148 = icmp eq i32 %147, 0
br i1 %148, label %156, label %149
149: ; preds = %137
%150 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%151 = call i32 @fflush(i32* null)
%152 = icmp eq i32 %147, -1
br i1 %152, label %153, label %156
153: ; preds = %149
%154 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.30, i64 0, i64 0))
%155 = call i32 @fflush(i32* null)
br label %276
156: ; preds = %137, %149
%157 = phi i32 [ -1, %149 ], [ %138, %137 ]
%158 = call i32 @close_test(i32 %146)
%159 = call i32 @expect_zng(i32 0, i32 %158)
%160 = icmp eq i32 %159, 0
br i1 %160, label %164, label %161
161: ; preds = %156
%162 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%163 = call i32 @fflush(i32* null)
br label %164
164: ; preds = %161, %156
%165 = phi i32 [ -1, %161 ], [ %157, %156 ]
%166 = call i32 @link_test(i8* %7, i8* %9)
%167 = call i32 @expect_zng(i32 0, i32 %166)
%168 = icmp eq i32 %167, 0
br i1 %168, label %176, label %169
169: ; preds = %164
%170 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%171 = call i32 @fflush(i32* null)
%172 = icmp eq i32 %167, -1
br i1 %172, label %173, label %176
173: ; preds = %169
%174 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.30, i64 0, i64 0))
%175 = call i32 @fflush(i32* null)
br label %276
176: ; preds = %164, %169
%177 = phi i32 [ -1, %169 ], [ %165, %164 ]
%178 = call i32 @stat_test(i8* %7, %struct.stat* %5)
%179 = call i32 @expect_zng(i32 0, i32 %178)
%180 = icmp eq i32 %179, 0
br i1 %180, label %184, label %181
181: ; preds = %176
%182 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%183 = call i32 @fflush(i32* null)
br label %184
184: ; preds = %181, %176
%185 = phi i32 [ -1, %181 ], [ %177, %176 ]
%186 = call i32 @lstat_test(i8* %9, %struct.stat* %6)
%187 = call i32 @expect_zng(i32 0, i32 %186)
%188 = icmp eq i32 %187, 0
br i1 %188, label %192, label %189
189: ; preds = %184
%190 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%191 = call i32 @fflush(i32* null)
br label %192
192: ; preds = %189, %184
%193 = phi i32 [ -1, %189 ], [ %185, %184 ]
%194 = load i32, i32* %71
%195 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%196 = load i32, i32* %195
%197 = call i32 @expect_val(i32 %194, i32 %196)
%198 = icmp eq i32 %197, 0
br i1 %198, label %202, label %199
199: ; preds = %192
%200 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%201 = call i32 @fflush(i32* null)
br label %202
202: ; preds = %199, %192
%203 = phi i32 [ -1, %199 ], [ %193, %192 ]
%204 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 1
%205 = load i32, i32* %204
%206 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 1
%207 = load i32, i32* %206
%208 = call i32 @expect_val(i32 %205, i32 %207)
%209 = icmp eq i32 %208, 0
br i1 %209, label %213, label %210
210: ; preds = %202
%211 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%212 = call i32 @fflush(i32* null)
br label %213
213: ; preds = %210, %202
%214 = phi i32 [ -1, %210 ], [ %203, %202 ]
%215 = call i32 @unlink_test(i8* %7)
%216 = call i32 @expect_zng(i32 0, i32 %215)
%217 = icmp eq i32 %216, 0
br i1 %217, label %221, label %218
218: ; preds = %213
%219 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%220 = call i32 @fflush(i32* null)
br label %221
221: ; preds = %218, %213
%222 = phi i32 [ -1, %218 ], [ %214, %213 ]
%223 = load i32, i32* @F_OK
%224 = call i32 @access_test(i8* %7, i32 %223)
%225 = call i32 @expect_zng(i32 -1, i32 %224)
%226 = icmp eq i32 %225, 0
br i1 %226, label %230, label %227
227: ; preds = %221
%228 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%229 = call i32 @fflush(i32* null)
br label %230
230: ; preds = %227, %221
%231 = phi i32 [ -1, %227 ], [ %222, %221 ]
%232 = load i32, i32* @F_OK
%233 = call i32 @access_test(i8* %9, i32 %232)
%234 = call i32 @expect_zng(i32 0, i32 %233)
%235 = icmp eq i32 %234, 0
br i1 %235, label %239, label %236
236: ; preds = %230
%237 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%238 = call i32 @fflush(i32* null)
br label %239
239: ; preds = %236, %230
%240 = phi i32 [ -1, %236 ], [ %231, %230 ]
%241 = call i32 @stat_test(i8* %9, %struct.stat* %6)
%242 = call i32 @expect_zng(i32 0, i32 %241)
%243 = icmp eq i32 %242, 0
br i1 %243, label %247, label %244
244: ; preds = %239
%245 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%246 = call i32 @fflush(i32* null)
br label %247
247: ; preds = %244, %239
%248 = phi i32 [ -1, %244 ], [ %240, %239 ]
%249 = load i32, i32* %206
%250 = load i32, i32* %204
%251 = call i32 @expect_val(i32 %249, i32 %250)
%252 = icmp eq i32 %251, 0
br i1 %252, label %256, label %253
253: ; preds = %247
%254 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%255 = call i32 @fflush(i32* null)
br label %256
256: ; preds = %253, %247
%257 = phi i32 [ -1, %253 ], [ %248, %247 ]
%258 = call i32 @unlink_test(i8* %9)
%259 = call i32 @expect_zng(i32 0, i32 %258)
%260 = icmp eq i32 %259, 0
br i1 %260, label %264, label %261
261: ; preds = %256
%262 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%263 = call i32 @fflush(i32* null)
br label %264
264: ; preds = %261, %256
%265 = phi i32 [ -1, %261 ], [ %257, %256 ]
%266 = load i32, i32* @F_OK
%267 = call i32 @access_test(i8* %9, i32 %266)
%268 = call i32 @expect_zng(i32 -1, i32 %267)
%269 = icmp eq i32 %268, 0
br i1 %269, label %273, label %270
270: ; preds = %264
%271 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.31, i64 0, i64 0))
%272 = call i32 @fflush(i32* null)
br label %273
273: ; preds = %270, %264
%274 = phi i32 [ -1, %270 ], [ %265, %264 ]
%275 = call i32 (...) @testbreak()
br label %276
276: ; preds = %273, %173, %153, %50, %30
%277 = phi i32 [ -1, %30 ], [ -1, %50 ], [ -1, %153 ], [ -1, %173 ], [ %274, %273 ]
ret i32 %277
}