#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  fprintf(stdout, "please input the value a:\n");
  int a;
  fscanf(stdin, "%d", &a);
  if (a < 0) {
    fprintf(stderr, "the value must > 0\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <fscanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1188 <main+0x68>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    118f <main+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <fscanf@plt>
xor    %eax,%eax
cmpl   $0x0,0x4(%rsp)
js     115b <main+0x3b>
pop    %rcx
ret
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [27 x i8] c"please input the value a:\0A\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"the value must > 0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i32 @fscanf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %13
12: ; preds = %0
store i32 0, i32* %1
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [27 x i8] c"please input the value a:\0A\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"the value must > 0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = load i32, i32* @stdin
%6 = call i32 @fscanf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %0, %9
%13 = phi i32 [ 1, %9 ], [ 0, %0 ]
ret i32 %13
}