#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 */
typedef int /*<<< orphan*/ input;

/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main(void) {
  char input[255];
  double litres;
  double gallons_with_fraction;
  int gallons_whole;
  double fraction;
  while (fgets(input, sizeof(input), stdin) != NULL) {
    litres = atof(input);
    gallons_with_fraction = litres / 3.785;
    gallons_whole = (int)gallons_with_fraction;
    fraction = gallons_with_fraction - gallons_whole;
    if (fraction >= 0.5) {
      gallons_whole += 1;
    }
    printf("%d\n", gallons_whole);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1200 <main+0xd0>
lea    -0x110(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
cvttsd2si -0x120(%rbp),%eax
ff
mov    %eax,-0x124(%rbp)
movsd  -0x120(%rbp),%xmm0
ff
cvtsi2sdl -0x124(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x130(%rbp),%xmm0
ff
movsd  0xe30(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11e9 <main+0xb9>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
mov    -0x124(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    0x2ea5(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0xff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11b8 <main+0x88>
mov    %rsp,%rbx
lea    0xeae(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <atof@plt>
divsd  0xe80(%rip),%xmm0
cvttsd2si %xmm0,%esi
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
ucomisd 0xe70(%rip),%xmm0
sbb    $0xffffffff,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store i32 0, i32* %1
br label %7
7: ; preds = %28, %0
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 255, i32 %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %31
12: ; preds = %7
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%14 = call double @atof(i8* %13)
store double %14, double* %3
%15 = load double, double* %3
%16 = fdiv double %15, 3.785000e+00
store double %16, double* %4
%17 = load double, double* %4
%18 = fptosi double %17 to i32
store i32 %18, i32* %5
%19 = load double, double* %4
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to double
%22 = fsub double %19, %21
store double %22, double* %6
%23 = load double, double* %6
%24 = fcmp oge double %23, 5.000000e-01
br i1 %24, label %25, label %28
25: ; preds = %12
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %28
28: ; preds = %25, %12
%29 = load i32, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %7
31: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32* @fgets(i8* %2, i32 255, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %19, label %6
6: ; preds = %0, %6
%7 = call double @atof(i8* %2)
%8 = fdiv double %7, 3.785000e+00
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
%11 = fsub double %8, %10
%12 = fcmp oge double %11, 5.000000e-01
%13 = zext i1 %12 to i32
%14 = add nsw i32 %13, %9
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stdin
%17 = call i32* @fgets(i8* %2, i32 255, i32 %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %6
19: ; preds = %6, %0
ret i32 0
}