#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 *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
int extractKeyFromGet(char request[]) {
  char *b = strstr(request, "("), *c = strstr(request, ")");
  int position = b - request, position1 = c - request, k;
  char to[4];
  strncpy(to, request + position + 1, position1 - position);
  k = atoi(to);
  fflush(stdout);
  return k;
}


x86 assembly (clang, -O0):
<extractKeyFromGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x20(%rbp)
lea    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
mov    -0x20(%rbp),%edx
sub    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
lea    -0x28(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractKeyFromGet>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x28,%esi
call   1040 <strchr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x29,%esi
call   1040 <strchr@plt>
sub    %rbx,%r14
sub    %ebx,%eax
movslq %r14d,%rcx
lea    (%rbx,%rcx,1),%rsi
add    $0x1,%rsi
sub    %ecx,%eax
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"(\00"
@.str.1 = [2 x i8] c")\00"
@stdout = global i32 0
define i32 @extractKeyFromGet(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4 x i8]
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i8* @strstr(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %3
%11 = load i8*, i8** %2
%12 = call i8* @strstr(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %12, i8** %4
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
store i32 %18, i32* %5
%19 = load i8*, i8** %4
%20 = load i8*, i8** %2
%21 = ptrtoint i8* %19 to i64
%22 = ptrtoint i8* %20 to i64
%23 = sub i64 %21, %22
%24 = trunc i64 %23 to i32
store i32 %24, i32* %6
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%26 = load i8*, i8** %2
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i32, i32* %6
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
%34 = call i32 @strncpy(i8* %25, i8* %30, i32 %33)
%35 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %7
%37 = load i32, i32* @stdout
%38 = call i32 @fflush(i32 %37)
%39 = load i32, i32* %7
ret i32 %39
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @extractKeyFromGet(i8* %0) {
%2 = alloca [4 x i8]
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 40)
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 41)
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = ptrtoint i8* %4 to i64
%10 = sub i64 %9, %6
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%13 = shl i64 %7, 32
%14 = ashr exact i64 %13, 32
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = sub nsw i32 %11, %8
%18 = call i32 @strncpy(i8* %12, i8* %16, i32 %17)
%19 = call i32 @atoi(i8* %12)
%20 = load i32, i32* @stdout
%21 = call i32 @fflush(i32 %20)
ret i32 %19
}