#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__ ceil(float);
scalar_t__ floor(float);
int sscanf(char const *, char *, ...);
int scan_bbox(const char *line, int bbox[4]) {
  float fx0, fy0, fx1, fy1;
  if (sscanf(line, "%d %d %d %d", &bbox[0], &bbox[1], &bbox[2], &bbox[3]) == 4)
    return 1;
  if (sscanf(line, "%f %f %f %f", &fx0, &fy0, &fx1, &fy1) != 4)
    return 0;
  bbox[0] = (int)floor(fx0);
  bbox[1] = (int)floor(fy0);
  bbox[2] = (int)ceil(fx1);
  bbox[3] = (int)ceil(fy1);
  return 1;
}


x86 assembly (clang, -O0):
<scan_bbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
add    $0x4,%rcx
mov    -0x18(%rbp),%r8
add    $0x8,%r8
mov    -0x18(%rbp),%r9
add    $0xc,%r9
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x4,%eax
jne    1183 <scan_bbox+0x53>
movl   $0x1,-0x4(%rbp)
jmp    120c <scan_bbox+0xdc>
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x4,%eax
je     11ba <scan_bbox+0x8a>
movl   $0x0,-0x4(%rbp)
jmp    120c <scan_bbox+0xdc>
movss  -0x1c(%rbp),%xmm0
call   1050 <floor@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movss  -0x20(%rbp),%xmm0
call   1050 <floor@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
movss  -0x24(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
movss  -0x28(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_bbox>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0x4(%rsi),%rcx
lea    0x8(%rsi),%r8
lea    0xc(%rsi),%r9
lea    0xeaf(%rip),%rsi
xor    %r14d,%r14d
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x4,%eax
je     11c1 <scan_bbox+0x91>
lea    0xea2(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rsp,%r9
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x4,%eax
jne    11c7 <scan_bbox+0x97>
movss  0xc(%rsp),%xmm0
call   1050 <floor@plt>
mov    %eax,(%rbx)
movss  0x8(%rsp),%xmm0
call   1050 <floor@plt>
mov    %eax,0x4(%rbx)
movss  0x4(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %eax,0x8(%rbx)
movss  (%rsp),%xmm0
call   1030 <ceil@plt>
mov    %eax,0xc(%rbx)
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [12 x i8] c"%f %f %f %f\00"
define i32 @scan_bbox(i8* nocapture %0, i32* %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = bitcast float* %5 to i8*
%10 = bitcast float* %6 to i8*
%11 = getelementptr inbounds i32, i32* %1, i64 1
%12 = getelementptr inbounds i32, i32* %1, i64 2
%13 = getelementptr inbounds i32, i32* %1, i64 3
%14 = tail call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %11, i32* %12, i32* %13)
%15 = icmp eq i32 %14, 4
br i1 %15, label %32, label %16
16: ; preds = %2
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float* %3, float* %4, float* %5, float* %6)
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %32
19: ; preds = %16
%20 = load float, float* %3
%21 = call i64 @floor(float %20)
%22 = trunc i64 %21 to i32
store i32 %22, i32* %1
%23 = load float, float* %4
%24 = call i64 @floor(float %23)
%25 = trunc i64 %24 to i32
store i32 %25, i32* %11
%26 = load float, float* %5
%27 = call i64 @ceil(float %26)
%28 = trunc i64 %27 to i32
store i32 %28, i32* %12
%29 = load float, float* %6
%30 = call i64 @ceil(float %29)
%31 = trunc i64 %30 to i32
store i32 %31, i32* %13
br label %32
32: ; preds = %16, %2, %19
%33 = phi i32 [ 1, %19 ], [ 1, %2 ], [ 0, %16 ]
ret i32 %33
}