#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 getchar();
scalar_t__ isdigit(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int str;
  printf("Input the characters: \n");
  for (;;) {
    str = getchar();
    printf("%c : %s digit\n", str, isdigit(str) ? "is" : "not");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
mov    -0x14(%rbp),%esi
mov    %rax,%rcx
lea    0xeb8(%rip),%rdx
lea    0xeae(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
mov    %rdx,-0x10(%rbp)
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    114d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb8(%rip),%r14
lea    0xeae(%rip),%r15
lea    0xe98(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
mov    %r15,%rdx
cmove  %r14,%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [24 x i8] c"Input the characters: \0A\00"
@.str.1 = [15 x i8] c"%c : %s digit\0A\00"
@.str.2 = [3 x i8] c"is\00"
@.str.3 = [4 x i8] c"not\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = call i64 @isdigit(i32 %7)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %6, i8* %11)
br label %4
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"%c : %s digit\0A\00"
@.str.2 = [3 x i8] c"is\00"
@.str.3 = [4 x i8] c"not\00"
@str = [23 x i8] c"Input the characters: \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @getchar()
%4 = tail call i64 @isdigit(i32 %3)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %3, i8* %6)
br label %2
}