#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 */
struct v4l2_fract {
  void *denominator;
  void *numerator;
};

/* Variables and functions */
int EINVAL;
scalar_t__ isspace(char const);
void *strtoul(char const *, char **, int);
int parse_frame_interval(struct v4l2_fract *interval, const char *p,
                         char **endp) {
  char *end;
  for (; isspace(*p); ++p)
    ;
  interval->numerator = strtoul(p, &end, 10);
  for (p = end; isspace(*p); ++p)
    ;
  if (*p++ != '/')
    return -EINVAL;
  for (; isspace(*p); ++p)
    ;
  interval->denominator = strtoul(p, &end, 10);
  *endp = end;
  return 0;
}


x86 assembly (clang, -O0):
<parse_frame_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1160 <parse_frame_interval+0x40>
jmp    114f <parse_frame_interval+0x2f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1134 <parse_frame_interval+0x14>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11b1 <parse_frame_interval+0x91>
jmp    11a0 <parse_frame_interval+0x80>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1185 <parse_frame_interval+0x65>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     11df <parse_frame_interval+0xbf>
xor    %eax,%eax
mov    0x2e0b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    123e <parse_frame_interval+0x11e>
jmp    11e4 <parse_frame_interval+0xc4>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1210 <parse_frame_interval+0xf0>
jmp    11ff <parse_frame_interval+0xdf>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e4 <parse_frame_interval+0xc4>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_frame_interval>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <parse_frame_interval+0x20>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,0x8(%r15)
mov    0x8(%rsp),%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1180 <parse_frame_interval+0x60>
cmpb   $0x2f,(%rbx)
jne    11d3 <parse_frame_interval+0xb3>
nopw   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    11a0 <parse_frame_interval+0x80>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,(%r15)
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
xor    %eax,%eax
jmp    11de <parse_frame_interval+0xbe>
mov    0x2e06(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.v4l2_fract = type { i8*, i8* }
@EINVAL = global i32 0
define i32 @parse_frame_interval(%struct.v4l2_fract* %0, i8* %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.v4l2_fract*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8*
store %struct.v4l2_fract* %0, %struct.v4l2_fract** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
br label %9
9: ; preds = %15, %3
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = call i64 @isspace(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
br label %15
15: ; preds = %14
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %6
br label %9
18: ; preds = %9
%19 = load i8*, i8** %6
%20 = call i8* @strtoul(i8* %19, i8** %8, i32 10)
%21 = load %struct.v4l2_fract*, %struct.v4l2_fract** %5
%22 = getelementptr inbounds %struct.v4l2_fract, %struct.v4l2_fract* %21, i32 0, i32 1
store i8* %20, i8** %22
%23 = load i8*, i8** %8
store i8* %23, i8** %6
br label %24
24: ; preds = %30, %18
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = call i64 @isspace(i8 signext %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %24
br label %30
30: ; preds = %29
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %6
br label %24
33: ; preds = %24
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %6
%36 = load i8, i8* %34
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 47
br i1 %38, label %39, label %42
39: ; preds = %33
%40 = load i32, i32* @EINVAL
%41 = sub nsw i32 0, %40
store i32 %41, i32* %4
br label %59
42: ; preds = %33
br label %43
43: ; preds = %49, %42
%44 = load i8*, i8** %6
%45 = load i8, i8* %44
%46 = call i64 @isspace(i8 signext %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %43
br label %49
49: ; preds = %48
%50 = load i8*, i8** %6
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %6
br label %43
52: ; preds = %43
%53 = load i8*, i8** %6
%54 = call i8* @strtoul(i8* %53, i8** %8, i32 10)
%55 = load %struct.v4l2_fract*, %struct.v4l2_fract** %5
%56 = getelementptr inbounds %struct.v4l2_fract, %struct.v4l2_fract* %55, i32 0, i32 0
store i8* %54, i8** %56
%57 = load i8*, i8** %8
%58 = load i8**, i8*** %7
store i8* %57, i8** %58
store i32 0, i32* %4
br label %59
59: ; preds = %52, %39
%60 = load i32, i32* %4
ret i32 %60
}

LLVM IR (-O2):
%struct.v4l2_fract = type { i8*, i8* }
@EINVAL = global i32 0
define i32 @parse_frame_interval(%struct.v4l2_fract* nocapture writeonly %0, i8* %1, i8** nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
br label %6
6: ; preds = %6, %3
%7 = phi i8* [ %1, %3 ], [ %11, %6 ]
%8 = load i8, i8* %7
%9 = tail call i64 @isspace(i8 signext %8)
%10 = icmp eq i64 %9, 0
%11 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = call i8* @strtoul(i8* %7, i8** %4, i32 10)
%14 = getelementptr inbounds %struct.v4l2_fract, %struct.v4l2_fract* %0, i64 0, i32 1
store i8* %13, i8** %14
%15 = load i8*, i8** %4
br label %16
16: ; preds = %16, %12
%17 = phi i8* [ %15, %12 ], [ %21, %16 ]
%18 = load i8, i8* %17
%19 = tail call i64 @isspace(i8 signext %18)
%20 = icmp eq i64 %19, 0
%21 = getelementptr inbounds i8, i8* %17, i64 1
br i1 %20, label %22, label %16
22: ; preds = %16
%23 = load i8, i8* %17
%24 = icmp eq i8 %23, 47
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* @EINVAL
%27 = sub nsw i32 0, %26
br label %38
28: ; preds = %22, %28
%29 = phi i8* [ %30, %28 ], [ %17, %22 ]
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = tail call i64 @isspace(i8 signext %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %28
34: ; preds = %28
%35 = call i8* @strtoul(i8* %30, i8** %4, i32 10)
%36 = getelementptr inbounds %struct.v4l2_fract, %struct.v4l2_fract* %0, i64 0, i32 0
store i8* %35, i8** %36
%37 = load i8*, i8** %4
store i8* %37, i8** %2
br label %38
38: ; preds = %34, %25
%39 = phi i32 [ %27, %25 ], [ 0, %34 ]
ret i32 %39
}