#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int c;
  int continu = 1;
  while (continu) {
    c = getchar();
    continu = (c != EOF);
    printf("c is %c (%d), (c != EOF) is %d.\n", c, c, continu);
  }
  printf("out of loop; c is %c (%d), (c != EOF) is %d.\n\n", c, c, continu);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117b <main+0x5b>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e94(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe96(%rip),%rdi
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
mov    0x2eba(%rip),%r15
lea    0xecb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    (%r15),%ebp
xor    %ecx,%ecx
cmp    %ebp,%eax
setne  %cl
mov    %r14,%rdi
mov    %eax,%esi
mov    %eax,%edx
call   1030 <printf@plt>
cmp    %ebp,%ebx
jne    1140 <main+0x20>
lea    0xeb7(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [33 x i8] c"c is %c (%d), (c != EOF) is %d.\0A\00"
@.str.1 = [47 x i8] c"out of loop; c is %c (%d), (c != EOF) is %d.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = call i32 (...) @getchar()
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
%12 = zext i1 %11 to i32
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
br label %4
17: ; preds = %4
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [33 x i8] c"c is %c (%d), (c != EOF) is %d.\0A\00"
@.str.1 = [47 x i8] c"out of loop; c is %c (%d), (c != EOF) is %d.\0A\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %2, %3
%5 = zext i1 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2, i32 %5)
br i1 %4, label %1, label %7
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %2, i32 0)
ret i32 0
}