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

/* Variables and functions */
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int check_mydns_memory() {
  FILE *stream = NULL;
  char buf[1024] = {0};
  char pid[10] = {0};
  char sh_cmd[200] = {0};
  int memory1 = 0, memory2 = 0;
  printf("---------check mydns memory-----------\n");
  stream = NULL;
  if ((stream = popen("ps -ef | grep 'mydns' | grep -v 'grep' | grep -v 'sh "
                      "-c' | awk '{print $2}'",
                      "r")) == NULL)
    printf("popen failed\n");
  memset(buf, 0, sizeof(buf));
  fread(buf, sizeof(char), sizeof(buf), stream);
  buf[1023] = '\0';
  sscanf(buf, "%s", &pid);
  pclose(stream);
  printf("mydns pid : %s\n", pid);
  sprintf(sh_cmd,
          "cat /proc/%s/status | grep 'VmRSS' | grep -v 'grep' | grep -v 'sh "
          "-c' | awk '{print $2}'",
          pid);
  stream = NULL;
  if ((stream = popen(sh_cmd, "r")) == NULL)
    printf("popen failed\n");
  memset(buf, 0, sizeof(buf));
  fread(buf, sizeof(char), sizeof(buf), stream);
  buf[1023] = '\0';
  sscanf(buf, "%d", &memory1);
  pclose(stream);
  printf("mydns memery1 : %d\n", memory1);
  if (memory1 > 5000) {
    sleep(10);
    printf("check mydns memory 2nd time\n");
    stream = NULL;
    if ((stream = popen(sh_cmd, "r")) == NULL)
      printf("popen failed\n");
    memset(buf, 0, sizeof(buf));
    fread(buf, sizeof(char), sizeof(buf), stream);
    buf[1023] = '\0';
    sscanf(buf, "%d", &memory2);
    pclose(stream);
    printf("mydns memery2 : %d\n", memory2);
    if (memory2 > 5000)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_mydns_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x500,%rsp
movq   $0x0,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x41a(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <memset@plt>
lea    -0x4f0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
movl   $0x0,-0x4f4(%rbp)
movl   $0x0,-0x4f8(%rbp)
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    0xe2b(%rip),%rdi
lea    0xe70(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1225 <check_mydns_memory+0xa5>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xe20(%rip),%rsi
lea    -0x41a(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
lea    -0x41a(%rbp),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4f0(%rbp),%rdi
lea    -0x41a(%rbp),%rdx
lea    0xdf2(%rip),%rsi
call   1090 <sprintf@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x4f0(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    12e1 <check_mydns_memory+0x161>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xdd0(%rip),%rsi
lea    -0x4f4(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x4f4(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1388,-0x4f4(%rbp)
jle    1435 <check_mydns_memory+0x2b5>
mov    $0xa,%edi
call   10a0 <sleep@plt>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x4f0(%rbp),%rdi
lea    0xceb(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    13aa <check_mydns_memory+0x22a>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xd07(%rip),%rsi
lea    -0x4f8(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x4f8(%rbp),%esi
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1388,-0x4f8(%rbp)
jle    1430 <check_mydns_memory+0x2b0>
movl   $0x1,-0x4(%rbp)
jmp    143c <check_mydns_memory+0x2bc>
jmp    1435 <check_mydns_memory+0x2b5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x500,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_mydns_memory>:
push   %rbp
push   %r14
push   %rbx
sub    $0x4f0,%rsp
lea    0xf0(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1070 <memset@plt>
movw   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0xe0(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc1(%rip),%rdi
lea    0xe06(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    125f <check_mydns_memory+0xcf>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movb   $0x0,0x4ef(%rsp)
lea    0xdb4(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %rbp,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
lea    0xd96(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd95(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   10a0 <sprintf@plt>
lea    0xd69(%rip),%rsi
mov    %rbx,%rdi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12ff <check_mydns_memory+0x16f>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movb   $0x0,0x4ef(%rsp)
lea    0xd80(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    0xc(%rsp),%esi
lea    0xd61(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1389,0xc(%rsp)
jl     141f <check_mydns_memory+0x28f>
mov    $0xa,%edi
call   10b0 <sleep@plt>
lea    0xd8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xcbe(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    13ac <check_mydns_memory+0x21c>
lea    0xd81(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movb   $0x0,0x4ef(%rsp)
lea    0xcce(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    0x8(%rsp),%esi
lea    0xcc3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1388,0x8(%rsp)
jg     1421 <check_mydns_memory+0x291>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x4f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"---------check mydns memory-----------\0A\00"
@.str.1 = [76 x i8] c"ps -ef | grep 'mydns' | grep -v 'grep' | grep -v 'sh -c' | awk '{print $2}'\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [14 x i8] c"popen failed\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [16 x i8] c"mydns pid : %s\0A\00"
@.str.6 = [89 x i8] c"cat /proc/%s/status | grep 'VmRSS' | grep -v 'grep' | grep -v 'sh -c' | awk '{print $2}'\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [20 x i8] c"mydns memery1 : %d\0A\00"
@.str.9 = [29 x i8] c"check mydns memory 2nd time\0A\00"
@.str.10 = [20 x i8] c"mydns memery2 : %d\0A\00"
define i32 @check_mydns_memory() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [1024 x i8]
%4 = alloca [10 x i8]
%5 = alloca [200 x i8]
%6 = alloca i32
%7 = alloca i32
store i32* null, i32** %2
%8 = bitcast [1024 x i8]* %3 to i8*
%9 = bitcast [10 x i8]* %4 to i8*
%10 = bitcast [200 x i8]* %5 to i8*
store i32 0, i32* %6
store i32 0, i32* %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32* null, i32** %2
%12 = call i32* @popen(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %12, i32** %2
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%18 = call i32 @memset(i8* %17, i32 0, i32 1024)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%20 = load i32*, i32** %2
%21 = call i32 @fread(i8* %19, i32 1, i32 1024, i32* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %22
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [10 x i8]* %4)
%25 = load i32*, i32** %2
%26 = call i32 @pclose(i32* %25)
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%31 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.6, i64 0, i64 0), i8* %30)
store i32* null, i32** %2
%32 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%33 = call i32* @popen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %33, i32** %2
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %16
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %16
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%39 = call i32 @memset(i8* %38, i32 0, i32 1024)
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%41 = load i32*, i32** %2
%42 = call i32 @fread(i8* %40, i32 1, i32 1024, i32* %41)
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %43
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%45 = call i32 (i8*, i8*, ...) @sscanf(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%46 = load i32*, i32** %2
%47 = call i32 @pclose(i32* %46)
%48 = load i32, i32* %6
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 5000
br i1 %51, label %52, label %77
52: ; preds = %37
%53 = call i32 @sleep(i32 10)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
store i32* null, i32** %2
%55 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%56 = call i32* @popen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %56, i32** %2
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %58, %52
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%62 = call i32 @memset(i8* %61, i32 0, i32 1024)
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%64 = load i32*, i32** %2
%65 = call i32 @fread(i8* %63, i32 1, i32 1024, i32* %64)
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %66
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%68 = call i32 (i8*, i8*, ...) @sscanf(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%69 = load i32*, i32** %2
%70 = call i32 @pclose(i32* %69)
%71 = load i32, i32* %7
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %7
%74 = icmp sgt i32 %73, 5000
br i1 %74, label %75, label %76
75: ; preds = %60
store i32 1, i32* %1
br label %78
76: ; preds = %60
br label %77
77: ; preds = %76, %37
store i32 0, i32* %1
br label %78
78: ; preds = %77, %75
%79 = load i32, i32* %1
ret i32 %79
}

LLVM IR (-O2):
@.str.1 = [76 x i8] c"ps -ef | grep 'mydns' | grep -v 'grep' | grep -v 'sh -c' | awk '{print $2}'\00"
@.str.2 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [16 x i8] c"mydns pid : %s\0A\00"
@.str.6 = [89 x i8] c"cat /proc/%s/status | grep 'VmRSS' | grep -v 'grep' | grep -v 'sh -c' | awk '{print $2}'\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [20 x i8] c"mydns memery1 : %d\0A\00"
@.str.10 = [20 x i8] c"mydns memery2 : %d\0A\00"
@str = [39 x i8] c"---------check mydns memory-----------\00"
@str.11 = [28 x i8] c"check mydns memory 2nd time\00"
@str.14 = [13 x i8] c"popen failed\00"
define i32 @check_mydns_memory() {
%1 = alloca [1024 x i8]
%2 = alloca [10 x i8]
%3 = alloca [200 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%12 = tail call i32* @popen(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
%17 = call i32 @memset(i8* %6, i32 0, i32 1024)
%18 = call i32 @fread(i8* %6, i32 1, i32 1024, i32* %12)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 1023
store i8 0, i8* %19
%20 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [10 x i8]* %2)
%21 = call i32 @pclose(i32* %12)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%23 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str.6, i64 0, i64 0), i8* %7)
%24 = call i32* @popen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
br label %28
28: ; preds = %26, %16
%29 = call i32 @memset(i8* %6, i32 0, i32 1024)
%30 = call i32 @fread(i8* %6, i32 1, i32 1024, i32* %24)
store i8 0, i8* %19
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%32 = call i32 @pclose(i32* %24)
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 5000
br i1 %36, label %37, label %53
37: ; preds = %28
%38 = call i32 @sleep(i32 10)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%40 = call i32* @popen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = call i32 @memset(i8* %6, i32 0, i32 1024)
%46 = call i32 @fread(i8* %6, i32 1, i32 1024, i32* %40)
store i8 0, i8* %19
%47 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %5)
%48 = call i32 @pclose(i32* %40)
%49 = load i32, i32* %5
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %5
%52 = icmp sgt i32 %51, 5000
br i1 %52, label %54, label %53
53: ; preds = %44, %28
br label %54
54: ; preds = %44, %53
%55 = phi i32 [ 0, %53 ], [ 1, %44 ]
ret i32 %55
}