#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*/ assert(int);
int fgetc(unsigned int);
unsigned int input(char *);
void main() {
  unsigned a = input("a");
  assert(fgetc(a) == 1);
  assert(fgetc(a) == 2);
  assert(fgetc(a) == 3);
  assert(fgetc(a) == 4);
  assert(fgetc(a) == 5);
  assert(fgetc(a) == 6);
  assert(fgetc(a) == 7);
  assert(fgetc(a) == 8);
  assert(fgetc(a) == 9);
  assert(fgetc(a) == 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <input@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x7,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <input@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x7,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <fgetc@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
pop    %rbx
jmp    1050 <assert@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @input(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @fgetc(i32 %3)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @fgetc(i32 %8)
%10 = icmp eq i32 %9, 2
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @fgetc(i32 %13)
%15 = icmp eq i32 %14, 3
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %1
%19 = call i32 @fgetc(i32 %18)
%20 = icmp eq i32 %19, 4
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %1
%24 = call i32 @fgetc(i32 %23)
%25 = icmp eq i32 %24, 5
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %1
%29 = call i32 @fgetc(i32 %28)
%30 = icmp eq i32 %29, 6
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i32, i32* %1
%34 = call i32 @fgetc(i32 %33)
%35 = icmp eq i32 %34, 7
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i32, i32* %1
%39 = call i32 @fgetc(i32 %38)
%40 = icmp eq i32 %39, 8
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load i32, i32* %1
%44 = call i32 @fgetc(i32 %43)
%45 = icmp eq i32 %44, 9
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = load i32, i32* %1
%49 = call i32 @fgetc(i32 %48)
%50 = icmp eq i32 %49, 10
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define void @main() {
%1 = tail call i32 @input(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @fgetc(i32 %1)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @fgetc(i32 %1)
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @fgetc(i32 %1)
%11 = icmp eq i32 %10, 3
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @fgetc(i32 %1)
%15 = icmp eq i32 %14, 4
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @fgetc(i32 %1)
%19 = icmp eq i32 %18, 5
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 @fgetc(i32 %1)
%23 = icmp eq i32 %22, 6
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 @fgetc(i32 %1)
%27 = icmp eq i32 %26, 7
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call i32 @fgetc(i32 %1)
%31 = icmp eq i32 %30, 8
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32 @fgetc(i32 %1)
%35 = icmp eq i32 %34, 9
%36 = zext i1 %35 to i32
%37 = tail call i32 @assert(i32 %36)
%38 = tail call i32 @fgetc(i32 %1)
%39 = icmp eq i32 %38, 10
%40 = zext i1 %39 to i32
%41 = tail call i32 @assert(i32 %40)
ret void
}