#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*/ line;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *gettext(char *);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int sprintf(char *, char *, char *);
int strlen(char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
void print_cstates(void) {
  unsigned long cstate_bitmap = 0;
  DIR *cpudir;
  DIR *dir;
  FILE *file = NULL;
  char line[4];
  char filename[128], *f;
  struct dirent *entry;
  int len, i;
  cpudir = opendir("/sys/devices/system/cpu");
  if (!cpudir)
    return;
  while ((entry = readdir(cpudir))) {
    if (strlen(entry->d_name) < 3)
      continue;
    if (!isdigit(entry->d_name[3]))
      continue;
    len =
        sprintf(filename, "/sys/devices/system/cpu/%s/cpuidle", entry->d_name);
    dir = opendir(filename);
    if (!dir)
      return;
    while ((entry = readdir(dir))) {
      if (strlen(entry->d_name) < 3)
        continue;
      sprintf(filename + len, "/%s/name", entry->d_name);
      file = fopen(filename, "r");
      if (file) {
        memset(line, 0, sizeof(line));
        f = fgets(line, sizeof(line), file);
        fclose(file);
        if (f == NULL)
          break;
        cstate_bitmap |= (1 << strtoul(f + 1, NULL, 10));
      }
    }
    closedir(dir);
  }
  closedir(cpudir);
  if (!cstate_bitmap)
    return;
  printf(gettext("Your CPU supports the following C-states : "));
  for (i = 0; cstate_bitmap; i++)
    if (cstate_bitmap & (1 << i)) {
      printf("C%i ", i);
      cstate_bitmap &= ~(1 << i);
    }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_cstates>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe0e(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    120b <print_cstates+0x3b>
jmp    1470 <print_cstates+0x2a0>
jmp    1210 <print_cstates+0x40>
mov    -0x10(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0xc0(%rbp)
cmp    $0x0,%rax
je     13b4 <print_cstates+0x1e4>
mov    -0xc0(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jge    1247 <print_cstates+0x77>
jmp    1210 <print_cstates+0x40>
mov    -0xc0(%rbp),%rax
mov    (%rax),%rax
movsbl 0x3(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1268 <print_cstates+0x98>
jmp    1210 <print_cstates+0x40>
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rax
mov    (%rax),%rdx
lea    0xd98(%rip),%rsi
call   10f0 <sprintf@plt>
mov    %eax,-0xc4(%rbp)
lea    -0xb0(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12ab <print_cstates+0xdb>
jmp    1470 <print_cstates+0x2a0>
jmp    12b0 <print_cstates+0xe0>
mov    -0x18(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0xc0(%rbp)
cmp    $0x0,%rax
je     13a6 <print_cstates+0x1d6>
mov    -0xc0(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jge    12e7 <print_cstates+0x117>
jmp    12b0 <print_cstates+0xe0>
lea    -0xb0(%rbp),%rdi
movslq -0xc4(%rbp),%rax
add    %rax,%rdi
mov    -0xc0(%rbp),%rax
mov    (%rax),%rdx
lea    0xd32(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xd28(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     13a1 <print_cstates+0x1d1>
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1090 <memset@plt>
lea    -0x24(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x4,%esi
call   10b0 <fgets@plt>
mov    %rax,-0xb8(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0xb8(%rbp)
jne    1375 <print_cstates+0x1a5>
jmp    13a6 <print_cstates+0x1d6>
mov    -0xb8(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10e0 <strtoul@plt>
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12b0 <print_cstates+0xe0>
mov    -0x18(%rbp),%rdi
call   10a0 <closedir@plt>
jmp    1210 <print_cstates+0x40>
mov    -0x10(%rbp),%rdi
call   10a0 <closedir@plt>
cmpq   $0x0,-0x8(%rbp)
jne    13cd <print_cstates+0x1fd>
jmp    1470 <print_cstates+0x2a0>
lea    0xc72(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0xc8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1462 <print_cstates+0x292>
mov    -0x8(%rbp),%rax
mov    -0xc8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1449 <print_cstates+0x279>
mov    -0xc8(%rbp),%esi
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xc8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
cltq
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    144e <print_cstates+0x27e>
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    13ed <print_cstates+0x21d>
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cstates>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xe08(%rip),%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     13e3 <print_cstates+0x203>
mov    %rax,%rbx
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     13db <print_cstates+0x1fb>
mov    %rax,%rbp
xor    %r15d,%r15d
lea    0xdf1(%rip),%r14
lea    0x10(%rsp),%r12
jmp    1244 <print_cstates+0x64>
xchg   %ax,%ax
mov    %rbx,%rdi
call   10d0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     136a <print_cstates+0x18a>
mov    0x0(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x2,%eax
jle    1230 <print_cstates+0x50>
mov    0x0(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     1230 <print_cstates+0x50>
mov    0x0(%rbp),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
call   1100 <sprintf@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     13e3 <print_cstates+0x203>
mov    %rax,%r14
movslq %ebp,%rax
add    %rsp,%rax
add    $0x10,%rax
mov    %rax,(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1347 <print_cstates+0x167>
mov    %rax,%rbp
mov    (%rax),%rdi
call   1070 <strlen@plt>
cmp    $0x3,%eax
jl     12a0 <print_cstates+0xc0>
mov    0x0(%rbp),%rdx
mov    (%rsp),%rdi
lea    0xd6b(%rip),%rsi
call   1100 <sprintf@plt>
mov    %r12,%rdi
lea    0xd65(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     12a0 <print_cstates+0xc0>
mov    %rax,%r13
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   10a0 <memset@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %r13,%rdx
call   10c0 <fgets@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1050 <fclose@plt>
test   %rbp,%rbp
je     1347 <print_cstates+0x167>
add    $0x1,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
movslq %edx,%rax
or     %rax,%r15
jmp    12a0 <print_cstates+0xc0>
mov    %r14,%rdi
call   10b0 <closedir@plt>
mov    %rbx,%rdi
call   10d0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
lea    0xcb4(%rip),%r14
jne    1244 <print_cstates+0x64>
mov    %rbx,%rdi
call   10b0 <closedir@plt>
test   %r15,%r15
je     13e3 <print_cstates+0x203>
lea    0xcc8(%rip),%rdi
call   1080 <gettext@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xcde(%rip),%r14
xor    %ebp,%ebp
jmp    13a8 <print_cstates+0x1c8>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
test   %r15,%r15
je     13cf <print_cstates+0x1ef>
mov    $0x1,%ebx
mov    %ebp,%ecx
shl    %cl,%ebx
movslq %ebx,%rax
test   %rax,%r15
je     13a0 <print_cstates+0x1c0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1090 <printf@plt>
not    %ebx
movslq %ebx,%rax
and    %rax,%r15
jmp    13a0 <print_cstates+0x1c0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    13e3 <print_cstates+0x203>
mov    %rbx,%rdi
call   10b0 <closedir@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [24 x i8] c"/sys/devices/system/cpu\00"
@.str.1 = [35 x i8] c"/sys/devices/system/cpu/%s/cpuidle\00"
@.str.2 = [9 x i8] c"/%s/name\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [44 x i8] c"Your CPU supports the following C-states : \00"
@.str.5 = [5 x i8] c"C%i \00"
@.str.6 = [2 x i8] c"\0A\00"
define void @print_cstates() {
%1 = alloca i64
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [4 x i8]
%6 = alloca [128 x i8]
%7 = alloca i8*
%8 = alloca %struct.dirent*
%9 = alloca i32
%10 = alloca i32
store i64 0, i64* %1
store i32* null, i32** %4
%11 = call i32* @opendir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %2
%12 = load i32*, i32** %2
%13 = icmp ne i32* %12, null
br i1 %13, label %15, label %14
14: ; preds = %0
br label %129
15: ; preds = %0
br label %16
16: ; preds = %92, %35, %26, %15
%17 = load i32*, i32** %2
%18 = call %struct.dirent* @readdir(i32* %17)
store %struct.dirent* %18, %struct.dirent** %8
%19 = icmp ne %struct.dirent* %18, null
br i1 %19, label %20, label %95
20: ; preds = %16
%21 = load %struct.dirent*, %struct.dirent** %8
%22 = getelementptr inbounds %struct.dirent, %struct.dirent* %21, i32 0, i32 0
%23 = load i8*, i8** %22
%24 = call i32 @strlen(i8* %23)
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %27
26: ; preds = %20
br label %16
27: ; preds = %20
%28 = load %struct.dirent*, %struct.dirent** %8
%29 = getelementptr inbounds %struct.dirent, %struct.dirent* %28, i32 0, i32 0
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 3
%32 = load i8, i8* %31
%33 = call i32 @isdigit(i8 signext %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %27
br label %16
36: ; preds = %27
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%38 = load %struct.dirent*, %struct.dirent** %8
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %38, i32 0, i32 0
%40 = load i8*, i8** %39
%41 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %40)
store i32 %41, i32* %9
%42 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%43 = call i32* @opendir(i8* %42)
store i32* %43, i32** %3
%44 = load i32*, i32** %3
%45 = icmp ne i32* %44, null
br i1 %45, label %47, label %46
46: ; preds = %36
br label %129
47: ; preds = %36
br label %48
48: ; preds = %91, %58, %47
%49 = load i32*, i32** %3
%50 = call %struct.dirent* @readdir(i32* %49)
store %struct.dirent* %50, %struct.dirent** %8
%51 = icmp ne %struct.dirent* %50, null
br i1 %51, label %52, label %92
52: ; preds = %48
%53 = load %struct.dirent*, %struct.dirent** %8
%54 = getelementptr inbounds %struct.dirent, %struct.dirent* %53, i32 0, i32 0
%55 = load i8*, i8** %54
%56 = call i32 @strlen(i8* %55)
%57 = icmp slt i32 %56, 3
br i1 %57, label %58, label %59
58: ; preds = %52
br label %48
59: ; preds = %52
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = load %struct.dirent*, %struct.dirent** %8
%65 = getelementptr inbounds %struct.dirent, %struct.dirent* %64, i32 0, i32 0
%66 = load i8*, i8** %65
%67 = call i32 @sprintf(i8* %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %69, i32** %4
%70 = load i32*, i32** %4
%71 = icmp ne i32* %70, null
br i1 %71, label %72, label %91
72: ; preds = %59
%73 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%74 = call i32 @memset(i8* %73, i32 0, i32 4)
%75 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%76 = load i32*, i32** %4
%77 = call i8* @fgets(i8* %75, i32 4, i32* %76)
store i8* %77, i8** %7
%78 = load i32*, i32** %4
%79 = call i32 @fclose(i32* %78)
%80 = load i8*, i8** %7
%81 = icmp eq i8* %80, null
br i1 %81, label %82, label %83
82: ; preds = %72
br label %92
83: ; preds = %72
%84 = load i8*, i8** %7
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = call i32 @strtoul(i8* %85, i32* null, i32 10)
%87 = shl i32 1, %86
%88 = sext i32 %87 to i64
%89 = load i64, i64* %1
%90 = or i64 %89, %88
store i64 %90, i64* %1
br label %91
91: ; preds = %83, %59
br label %48
92: ; preds = %82, %48
%93 = load i32*, i32** %3
%94 = call i32 @closedir(i32* %93)
br label %16
95: ; preds = %16
%96 = load i32*, i32** %2
%97 = call i32 @closedir(i32* %96)
%98 = load i64, i64* %1
%99 = icmp ne i64 %98, 0
br i1 %99, label %101, label %100
100: ; preds = %95
br label %129
101: ; preds = %95
%102 = call i8* @gettext(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%103 = call i32 (i8*, ...) @printf(i8* %102)
store i32 0, i32* %10
br label %104
104: ; preds = %124, %101
%105 = load i64, i64* %1
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %127
107: ; preds = %104
%108 = load i64, i64* %1
%109 = load i32, i32* %10
%110 = shl i32 1, %109
%111 = sext i32 %110 to i64
%112 = and i64 %108, %111
%113 = icmp ne i64 %112, 0
br i1 %113, label %114, label %123
114: ; preds = %107
%115 = load i32, i32* %10
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %10
%118 = shl i32 1, %117
%119 = xor i32 %118, -1
%120 = sext i32 %119 to i64
%121 = load i64, i64* %1
%122 = and i64 %121, %120
store i64 %122, i64* %1
br label %123
123: ; preds = %114, %107
br label %124
124: ; preds = %123
%125 = load i32, i32* %10
%126 = add nsw i32 %125, 1
store i32 %126, i32* %10
br label %104
127: ; preds = %104
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %129
129: ; preds = %127, %100, %46, %14
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [24 x i8] c"/sys/devices/system/cpu\00"
@.str.1 = [35 x i8] c"/sys/devices/system/cpu/%s/cpuidle\00"
@.str.2 = [9 x i8] c"/%s/name\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [44 x i8] c"Your CPU supports the following C-states : \00"
@.str.5 = [5 x i8] c"C%i \00"
define void @print_cstates() {
%1 = alloca [4 x i8]
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @opendir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %95, label %7
7: ; preds = %0
%8 = call %struct.dirent* @readdir(i32* %5)
%9 = icmp eq %struct.dirent* %8, null
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @closedir(i32* %5)
br label %95
12: ; preds = %7, %66
%13 = phi %struct.dirent* [ %68, %66 ], [ %8, %7 ]
%14 = phi i64 [ %39, %66 ], [ 0, %7 ]
br label %15
15: ; preds = %12, %21
%16 = phi %struct.dirent* [ %13, %12 ], [ %22, %21 ]
%17 = getelementptr inbounds %struct.dirent, %struct.dirent* %16, i64 0, i32 0
%18 = load i8*, i8** %17
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %24
21: ; preds = %15, %24
%22 = call %struct.dirent* @readdir(i32* %5)
%23 = icmp eq %struct.dirent* %22, null
br i1 %23, label %70, label %15
24: ; preds = %15
%25 = load i8*, i8** %17
%26 = getelementptr inbounds i8, i8* %25, i64 3
%27 = load i8, i8* %26
%28 = call i32 @isdigit(i8 signext %27)
%29 = icmp eq i32 %28, 0
br i1 %29, label %21, label %30
30: ; preds = %24
%31 = load i8*, i8** %17
%32 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32* @opendir(i8* %4)
%34 = icmp eq i32* %33, null
br i1 %34, label %95, label %35
35: ; preds = %30
%36 = sext i32 %32 to i64
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %36
br label %38
38: ; preds = %60, %35
%39 = phi i64 [ %65, %60 ], [ %14, %35 ]
br label %40
40: ; preds = %38, %49
br label %41
41: ; preds = %40, %44
%42 = call %struct.dirent* @readdir(i32* %33)
%43 = icmp eq %struct.dirent* %42, null
br i1 %43, label %66, label %44
44: ; preds = %41
%45 = getelementptr inbounds %struct.dirent, %struct.dirent* %42, i64 0, i32 0
%46 = load i8*, i8** %45
%47 = call i32 @strlen(i8* %46)
%48 = icmp slt i32 %47, 3
br i1 %48, label %41, label %49
49: ; preds = %44
%50 = getelementptr inbounds %struct.dirent, %struct.dirent* %42, i64 0, i32 0
%51 = load i8*, i8** %50
%52 = call i32 @sprintf(i8* %37, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %51)
%53 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp eq i32* %53, null
br i1 %54, label %40, label %55
55: ; preds = %49
%56 = call i32 @memset(i8* %3, i32 0, i32 4)
%57 = call i8* @fgets(i8* %3, i32 4, i32* %53)
%58 = call i32 @fclose(i32* %53)
%59 = icmp eq i8* %57, null
br i1 %59, label %66, label %60
60: ; preds = %55
%61 = getelementptr inbounds i8, i8* %57, i64 1
%62 = call i32 @strtoul(i8* nocapture %61, i32* null, i32 10)
%63 = shl nuw i32 1, %62
%64 = sext i32 %63 to i64
%65 = or i64 %39, %64
br label %38
66: ; preds = %55, %41
%67 = call i32 @closedir(i32* %33)
%68 = call %struct.dirent* @readdir(i32* %5)
%69 = icmp eq %struct.dirent* %68, null
br i1 %69, label %70, label %12
70: ; preds = %66, %21
%71 = phi i64 [ %14, %21 ], [ %39, %66 ]
%72 = call i32 @closedir(i32* %5)
%73 = icmp eq i64 %71, 0
br i1 %73, label %95, label %74
74: ; preds = %70
%75 = call i8* @gettext(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %75)
br label %77
77: ; preds = %74, %89
%78 = phi i32 [ 0, %74 ], [ %91, %89 ]
%79 = phi i64 [ %71, %74 ], [ %90, %89 ]
%80 = shl nuw i32 1, %78
%81 = sext i32 %80 to i64
%82 = and i64 %79, %81
%83 = icmp eq i64 %82, 0
br i1 %83, label %89, label %84
84: ; preds = %77
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %78)
%86 = xor i32 %80, -1
%87 = sext i32 %86 to i64
%88 = and i64 %79, %87
br label %89
89: ; preds = %77, %84
%90 = phi i64 [ %88, %84 ], [ %79, %77 ]
%91 = add nuw nsw i32 %78, 1
%92 = icmp eq i64 %90, 0
br i1 %92, label %93, label %77
93: ; preds = %89
%94 = call i32 @putchar(i32 10)
br label %95
95: ; preds = %30, %10, %70, %0, %93
ret void
}