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


x86 assembly (clang, -O0):
<extractValueFromPut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x50(%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    -0x50(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractValueFromPut>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r15
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    $0x29,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
sub    %r15,%r14
sub    %r15d,%ebx
mov    %rsp,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movslq %r14d,%rax
lea    (%r15,%rax,1),%rsi
add    $0x1,%rsi
sub    %eax,%ebx
mov    %r12,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
mov    %r12,%rdi
call   1060 <atoi@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
@.str.1 = [2 x i8] c")\00"
define i32 @extractValueFromPut(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [32 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 [32 x i8], [32 x i8]* %8, i64 0, i64 0
%26 = call i32 @memset(i8* %25, i32 0, i32 32)
%27 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%28 = load i8*, i8** %2
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = sub nsw i32 %33, %34
%36 = call i32 @strncpy(i8* %27, i8* %32, i32 %35)
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %7
%39 = load i32, i32* %7
ret i32 %39
}

LLVM IR (-O2):
define i32 @extractValueFromPut(i8* %0) {
%2 = alloca [32 x i8]
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 44)
%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 [32 x i8], [32 x i8]* %2, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i32 0, i32 32)
%14 = shl i64 %7, 32
%15 = ashr exact i64 %14, 32
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = sub nsw i32 %11, %8
%19 = call i32 @strncpy(i8* %12, i8* %17, i32 %18)
%20 = call i32 @atoi(i8* %12)
ret i32 %20
}