#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 */
char *dynamic_cat(char *, size_t *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, int *);
int read_alpha(char *s[], char *rezult[], size_t *rezult_size, char delim[]) {
  int num_read;
  char tmp[128];
  sscanf(*s, "%[a-zA-Z] %n", tmp, &num_read);
  *s += num_read;
  char *test;
  if (!(test = dynamic_cat(*rezult, rezult_size, tmp)))
    return -1;
  else
    *rezult = test;
  if (!(test = dynamic_cat(*rezult, rezult_size, delim)))
    return -1;
  else
    *rezult = test;
  return 0;
}


x86 assembly (clang, -O0):
<read_alpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xeb0(%rip),%rsi
lea    -0x2c(%rbp),%rcx
call   1030 <sscanf@plt>
mov    -0x2c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1040 <dynamic_cat@plt>
mov    %rax,-0xb8(%rbp)
cmp    $0x0,%rax
jne    11a0 <read_alpha+0x80>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f4 <read_alpha+0xd4>
mov    -0xb8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <dynamic_cat@plt>
mov    %rax,-0xb8(%rbp)
cmp    $0x0,%rax
jne    11df <read_alpha+0xbf>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f4 <read_alpha+0xd4>
mov    -0xb8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_alpha>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
mov    (%rdi),%rdi
lea    0xebb(%rip),%rsi
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%rcx
mov    %r12,%rdx
call   1030 <sscanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,0x0(%rbp)
mov    (%r15),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <dynamic_cat@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     1193 <read_alpha+0x73>
mov    %rax,(%r15)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <dynamic_cat@plt>
test   %rax,%rax
je     1193 <read_alpha+0x73>
mov    %rax,(%r15)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%[a-zA-Z] %n\00"
define i32 @read_alpha(i8** %0, i8** %1, i64* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [128 x i8]
%12 = alloca i8*
store i8** %0, i8*** %6
store i8** %1, i8*** %7
store i64* %2, i64** %8
store i8* %3, i8** %9
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%16 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %15, i32* %10)
%17 = load i32, i32* %10
%18 = load i8**, i8*** %6
%19 = load i8*, i8** %18
%20 = sext i32 %17 to i64
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8* %21, i8** %18
%22 = load i8**, i8*** %7
%23 = load i8*, i8** %22
%24 = load i64*, i64** %8
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%26 = call i8* @dynamic_cat(i8* %23, i64* %24, i8* %25)
store i8* %26, i8** %12
%27 = icmp ne i8* %26, null
br i1 %27, label %29, label %28
28: ; preds = %4
store i32 -1, i32* %5
br label %44
29: ; preds = %4
%30 = load i8*, i8** %12
%31 = load i8**, i8*** %7
store i8* %30, i8** %31
br label %32
32: ; preds = %29
%33 = load i8**, i8*** %7
%34 = load i8*, i8** %33
%35 = load i64*, i64** %8
%36 = load i8*, i8** %9
%37 = call i8* @dynamic_cat(i8* %34, i64* %35, i8* %36)
store i8* %37, i8** %12
%38 = icmp ne i8* %37, null
br i1 %38, label %40, label %39
39: ; preds = %32
store i32 -1, i32* %5
br label %44
40: ; preds = %32
%41 = load i8*, i8** %12
%42 = load i8**, i8*** %7
store i8* %41, i8** %42
br label %43
43: ; preds = %40
store i32 0, i32* %5
br label %44
44: ; preds = %43, %39, %28
%45 = load i32, i32* %5
ret i32 %45
}

LLVM IR (-O2):
@.str = [13 x i8] c"%[a-zA-Z] %n\00"
define i32 @read_alpha(i8** nocapture %0, i8** nocapture %1, i64* %2, i8* %3) {
%5 = alloca i32
%6 = alloca [128 x i8]
%7 = bitcast i32* %5 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %0
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8, i32* %5)
%11 = load i32, i32* %5
%12 = load i8*, i8** %0
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8* %14, i8** %0
%15 = load i8*, i8** %1
%16 = call i8* @dynamic_cat(i8* %15, i64* %2, i8* %8)
%17 = icmp eq i8* %16, null
br i1 %17, label %22, label %18
18: ; preds = %4
store i8* %16, i8** %1
%19 = call i8* @dynamic_cat(i8* %16, i64* %2, i8* %3)
%20 = icmp eq i8* %19, null
br i1 %20, label %22, label %21
21: ; preds = %18
store i8* %19, i8** %1
br label %22
22: ; preds = %18, %4, %21
%23 = phi i32 [ 0, %21 ], [ -1, %4 ], [ -1, %18 ]
ret i32 %23
}