#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *strrmv(char *, char *);
char *strrmvbfr(char *, char *);
int /*<<< orphan*/ strsplit(char **, char *, char *);
int read_function(char *str, char *fct) {
  char *fct_name = strdup(fct);
  strcpy(fct_name, fct);
  strcat(fct_name, "(");
  char *reader = strdup(strrmvbfr(str, fct_name));
  reader = strrmv(reader, fct_name);
  char *spliting[10];
  strsplit(spliting, reader, ")");
  return atoi(spliting[0]);
}


x86 assembly (clang, -O0):
<read_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strrmvbfr@plt>
mov    %rax,%rdi
call   1090 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strrmv@plt>
mov    %rax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xe1f(%rip),%rdx
call   1080 <strsplit@plt>
mov    -0x70(%rbp),%rdi
call   1060 <atoi@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_function>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1090 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strrmvbfr@plt>
mov    %rax,%rdi
call   1090 <strdup@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <strrmv@plt>
lea    0xe39(%rip),%rdx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1080 <strsplit@plt>
mov    (%rsp),%rdi
call   1060 <atoi@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"(\00"
@.str.1 = [2 x i8] c")\00"
define i32 @read_function(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [10 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %4
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %3
%16 = load i8*, i8** %5
%17 = call i8* @strrmvbfr(i8* %15, i8* %16)
%18 = call i8* @strdup(i8* %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = load i8*, i8** %5
%21 = call i8* @strrmv(i8* %19, i8* %20)
store i8* %21, i8** %6
%22 = getelementptr inbounds [10 x i8*], [10 x i8*]* %7, i64 0, i64 0
%23 = load i8*, i8** %6
%24 = call i32 @strsplit(i8** %22, i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = getelementptr inbounds [10 x i8*], [10 x i8*]* %7, i64 0, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
ret i32 %27
}

LLVM IR (-O2):
@.str = [2 x i8] c"(\00"
@.str.1 = [2 x i8] c")\00"
define i32 @read_function(i8* %0, i8* %1) {
%3 = alloca [10 x i8*]
%4 = tail call i8* @strdup(i8* %1)
%5 = tail call i32 @strcpy(i8* %4, i8* %1)
%6 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i8* @strrmvbfr(i8* %0, i8* %4)
%8 = tail call i8* @strdup(i8* %7)
%9 = tail call i8* @strrmv(i8* %8, i8* %4)
%10 = bitcast [10 x i8*]* %3 to i8*
%11 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%12 = call i32 @strsplit(i8** %11, i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = load i8*, i8** %11
%14 = call i32 @atoi(i8* %13)
ret i32 %14
}