#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 atoi(char *);
char *getenv(char *);
char *getparam(char *, char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char *user = NULL;
  char *param = NULL;
  char *content = NULL;
  char *request_method = getenv("REQUEST_METHOD");
  if (strcmp(request_method, "GET") != 0) {
    printf("Content-type: text/html\n\n");
    printf("Unknown REQUEST_METHOD. Use only GET !\n");
    return -1;
  };
  content = getenv("QUERY_STRING");
  user = getparam(content, "user=");
  param = getparam(content, "param=");
  printf("Content-type: text/html\n\n");
  int usR = 0;
  usR = atoi(user);
  if (usR == 1) {
    printf("<b>4546,k</b>\n");
  } else {
    printf("<b>kkkk</b>\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe82(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11c5 <main+0x75>
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    124a <main+0xfa>
lea    0xe89(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1040 <getparam@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1040 <getparam@plt>
mov    %rax,-0x18(%rbp)
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jne    1237 <main+0xe7>
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
jmp    1243 <main+0xf3>
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
call   1030 <getenv@plt>
lea    0xea8(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     118e <main+0x3e>
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
lea    0xed4(%rip),%rdi
jmp    11e9 <main+0x99>
lea    0xe7e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xe7c(%rip),%rsi
mov    %rax,%rdi
call   1050 <getparam@plt>
mov    %rax,%r14
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1050 <getparam@plt>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1070 <atoi@plt>
cmp    $0x1,%eax
lea    0xe5d(%rip),%rax
lea    0xe4a(%rip),%rdi
cmove  %rax,%rdi
xor    %ebx,%ebx
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"REQUEST_METHOD\00"
@.str.1 = [4 x i8] c"GET\00"
@.str.2 = [26 x i8] c"Content-type: text/html\0A\0A\00"
@.str.3 = [40 x i8] c"Unknown REQUEST_METHOD. Use only GET !\0A\00"
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [6 x i8] c"user=\00"
@.str.6 = [7 x i8] c"param=\00"
@.str.7 = [15 x i8] c"<b>4546,k</b>\0A\00"
@.str.8 = [13 x i8] c"<b>kkkk</b>\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
%7 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %30
14: ; preds = %0
%15 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = call i8* @getparam(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i8* %17, i8** %2
%18 = load i8*, i8** %4
%19 = call i8* @getparam(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
store i8* %19, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
%21 = load i8*, i8** %2
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %14
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %29
27: ; preds = %14
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
store i32 0, i32* %1
br label %30
30: ; preds = %29, %11
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [15 x i8] c"REQUEST_METHOD\00"
@.str.1 = [4 x i8] c"GET\00"
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [6 x i8] c"user=\00"
@.str.6 = [7 x i8] c"param=\00"
@str.9 = [12 x i8] c"<b>kkkk</b>\00"
@str.10 = [14 x i8] c"<b>4546,k</b>\00"
@str.11 = [25 x i8] c"Content-type: text/html\0A\00"
@str.12 = [39 x i8] c"Unknown REQUEST_METHOD. Use only GET !\00"
define i32 @main() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.11, i64 0, i64 0))
br label %14
6: ; preds = %0
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i8* @getparam(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i8* @getparam(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.11, i64 0, i64 0))
%11 = tail call i32 @atoi(i8* %8)
%12 = icmp eq i32 %11, 1
%13 = select i1 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0)
br label %14
14: ; preds = %6, %4
%15 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0), %4 ], [ %13, %6 ]
%16 = phi i32 [ -1, %4 ], [ 0, %6 ]
%17 = tail call i32 @puts(i8* dereferenceable(1) %15)
ret i32 %16
}