#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 */
scalar_t__ EOF;
scalar_t__ getint(int *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int ret = 0;
  int a = 0;
  printf("This program gets next integer from input into *pn,\n So give me "
         "some input:");
  while (getint(&a) != EOF)
    if (getint(&a) > 0)
      printf("\n\tYour value is %d", a);
    else {
      printf("\n\tThe value printed is not a number");
      continue;
    }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1040 <getint@plt>
mov    0x2e8d(%rip),%rcx
cmp    (%rcx),%rax
je     11a5 <main+0x85>
lea    -0xc(%rbp),%rdi
call   1040 <getint@plt>
cmp    $0x0,%rax
jle    118d <main+0x6d>
mov    -0xc(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x80>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114b <main+0x2b>
jmp    114b <main+0x2b>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <getint@plt>
mov    0x2e99(%rip),%r12
cmp    (%r12),%rax
jne    1163 <main+0x43>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0x4(%rsp),%rbx
lea    0xedd(%rip),%r14
lea    0xee9(%rip),%r15
jmp    1198 <main+0x78>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <getint@plt>
cmp    (%r12),%rax
je     1155 <main+0x35>
mov    %rbx,%rdi
call   1040 <getint@plt>
test   %rax,%rax
jle    1180 <main+0x60>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    118a <main+0x6a>

LLVM IR (-O0):
@.str = [76 x i8] c"This program gets next integer from input into *pn,\0A So give me some input:\00"
@EOF = global i64 0
@.str.1 = [19 x i8] c"\0A\09Your value is %d\00"
@.str.2 = [36 x i8] c"\0A\09The value printed is not a number\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %17, %15, %0
%6 = call i64 @getint(i32* %3)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = call i64 @getint(i32* %3)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %17
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %5
17: ; preds = %12
br label %5
18: ; preds = %5
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [76 x i8] c"This program gets next integer from input into *pn,\0A So give me some input:\00"
@EOF = global i64 0
@.str.1 = [19 x i8] c"\0A\09Your value is %d\00"
@.str.2 = [36 x i8] c"\0A\09The value printed is not a number\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @getint(i32* %1)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %19, label %7
7: ; preds = %0, %15
%8 = call i64 @getint(i32* %1)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %15
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i64 @getint(i32* %1)
%17 = load i64, i64* @EOF
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %7
19: ; preds = %15, %0
ret i32 0
}