#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_s(char *, double *);
int /*<<< orphan*/ system(char *);
int main(void) {
  double num;
  do {
    printf("Please enter a positive number: ");
    scanf_s("%lf", &num);
    printf("The number you have entered is: %f\n", num);
  } while (num <= 0);
  printf("That is a positive number! You win!", num);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf_s@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xebc(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    113f <main+0xf>
movsd  -0x10(%rbp),%xmm0
lea    0xebf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec9(%rip),%r14
lea    0xee3(%rip),%r15
mov    %rsp,%r12
lea    0xedd(%rip),%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf_s@plt>
movsd  (%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1150 <main+0x20>
lea    0xec7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Please enter a positive number: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [36 x i8] c"The number you have entered is: %f\0A\00"
@.str.3 = [36 x i8] c"That is a positive number! You win!\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf_s(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %6)
br label %8
8: ; preds = %3
%9 = load double, double* %2
%10 = fcmp ole double %9, 0.000000e+00
br i1 %10, label %3, label %11
11: ; preds = %8
%12 = load double, double* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %12)
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Please enter a positive number: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [36 x i8] c"The number you have entered is: %f\0A\00"
@.str.3 = [36 x i8] c"That is a positive number! You win!\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf_s(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%6 = load double, double* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load double, double* %1
%9 = fcmp ugt double %8, 0.000000e+00
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %8)
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}