#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 /*<<< orphan*/ sscanf(char *, char *, int *);
int cParseIntFormat(char *buf, int *num, int *size) {
  char *tmp;
  tmp = buf;
  while (*tmp++ != '(')
    ;
  sscanf(tmp, "%d", num);
  while (*tmp != 'I' && *tmp != 'i')
    ++tmp;
  ++tmp;
  sscanf(tmp, "%d", size);
  return 0;
}


x86 assembly (clang, -O0):
<cParseIntFormat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x28,%eax
je     114c <cParseIntFormat+0x3c>
jmp    112c <cParseIntFormat+0x1c>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xea5(%rip),%rsi
call   1030 <sscanf@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x49,%ecx
mov    %al,-0x21(%rbp)
je     1185 <cParseIntFormat+0x75>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x69,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1195 <cParseIntFormat+0x85>
jmp    11a6 <cParseIntFormat+0x96>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1160 <cParseIntFormat+0x50>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe3f(%rip),%rsi
call   1030 <sscanf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cParseIntFormat>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%rbx
nopl   (%rax)
cmpb   $0x28,(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <cParseIntFormat+0x10>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sscanf@plt>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl -0x1(%rbx),%eax
or     $0x20,%al
cmp    $0x69,%al
jne    1140 <cParseIntFormat+0x30>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <sscanf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @cParseIntFormat(i8* nocapture %0, i32* %1, i32* %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i8* [ %0, %3 ], [ %6, %4 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = icmp eq i8 %7, 40
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = tail call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %11
11: ; preds = %14, %9
%12 = phi i8* [ %6, %9 ], [ %15, %14 ]
%13 = load i8, i8* %12
switch i8 %13, label %14 [
i8 73, label %16
i8 105, label %16
]
14: ; preds = %11
%15 = getelementptr inbounds i8, i8* %12, i64 1
br label %11
16: ; preds = %11, %11
%17 = getelementptr inbounds i8, i8* %12, i64 1
%18 = tail call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
ret i32 0
}