#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 */
scalar_t__ GetPostString(char *, char *, char *, int);
int sscanf(char *, char *, int *);
int GetPostInt(char *cBuffer, char *sSearch, int *dReturn) {
  char sAccum[256];
  if (GetPostString(cBuffer, sSearch, sAccum, 255) < 0) {
    return -1;
  }
  if (sscanf(sAccum, "%d", dReturn) != 1) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<GetPostInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0xff,%ecx
call   1030 <GetPostString@plt>
cmp    $0x0,%rax
jge    1166 <GetPostInt+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <GetPostInt+0x79>
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1192 <GetPostInt+0x72>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <GetPostInt+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPostInt>:
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%rbx
mov    %rsp,%rdx
mov    $0xff,%ecx
call   1030 <GetPostString@plt>
test   %rax,%rax
js     115d <GetPostInt+0x3d>
lea    0xebc(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1040 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
setne  %al
neg    %eax
jmp    1162 <GetPostInt+0x42>
mov    $0xffffffff,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @GetPostInt(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca [256 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%12 = call i64 @GetPostString(i8* %9, i8* %10, i8* %11, i32 255)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 -1, i32* %4
br label %22
15: ; preds = %3
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%17 = load i32*, i32** %7
%18 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 -1, i32* %4
br label %22
21: ; preds = %15
store i32 0, i32* %4
br label %22
22: ; preds = %21, %20, %14
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @GetPostInt(i8* %0, i8* %1, i32* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i64 @GetPostString(i8* %0, i8* %1, i8* %5, i32 255)
%7 = icmp slt i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = icmp ne i32 %9, 1
%11 = sext i1 %10 to i32
br label %12
12: ; preds = %8, %3
%13 = phi i32 [ -1, %3 ], [ %11, %8 ]
ret i32 %13
}