#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int money = 0, in;
  while (money < 200000) {
    scanf("%d", &in);
    money += (in >= 5000) ? in : 0;
  }
  if (money == 200000) {
    printf("Total = 200,000");
  } else {
    printf("Total = %d more than 200,000", money);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x30d40,-0x8(%rbp)
jge    1183 <main+0x63>
lea    0xeb6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1388,-0xc(%rbp)
jl     116b <main+0x4b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <main+0x55>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <main+0x55>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
cmpl   $0x30d40,-0x8(%rbp)
jne    11a3 <main+0x83>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
lea    0xed0(%rip),%r14
lea    0x4(%rsp),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1388,%eax
cmovl  %ebp,%eax
add    %eax,%ebx
cmp    $0x30d40,%ebx
jl     1140 <main+0x20>
jne    1173 <main+0x53>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1183 <main+0x63>
lea    0xe99(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Total = 200,000\00"
@.str.2 = [29 x i8] c"Total = %d more than 200,000\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 200000
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 5000
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i32, i32* %3
br label %14
13: ; preds = %7
br label %14
14: ; preds = %13, %11
%15 = phi i32 [ %12, %11 ], [ 0, %13 ]
%16 = load i32, i32* %2
%17 = add nsw i32 %16, %15
store i32 %17, i32* %2
br label %4
18: ; preds = %4
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 200000
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %26
23: ; preds = %18
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Total = 200,000\00"
@.str.2 = [29 x i8] c"Total = %d more than 200,000\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %9, %3 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 4999
%8 = select i1 %7, i32 %6, i32 0
%9 = add nsw i32 %8, %4
%10 = icmp slt i32 %9, 200000
br i1 %10, label %3, label %11
11: ; preds = %3
%12 = icmp eq i32 %9, 200000
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %17
17: ; preds = %15, %13
ret i32 0
}