#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int i, water, sugar, pSugar, pWater, pProduct;
  for (i = 0; i < 7; i++) {
    scanf("%d %d", &water, &sugar);
    pSugar = sugar / 15;
    pWater = water / 250;
    if (pWater > pSugar) {
      pProduct = pSugar;
    } else {
      pProduct = pWater;
    }
    if (water - (pProduct * 250) > 0) {
      printf("%d water\n", pProduct);
    } else {
      printf("%d\n", pProduct);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11d8 <main+0xb8>
lea    0xeb9(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xfa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1187 <main+0x67>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    118d <main+0x6d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
imul   $0xfa,-0x1c(%rbp),%ecx
sub    %ecx,%eax
cmp    $0x0,%eax
jle    11b6 <main+0x96>
mov    -0x1c(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
mov    -0x1c(%rbp),%esi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x7,%ebp
lea    0xec9(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
lea    0xec0(%rip),%rbx
lea    0xec3(%rip),%r13
jmp    115a <main+0x3a>
nop
call   1030 <printf@plt>
add    $0xffffffff,%ebp
je     11b5 <main+0x95>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
movslq (%rsp),%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x3,%ecx
add    %eax,%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rsi
mov    %rsi,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rsi
add    %edx,%esi
cmp    %ecx,%esi
cmovg  %ecx,%esi
imul   $0xffffff06,%esi,%ecx
add    %eax,%ecx
mov    %rbx,%rdi
test   %ecx,%ecx
jg     1150 <main+0x30>
mov    %r13,%rdi
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [10 x i8] c"%d water\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %37, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %40
11: ; preds = %8
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 15
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 250
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = load i32, i32* %5
store i32 %21, i32* %7
br label %24
22: ; preds = %11
%23 = load i32, i32* %6
store i32 %23, i32* %7
br label %24
24: ; preds = %22, %20
%25 = load i32, i32* %3
%26 = load i32, i32* %7
%27 = mul nsw i32 %26, 250
%28 = sub nsw i32 %25, %27
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i32, i32* %7
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %36
33: ; preds = %24
%34 = load i32, i32* %7
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %30
br label %37
37: ; preds = %36
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %8
40: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [10 x i8] c"%d water\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %19, %5 ]
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 15
%10 = load i32, i32* %1
%11 = sdiv i32 %10, 250
%12 = icmp sgt i32 %11, %9
%13 = select i1 %12, i32 %9, i32 %11
%14 = mul i32 %13, -250
%15 = add i32 %14, %10
%16 = icmp sgt i32 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%18 = call i32 @printf(i8* %17, i32 %13)
%19 = add nuw nsw i32 %6, 1
%20 = icmp eq i32 %19, 7
br i1 %20, label %21, label %5
21: ; preds = %5
ret i32 0
}