#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_udpget_memory() {
  FILE *stream = NULL;
  char buf[1024] = {0};
  char pid[10] = {0};
  char sh_cmd[100] = {0};
  int memory1 = 0, memory2 = 0, memory3 = 0;
  printf("---------check udp_get memory-----------\n");
  stream = NULL;
  if ((stream = popen("ps -ef | grep 'udp_get' | 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("udp_get 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("udp_get memery1 : %d\n", memory1);
  if (memory1 > 5000) {
    sleep(10);
    printf("check udp_get 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("udp_get memory2 : %d\n", memory2);
    if (memory2 > 5000) {
      sleep(10);
      printf("check udp_get memory 3rd 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", &memory3);
      pclose(stream);
      printf("udp_get memory3 : %d\n", memory3);
      if (memory3 > 5000)
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_udpget_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%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    -0x480(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
movl   $0x0,-0x484(%rbp)
movl   $0x0,-0x488(%rbp)
movl   $0x0,-0x48c(%rbp)
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    0xe23(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    122f <check_udpget_memory+0xaf>
lea    0xe52(%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    0xe1a(%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    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x480(%rbp),%rdi
lea    -0x41a(%rbp),%rdx
lea    0xdee(%rip),%rsi
call   1090 <sprintf@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x480(%rbp),%rdi
lea    0xdae(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    12eb <check_udpget_memory+0x16b>
lea    0xd96(%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    0xdcc(%rip),%rsi
lea    -0x484(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x484(%rbp),%esi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1388,-0x484(%rbp)
jle    150d <check_udpget_memory+0x38d>
mov    $0xa,%edi
call   10a0 <sleep@plt>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x480(%rbp),%rdi
lea    0xce5(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    13b4 <check_udpget_memory+0x234>
lea    0xccd(%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    0xd03(%rip),%rsi
lea    -0x488(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x488(%rbp),%esi
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1388,-0x488(%rbp)
jle    1508 <check_udpget_memory+0x388>
mov    $0xa,%edi
call   10a0 <sleep@plt>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    -0x480(%rbp),%rdi
lea    0xc1c(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    147d <check_udpget_memory+0x2fd>
lea    0xc04(%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    0xc3a(%rip),%rsi
lea    -0x48c(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x48c(%rbp),%esi
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1388,-0x48c(%rbp)
jle    1503 <check_udpget_memory+0x383>
movl   $0x1,-0x4(%rbp)
jmp    1514 <check_udpget_memory+0x394>
jmp    1508 <check_udpget_memory+0x388>
jmp    150d <check_udpget_memory+0x38d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_udpget_memory>:
push   %rbp
push   %r14
push   %rbx
sub    $0x490,%rsp
lea    0x90(%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,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x80(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xdea(%rip),%rdi
lea    0xe31(%rip),%rsi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1236 <check_udpget_memory+0xa6>
lea    0xf37(%rip),%rdi
call   1030 <puts@plt>
lea    0x90(%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,0x48f(%rsp)
lea    0xddf(%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    0xdc1(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdc2(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   10a0 <sprintf@plt>
lea    0xd94(%rip),%rsi
mov    %rbx,%rdi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12d6 <check_udpget_memory+0x146>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0x90(%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,0x48f(%rsp)
lea    0xdad(%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    0xd8e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1389,0xc(%rsp)
jl     14a3 <check_udpget_memory+0x313>
mov    $0xa,%edi
call   10b0 <sleep@plt>
lea    0xdd3(%rip),%rdi
call   1030 <puts@plt>
lea    0xce9(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1383 <check_udpget_memory+0x1f3>
lea    0xdea(%rip),%rdi
call   1030 <puts@plt>
lea    0x90(%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,0x48f(%rsp)
lea    0xd00(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    0x8(%rsp),%esi
lea    0xcf7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1389,0x8(%rsp)
jl     14a3 <check_udpget_memory+0x313>
mov    $0xa,%edi
call   10b0 <sleep@plt>
lea    0xd44(%rip),%rdi
call   1030 <puts@plt>
lea    0xc3c(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1090 <popen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1430 <check_udpget_memory+0x2a0>
lea    0xd3d(%rip),%rdi
call   1030 <puts@plt>
lea    0x90(%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,0x48f(%rsp)
lea    0xc4e(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    0x4(%rsp),%esi
lea    0xc5b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1388,0x4(%rsp)
jg     14a5 <check_udpget_memory+0x315>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x490,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"---------check udp_get memory-----------\0A\00"
@.str.1 = [78 x i8] c"ps -ef | grep 'udp_get' | 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 = [18 x i8] c"udp_get 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 = [22 x i8] c"udp_get memery1 : %d\0A\00"
@.str.9 = [31 x i8] c"check udp_get memory 2nd time\0A\00"
@.str.10 = [22 x i8] c"udp_get memory2 : %d\0A\00"
@.str.11 = [31 x i8] c"check udp_get memory 3rd time\0A\00"
@.str.12 = [22 x i8] c"udp_get memory3 : %d\0A\00"
define i32 @check_udpget_memory() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [1024 x i8]
%4 = alloca [10 x i8]
%5 = alloca [100 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* null, i32** %2
%9 = bitcast [1024 x i8]* %3 to i8*
%10 = bitcast [10 x i8]* %4 to i8*
%11 = bitcast [100 x i8]* %5 to i8*
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32* null, i32** %2
%13 = call i32* @popen(i8* getelementptr inbounds ([78 x i8], [78 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* %13, i32** %2
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 1024)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%21 = load i32*, i32** %2
%22 = call i32 @fread(i8* %20, i32 1, i32 1024, i32* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %23
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%25 = call i32 (i8*, i8*, ...) @sscanf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [10 x i8]* %4)
%26 = load i32*, i32** %2
%27 = call i32 @pclose(i32* %26)
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%32 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.6, i64 0, i64 0), i8* %31)
store i32* null, i32** %2
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%34 = call i32* @popen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %2
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %38
36: ; preds = %17
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %17
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%40 = call i32 @memset(i8* %39, i32 0, i32 1024)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%42 = load i32*, i32** %2
%43 = call i32 @fread(i8* %41, i32 1, i32 1024, i32* %42)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %44
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%47 = load i32*, i32** %2
%48 = call i32 @pclose(i32* %47)
%49 = load i32, i32* %6
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %6
%52 = icmp sgt i32 %51, 5000
br i1 %52, label %53, label %102
53: ; preds = %38
%54 = call i32 @sleep(i32 10)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
store i32* null, i32** %2
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%57 = call i32* @popen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %57, i32** %2
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %53
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%63 = call i32 @memset(i8* %62, i32 0, i32 1024)
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%65 = load i32*, i32** %2
%66 = call i32 @fread(i8* %64, i32 1, i32 1024, i32* %65)
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %67
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%69 = call i32 (i8*, i8*, ...) @sscanf(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%70 = load i32*, i32** %2
%71 = call i32 @pclose(i32* %70)
%72 = load i32, i32* %7
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %7
%75 = icmp sgt i32 %74, 5000
br i1 %75, label %76, label %101
76: ; preds = %61
%77 = call i32 @sleep(i32 10)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
store i32* null, i32** %2
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%80 = call i32* @popen(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %80, i32** %2
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %84
82: ; preds = %76
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %82, %76
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%86 = call i32 @memset(i8* %85, i32 0, i32 1024)
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%88 = load i32*, i32** %2
%89 = call i32 @fread(i8* %87, i32 1, i32 1024, i32* %88)
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %90
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%92 = call i32 (i8*, i8*, ...) @sscanf(i8* %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %8)
%93 = load i32*, i32** %2
%94 = call i32 @pclose(i32* %93)
%95 = load i32, i32* %8
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %95)
%97 = load i32, i32* %8
%98 = icmp sgt i32 %97, 5000
br i1 %98, label %99, label %100
99: ; preds = %84
store i32 1, i32* %1
br label %103
100: ; preds = %84
br label %101
101: ; preds = %100, %61
br label %102
102: ; preds = %101, %38
store i32 0, i32* %1
br label %103
103: ; preds = %102, %99
%104 = load i32, i32* %1
ret i32 %104
}

LLVM IR (-O2):
@.str.1 = [78 x i8] c"ps -ef | grep 'udp_get' | 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 = [18 x i8] c"udp_get 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 = [22 x i8] c"udp_get memery1 : %d\0A\00"
@.str.10 = [22 x i8] c"udp_get memory2 : %d\0A\00"
@.str.12 = [22 x i8] c"udp_get memory3 : %d\0A\00"
@str = [41 x i8] c"---------check udp_get memory-----------\00"
@str.13 = [30 x i8] c"check udp_get memory 2nd time\00"
@str.14 = [30 x i8] c"check udp_get memory 3rd time\00"
@str.18 = [13 x i8] c"popen failed\00"
define i32 @check_udpget_memory() {
%1 = alloca [1024 x i8]
%2 = alloca [10 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%11 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%12 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%14 = tail call i32* @popen(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
br label %18
18: ; preds = %16, %0
%19 = call i32 @memset(i8* %7, i32 0, i32 1024)
%20 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %14)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 1023
store i8 0, i8* %21
%22 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [10 x i8]* %2)
%23 = call i32 @pclose(i32* %14)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%25 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str.6, i64 0, i64 0), i8* %8)
%26 = call i32* @popen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %18
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
br label %30
30: ; preds = %28, %18
%31 = call i32 @memset(i8* %7, i32 0, i32 1024)
%32 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %26)
store i8 0, i8* %21
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%34 = call i32 @pclose(i32* %26)
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 5000
br i1 %38, label %39, label %71
39: ; preds = %30
%40 = call i32 @sleep(i32 10)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.13, i64 0, i64 0))
%42 = call i32* @popen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
br label %46
46: ; preds = %44, %39
%47 = call i32 @memset(i8* %7, i32 0, i32 1024)
%48 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %42)
store i8 0, i8* %21
%49 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %5)
%50 = call i32 @pclose(i32* %42)
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %5
%54 = icmp sgt i32 %53, 5000
br i1 %54, label %55, label %71
55: ; preds = %46
%56 = call i32 @sleep(i32 10)
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.14, i64 0, i64 0))
%58 = call i32* @popen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
br label %62
62: ; preds = %60, %55
%63 = call i32 @memset(i8* %7, i32 0, i32 1024)
%64 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %58)
store i8 0, i8* %21
%65 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%66 = call i32 @pclose(i32* %58)
%67 = load i32, i32* %6
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %6
%70 = icmp sgt i32 %69, 5000
br i1 %70, label %72, label %71
71: ; preds = %46, %62, %30
br label %72
72: ; preds = %62, %71
%73 = phi i32 [ 0, %71 ], [ 1, %62 ]
ret i32 %73
}