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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11c5 <main+0xa5>
mov    -0x14(%rbp),%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%ecx
lea    0xeb8(%rip),%rdx
lea    0xead(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1144 <main+0x24>
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
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11eb <main+0xbb>
lea    0xeb5(%rip),%r13
lea    0xeb2(%rip),%rbp
lea    0xe8d(%rip),%r14
lea    0xed5(%rip),%r15
lea    0xe7c(%rip),%r12
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
movslq 0x4(%rsp),%rax
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rsi
imul   $0xc28f5c29,%eax,%eax
add    $0x51eb850,%eax
ror    $0x3,%eax
add    %ecx,%esi
cmp    $0x147ae15,%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 = [45 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 = [31 x i8] c"Enter next value(q to quit): \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %12, %2
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %6
%14 = sdiv i32 %13, 200
store i32 %14, i32* %7
%15 = load i32, i32* %6
%16 = srem i32 %15, 200
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 0, i32 1
%20 = load i32, i32* %7
%21 = add nsw i32 %20, %19
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i64
%26 = select i1 %24, 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)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %22, i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %9
29: ; preds = %9
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 = [44 x i8] c"Enter number of square feet to be painted: \00"
@str.6 = [30 x i8] c"Enter next value(q to quit): \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %21
8: ; preds = %2, %8
%9 = load i32, i32* %3
%10 = sdiv i32 %9, 200
%11 = srem i32 %9, 200
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
%14 = add nsw i32 %10, %13
%15 = icmp eq i32 %14, 1
%16 = select i1 %15, 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)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %14, i8* %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%20 = icmp eq i32 %19, 1
br i1 %20, label %8, label %21
21: ; preds = %8, %2
ret i32 0
}