#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__ sscanf(char const *, char *, int *, int *);
int parse_fps(const char *fps, int *numerator, int *denominator) {
  int num = 0;
  int denom = 1;
  if (sscanf(fps, "%d/%d", &num, &denom) <= 0) {
    return 1;
  }
  if (numerator)
    *numerator = num;
  if (denominator)
    *denominator = denom;
  return 0;
}


x86 assembly (clang, -O0):
<parse_fps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <sscanf@plt>
cmp    $0x0,%rax
jg     1160 <parse_fps+0x50>
movl   $0x1,-0x4(%rbp)
jmp    118f <parse_fps+0x7f>
cmpq   $0x0,-0x18(%rbp)
je     1174 <parse_fps+0x64>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1188 <parse_fps+0x78>
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_fps>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
movl   $0x0,0x4(%rsp)
movl   $0x1,(%rsp)
lea    0xed0(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <sscanf@plt>
test   %rax,%rax
jle    115c <parse_fps+0x4c>
test   %rbx,%rbx
je     114d <parse_fps+0x3d>
mov    0x4(%rsp),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
test   %r14,%r14
je     1161 <parse_fps+0x51>
mov    (%rsp),%ecx
mov    %ecx,(%r14)
jmp    1161 <parse_fps+0x51>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d/%d\00"
define i32 @parse_fps(i8* %0, i32* writeonly %1, i32* writeonly %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%8 = call i64 @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%9 = icmp slt i64 %8, 1
br i1 %9, label %18, label %10
10: ; preds = %3
%11 = icmp eq i32* %1, null
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = load i32, i32* %4
store i32 %13, i32* %1
br label %14
14: ; preds = %12, %10
%15 = icmp eq i32* %2, null
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = load i32, i32* %5
store i32 %17, i32* %2
br label %18
18: ; preds = %14, %16, %3
%19 = phi i32 [ 1, %3 ], [ 0, %16 ], [ 0, %14 ]
ret i32 %19
}