#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
char *strstr(char *, char *);
int main() {
  char *s = "STATE: CONNECT OK";
  char *l = "CONNECT";
  char *p;
  p = strstr(s, "CONNECT");
  if (p)
    printf("%s", p);
  else
    printf("dd\n");
  int a = strlen("check_gprs");
  printf("%d\n", a);
  for (int i = 48; i < 122; ++i) {
    printf("%d  %x\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118b <main+0x5b>
mov    -0x20(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <main+0x69>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x30,-0x28(%rbp)
cmpl   $0x7a,-0x28(%rbp)
jge    11ec <main+0xbc>
mov    -0x28(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee7(%rip),%rdi
lea    0xed5(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <strlen@plt>
lea    0xed4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x30,%ebx
lea    0xec3(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x7a,%ebx
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"STATE: CONNECT OK\00"
@.str.1 = [8 x i8] c"CONNECT\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"dd\0A\00"
@.str.4 = [11 x i8] c"check_gprs\00"
@.str.5 = [4 x i8] c"%d\0A\00"
@.str.6 = [8 x i8] c"%d %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %3
%7 = load i8*, i8** %2
%8 = call i8* @strstr(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i8*, i8** %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %18)
store i32 48, i32* %6
br label %20
20: ; preds = %27, %16
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 122
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i32, i32* %6
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %24, i32 %25)
br label %27
27: ; preds = %23
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %20
30: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"STATE: CONNECT OK\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.4 = [11 x i8] c"check_gprs\00"
@.str.5 = [4 x i8] c"%d\0A\00"
@.str.6 = [8 x i8] c"%d %x\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 7))
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %2)
br label %5
4: ; preds = %5
ret i32 0
5: ; preds = %0, %5
%6 = phi i32 [ 48, %0 ], [ %8, %5 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %6, i32 %6)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 122
br i1 %9, label %4, label %5
}