#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 scanf(char *, int *);
int main() {
  int sq_feet;
  int cans;
  printf("Enter number of square feet to be painted:\n");
  while (scanf("%d", &sq_feet) == 1) {
    cans = sq_feet / 350;
    cans += ((sq_feet % 350 == 0)) ? 0 : 1;
    printf("You need %d %s of paint.\n", cans, cans == 1 ? "can" : "cans");
    printf("Enter next value :\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11be <main+0x9e>
mov    -0x8(%rbp),%eax
mov    $0x15e,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x15e,%ecx
cltd
idiv   %ecx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%ecx
lea    0xebe(%rip),%rdx
lea    0xeb3(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ea <main+0xba>
lea    0xeb5(%rip),%r13
lea    0xeb2(%rip),%rbp
lea    0xe8d(%rip),%r14
lea    0xed4(%rip),%r15
lea    0xe7c(%rip),%r12
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
movslq 0x4(%rsp),%rax
imul   $0x5d9f7391,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rsi
imul   $0x1bcb564f,%eax,%eax
add    $0xbb3ee6,%eax
ror    %eax
add    %ecx,%esi
cmp    $0xbb3ee7,%eax
sbb    $0xffffffff,%esi
cmp    $0x1,%esi
mov    %rbp,%rdx
cmove  %r13,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Enter number of square feet to be painted:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"You need %d %s of paint.\0A\00"
@.str.3 = [4 x i8] c"can\00"
@.str.4 = [5 x i8] c"cans\00"
@.str.5 = [20 x i8] c"Enter next value :\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %8, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 350
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %11, 350
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 0, i32 1
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %18, i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %5
25: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"You need %d %s of paint.\0A\00"
@.str.3 = [4 x i8] c"can\00"
@.str.4 = [5 x i8] c"cans\00"
@str = [43 x i8] c"Enter number of square feet to be painted:\00"
@str.6 = [19 x i8] c"Enter next value :\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %19
6: ; preds = %0, %6
%7 = load i32, i32* %1
%8 = sdiv i32 %7, 350
%9 = srem i32 %7, 350
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
%12 = add nsw i32 %8, %11
%13 = icmp eq i32 %12, 1
%14 = select i1 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %12, i8* %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = icmp eq i32 %17, 1
br i1 %18, label %6, label %19
19: ; preds = %6, %0
ret i32 0
}