#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 dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ EXIT_SUCCESS;
scalar_t__ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stdout;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int system(char *);
int main() {
  int ret, ok = 0, bad = 0, line;
  FILE *fp;
  DIR *d;
  char buf[1024];
  struct dirent *dent;
  char file[1024];
  d = opendir("testsuite");
  while ((dent = readdir(d)) != NULL) {
    sprintf(file, "testsuite/%s", dent->d_name);
    line = 0;
    fp = fopen(file, "r");
    if (fp == NULL) {
      perror("cannot find testsuite file");
      exit(EXIT_FAILURE);
    }
    while (fgets(buf, sizeof(buf), fp)) {
      char tmp[1024] = "/usr/sbin/conntrack", *res;
      tmp[strlen("/usr/sbin/conntrack")] = ' ';
      line++;
      if (buf[0] == '#' || buf[0] == ' ')
        continue;
      res = strchr(buf, ';');
      if (!res) {
        printf("malformed file %s at line %d\n", dent->d_name, line);
        exit(EXIT_FAILURE);
      }
      *res = '\0';
      res += 2;
      strcpy(tmp + strlen("/usr/sbin/conntrack") + 1, buf);
      printf("(%d) Executing: %s\n", line, tmp);
      ret = system(tmp);
      if (WIFEXITED(ret) && WEXITSTATUS(ret) == EXIT_SUCCESS) {
        if (res[0] == 'O' && res[1] == 'K')
          ok++;
        else {
          bad++;
          printf("^----- BAD\n");
        }
      } else {
        if (res[0] == 'B' && res[1] == 'A' && res[2] == 'D')
          ok++;
        else {
          bad++;
          printf("^----- BAD\n");
        }
      }
      printf("=====\n");
    }
    fclose(fp);
  }
  closedir(d);
  fprintf(stdout, "OK: %d BAD: %d\n", ok, bad);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xdb9(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   10e0 <readdir@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
je     1513 <main+0x2f3>
lea    -0x840(%rbp),%rdi
mov    -0x438(%rbp),%rax
mov    (%rax),%rdx
lea    0xd88(%rip),%rsi
call   1130 <sprintf@plt>
movl   $0x0,-0x14(%rbp)
lea    -0x840(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12ca <main+0xaa>
lea    0xd62(%rip),%rdi
call   1110 <perror@plt>
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
jmp    12cf <main+0xaf>
lea    -0x430(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1505 <main+0x2e5>
lea    -0xc40(%rbp),%rdi
lea    0xda4(%rip),%rsi
mov    $0x400,%edx
call   10d0 <memcpy@plt>
lea    0xd27(%rip),%rdi
call   1060 <strlen@plt>
cltq
movb   $0x20,-0xc40(%rbp,%rax,1)
20
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movsbl -0x430(%rbp),%eax
cmp    $0x23,%eax
je     1345 <main+0x125>
movsbl -0x430(%rbp),%eax
cmp    $0x20,%eax
jne    134a <main+0x12a>
jmp    12cf <main+0xaf>
lea    -0x430(%rbp),%rdi
mov    $0x3b,%esi
call   1080 <strchr@plt>
mov    %rax,-0xc48(%rbp)
cmpq   $0x0,-0xc48(%rbp)
jne    1399 <main+0x179>
mov    -0x438(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2c4e(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0xc48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xc48(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0xc48(%rbp)
lea    -0xc40(%rbp),%rax
mov    %rax,-0xc50(%rbp)
lea    0xc6a(%rip),%rdi
call   1060 <strlen@plt>
mov    -0xc50(%rbp),%rdi
cltq
add    %rax,%rdi
add    $0x1,%rdi
lea    -0x430(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%esi
lea    -0xc40(%rbp),%rdx
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0xc40(%rbp),%rdi
call   1070 <system@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1120 <WIFEXITED@plt>
cmp    $0x0,%rax
je     148d <main+0x26d>
mov    -0x8(%rbp),%edi
call   10f0 <WEXITSTATUS@plt>
mov    0x2b9d(%rip),%rcx
cmp    (%rcx),%rax
jne    148d <main+0x26d>
mov    -0xc48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4f,%eax
jne    1471 <main+0x251>
mov    -0xc48(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x4b,%eax
jne    1471 <main+0x251>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1488 <main+0x268>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xbf9(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    14f2 <main+0x2d2>
mov    -0xc48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x42,%eax
jne    14d6 <main+0x2b6>
mov    -0xc48(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x41,%eax
jne    14d6 <main+0x2b6>
mov    -0xc48(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x44,%eax
jne    14d6 <main+0x2b6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    14ed <main+0x2cd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xb94(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    14f2 <main+0x2d2>
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    12cf <main+0xaf>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1250 <main+0x30>
mov    -0x28(%rbp),%rdi
call   10a0 <closedir@plt>
mov    0x2ab5(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xb5b(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0xc50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc28,%rsp
lea    0xdb8(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   10f0 <readdir@plt>
test   %rax,%rax
je     1448 <main+0x218>
mov    %rax,%r12
lea    0x420(%rsp),%r15
lea    0xe2b(%rip),%rbp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
jmp    12ae <main+0x7e>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   10f0 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     1458 <main+0x228>
mov    (%r12),%rdx
lea    0x820(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd46(%rip),%rsi
call   1140 <sprintf@plt>
mov    %rbx,%rdi
lea    0xd44(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     14ba <main+0x28a>
mov    %rax,%r14
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     1290 <main+0x60>
mov    %r12,0x18(%rsp)
mov    $0x1,%r13d
lea    0x20(%rsp),%rbx
jmp    1352 <main+0x122>
nopl   0x0(%rax,%rax,1)
addl   $0x1,0xc(%rsp)
lea    0xd74(%rip),%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rbx
lea    0xd5d(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rbp
mov    %r15,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   10c0 <fgets@plt>
add    $0x1,%r13d
test   %rax,%rax
je     1290 <main+0x60>
mov    $0x400,%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10e0 <memcpy@plt>
lea    0xccb(%rip),%rdi
call   1070 <strlen@plt>
cltq
movb   $0x20,0x20(%rsp,%rax,1)
movzbl 0x420(%rsp),%eax
cmp    $0x20,%al
je     1335 <main+0x105>
cmp    $0x23,%al
je     1335 <main+0x105>
mov    %rbp,%r12
mov    %r15,%rdi
mov    $0x3b,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     1493 <main+0x263>
mov    %rax,%rbp
movb   $0x0,(%rax)
lea    0xc89(%rip),%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x21,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xc9d(%rip),%rdi
mov    %r13d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
call   1080 <system@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1130 <WIFEXITED@plt>
test   %rax,%rax
je     1420 <main+0x1f0>
mov    %ebx,%edi
call   1100 <WEXITSTATUS@plt>
mov    0x2bd6(%rip),%rcx
cmp    (%rcx),%rax
jne    1420 <main+0x1f0>
cmpb   $0x4f,0x2(%rbp)
jne    1310 <main+0xe0>
cmpb   $0x4b,0x3(%rbp)
jne    1310 <main+0xe0>
jmp    143e <main+0x20e>
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x42,0x2(%rbp)
jne    1310 <main+0xe0>
cmpb   $0x41,0x3(%rbp)
jne    1310 <main+0xe0>
cmpb   $0x44,0x4(%rbp)
jne    1310 <main+0xe0>
addl   $0x1,0x8(%rsp)
jmp    1321 <main+0xf1>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%rdi
call   10b0 <closedir@plt>
mov    0x2b6f(%rip),%rax
mov    (%rax),%edi
lea    0xc08(%rip),%rsi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
call   10d0 <fprintf@plt>
xor    %eax,%eax
add    $0xc28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x18(%rsp),%rax
mov    (%rax),%rsi
lea    0xba6(%rip),%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2b2d(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
lea    0xb58(%rip),%rdi
call   1120 <perror@plt>
jmp    14ac <main+0x27c>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [10 x i8] c"testsuite\00"
@.str.1 = [13 x i8] c"testsuite/%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [27 x i8] c"cannot find testsuite file\00"
@EXIT_FAILURE = global i32 0
@__const.main.tmp = [1024 x i8] c"/usr/sbin/conntrack\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.4 = [20 x i8] c"/usr/sbin/conntrack\00"
@.str.5 = [30 x i8] c"malformed file %s at line %d\0A\00"
@.str.6 = [20 x i8] c"(%d) Executing: %s\0A\00"
@EXIT_SUCCESS = global i64 0
@.str.7 = [12 x i8] c"^----- BAD\0A\00"
@.str.8 = [7 x i8] c"=====\0A\00"
@stdout = global i32 0
@.str.9 = [16 x i8] c"OK: %d BAD: %d\0A\00"
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 [1024 x i8]
%9 = alloca %struct.dirent*
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%13 = call i32* @opendir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %7
br label %14
14: ; preds = %140, %0
%15 = load i32*, i32** %7
%16 = call %struct.dirent* @readdir(i32* %15)
store %struct.dirent* %16, %struct.dirent** %9
%17 = icmp ne %struct.dirent* %16, null
br i1 %17, label %18, label %143
18: ; preds = %14
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%20 = load %struct.dirent*, %struct.dirent** %9
%21 = getelementptr inbounds %struct.dirent, %struct.dirent* %20, i32 0, i32 0
%22 = load i8*, i8** %21
%23 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 0, i32* %5
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %18
%29 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %18
br label %33
33: ; preds = %138, %54, %32
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%35 = load i32*, i32** %6
%36 = call i64 @fgets(i8* %34, i32 1024, i32* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %140
38: ; preds = %33
%39 = bitcast [1024 x i8]* %11 to i8*
%40 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %41
store i8 32, i8* %42
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 35
br i1 %48, label %54, label %49
49: ; preds = %38
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 32
br i1 %53, label %54, label %55
54: ; preds = %49, %38
br label %33
55: ; preds = %49
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%57 = call i8* @strchr(i8* %56, i8 signext 59)
store i8* %57, i8** %12
%58 = load i8*, i8** %12
%59 = icmp ne i8* %58, null
br i1 %59, label %68, label %60
60: ; preds = %55
%61 = load %struct.dirent*, %struct.dirent** %9
%62 = getelementptr inbounds %struct.dirent, %struct.dirent* %61, i32 0, i32 0
%63 = load i8*, i8** %62
%64 = load i32, i32* %5
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %63, i32 %64)
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %55
%69 = load i8*, i8** %12
store i8 0, i8* %69
%70 = load i8*, i8** %12
%71 = getelementptr inbounds i8, i8* %70, i64 2
store i8* %71, i8** %12
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%73 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%78 = call i32 @strcpy(i8* %76, i8* %77)
%79 = load i32, i32* %5
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %79, i8* %80)
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%83 = call i32 @system(i8* %82)
store i32 %83, i32* %2
%84 = load i32, i32* %2
%85 = call i64 @WIFEXITED(i32 %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %112
87: ; preds = %68
%88 = load i32, i32* %2
%89 = call i64 @WEXITSTATUS(i32 %88)
%90 = load i64, i64* @EXIT_SUCCESS
%91 = icmp eq i64 %89, %90
br i1 %91, label %92, label %112
92: ; preds = %87
%93 = load i8*, i8** %12
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 79
br i1 %97, label %98, label %107
98: ; preds = %92
%99 = load i8*, i8** %12
%100 = getelementptr inbounds i8, i8* %99, i64 1
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp eq i32 %102, 75
br i1 %103, label %104, label %107
104: ; preds = %98
%105 = load i32, i32* %3
%106 = add nsw i32 %105, 1
store i32 %106, i32* %3
br label %111
107: ; preds = %98, %92
%108 = load i32, i32* %4
%109 = add nsw i32 %108, 1
store i32 %109, i32* %4
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %111
111: ; preds = %107, %104
br label %138
112: ; preds = %87, %68
%113 = load i8*, i8** %12
%114 = getelementptr inbounds i8, i8* %113, i64 0
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 66
br i1 %117, label %118, label %133
118: ; preds = %112
%119 = load i8*, i8** %12
%120 = getelementptr inbounds i8, i8* %119, i64 1
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 65
br i1 %123, label %124, label %133
124: ; preds = %118
%125 = load i8*, i8** %12
%126 = getelementptr inbounds i8, i8* %125, i64 2
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 68
br i1 %129, label %130, label %133
130: ; preds = %124
%131 = load i32, i32* %3
%132 = add nsw i32 %131, 1
store i32 %132, i32* %3
br label %137
133: ; preds = %124, %118, %112
%134 = load i32, i32* %4
%135 = add nsw i32 %134, 1
store i32 %135, i32* %4
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %137
137: ; preds = %133, %130
br label %138
138: ; preds = %137, %111
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %33
140: ; preds = %33
%141 = load i32*, i32** %6
%142 = call i32 @fclose(i32* %141)
br label %14
143: ; preds = %14
%144 = load i32*, i32** %7
%145 = call i32 @closedir(i32* %144)
%146 = load i32, i32* @stdout
%147 = load i32, i32* %3
%148 = load i32, i32* %4
%149 = call i32 @fprintf(i32 %146, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %147, i32 %148)
%150 = load i32, i32* %1
ret i32 %150
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [10 x i8] c"testsuite\00"
@.str.1 = [13 x i8] c"testsuite/%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [27 x i8] c"cannot find testsuite file\00"
@EXIT_FAILURE = global i32 0
@__const.main.tmp = [1024 x i8] c"/usr/sbin/conntrack\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.4 = [20 x i8] c"/usr/sbin/conntrack\00"
@.str.5 = [30 x i8] c"malformed file %s at line %d\0A\00"
@.str.6 = [20 x i8] c"(%d) Executing: %s\0A\00"
@EXIT_SUCCESS = global i64 0
@stdout = global i32 0
@.str.9 = [16 x i8] c"OK: %d BAD: %d\0A\00"
@str.10 = [6 x i8] c"=====\00"
@str.11 = [11 x i8] c"^----- BAD\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = tail call i32* @opendir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = call %struct.dirent* @readdir(i32* %6)
%8 = icmp eq %struct.dirent* %7, null
br i1 %8, label %103, label %9
9: ; preds = %0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %11
11: ; preds = %9, %97
%12 = phi %struct.dirent* [ %7, %9 ], [ %101, %97 ]
%13 = phi i32 [ 0, %9 ], [ %99, %97 ]
%14 = phi i32 [ 0, %9 ], [ %98, %97 ]
%15 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i64 0, i32 0
%16 = load i8*, i8** %15
%17 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %23, label %20
20: ; preds = %11
%21 = call i64 @fgets(i8* %4, i32 1024, i32* %18)
%22 = icmp eq i64 %21, 0
br i1 %22, label %97, label %27
23: ; preds = %11
%24 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %20, %92
%28 = phi i32 [ %94, %92 ], [ %13, %20 ]
%29 = phi i32 [ %93, %92 ], [ %14, %20 ]
%30 = phi i32 [ %34, %92 ], [ 0, %20 ]
%31 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %32
store i8 32, i8* %33
%34 = add nuw nsw i32 %30, 1
%35 = load i8, i8* %4
switch i8 %35, label %36 [
i8 35, label %92
i8 32, label %92
]
36: ; preds = %27
%37 = call i8* @strchr(i8* %4, i8 signext 59)
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i64 0, i32 0
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %41, i32 %34)
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %36
store i8 0, i8* %37
%46 = getelementptr inbounds i8, i8* %37, i64 2
%47 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %48
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = call i32 @strcpy(i8* %50, i8* %4)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %34, i8* %10)
%53 = call i32 @system(i8* %10)
%54 = call i64 @WIFEXITED(i32 %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %72, label %56
56: ; preds = %45
%57 = call i64 @WEXITSTATUS(i32 %53)
%58 = load i64, i64* @EXIT_SUCCESS
%59 = icmp eq i64 %57, %58
br i1 %59, label %60, label %72
60: ; preds = %56
%61 = load i8, i8* %46
%62 = icmp eq i8 %61, 79
br i1 %62, label %63, label %69
63: ; preds = %60
%64 = getelementptr inbounds i8, i8* %37, i64 3
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 75
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = add nsw i32 %28, 1
br label %88
69: ; preds = %63, %60
%70 = add nsw i32 %29, 1
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.11, i64 0, i64 0))
br label %88
72: ; preds = %56, %45
%73 = load i8, i8* %46
%74 = icmp eq i8 %73, 66
br i1 %74, label %75, label %85
75: ; preds = %72
%76 = getelementptr inbounds i8, i8* %37, i64 3
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 65
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = getelementptr inbounds i8, i8* %37, i64 4
%81 = load i8, i8* %80
%82 = icmp eq i8 %81, 68
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = add nsw i32 %28, 1
br label %88
85: ; preds = %79, %75, %72
%86 = add nsw i32 %29, 1
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.11, i64 0, i64 0))
br label %88
88: ; preds = %83, %85, %67, %69
%89 = phi i32 [ %29, %67 ], [ %70, %69 ], [ %29, %83 ], [ %86, %85 ]
%90 = phi i32 [ %68, %67 ], [ %28, %69 ], [ %84, %83 ], [ %28, %85 ]
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.10, i64 0, i64 0))
br label %92
92: ; preds = %27, %27, %88
%93 = phi i32 [ %89, %88 ], [ %29, %27 ], [ %29, %27 ]
%94 = phi i32 [ %90, %88 ], [ %28, %27 ], [ %28, %27 ]
%95 = call i64 @fgets(i8* %4, i32 1024, i32* %18)
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %27
97: ; preds = %92, %20
%98 = phi i32 [ %14, %20 ], [ %93, %92 ]
%99 = phi i32 [ %13, %20 ], [ %94, %92 ]
%100 = call i32 @fclose(i32* %18)
%101 = call %struct.dirent* @readdir(i32* %6)
%102 = icmp eq %struct.dirent* %101, null
br i1 %102, label %103, label %11
103: ; preds = %97, %0
%104 = phi i32 [ 0, %0 ], [ %98, %97 ]
%105 = phi i32 [ 0, %0 ], [ %99, %97 ]
%106 = call i32 @closedir(i32* %6)
%107 = load i32, i32* @stdout
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %105, i32 %104)
ret i32 0
}