#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 */
char *strchr(char *, char const);
int lineck(const char *line) {
  char *chr, test[10] = "123456789";
  int c = 0;
  while (c < 9) {
    if (!(chr = strchr(test, line[c++])))
      return 0;
    *chr = '0';
  }
  return 1;
}


x86 assembly (clang, -O0):
<lineck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x22(%rbp)
mov    0xeda(%rip),%ax
mov    %ax,-0x1a(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x9,-0x28(%rbp)
jge    1188 <lineck+0x78>
lea    -0x22(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    117c <lineck+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    118f <lineck+0x7f>
mov    -0x18(%rbp),%rax
movb   $0x30,(%rax)
jmp    1139 <lineck+0x29>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lineck>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movabs $0x3837363534333231,%rax
36 37 38
mov    %rax,0x8(%rsp)
movw   $0x39,0x10(%rsp)
movsbl (%rdi),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x1(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x2(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x3(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x4(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x5(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x6(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x7(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
movsbl 0x8(%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1207 <lineck+0xf7>
movb   $0x30,(%rax)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.lineck.test = [10 x i8] c"123456789\00"
define i32 @lineck(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [10 x i8]
%6 = alloca i32
store i8* %0, i8** %3
%7 = bitcast [10 x i8]* %5 to i8*
store i32 0, i32* %6
br label %8
8: ; preds = %22, %1
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 9
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%13 = load i8*, i8** %3
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = call i8* @strchr(i8* %12, i8 signext %18)
store i8* %19, i8** %4
%20 = icmp ne i8* %19, null
br i1 %20, label %22, label %21
21: ; preds = %11
store i32 0, i32* %2
br label %25
22: ; preds = %11
%23 = load i8*, i8** %4
store i8 48, i8* %23
br label %8
24: ; preds = %8
store i32 1, i32* %2
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@__const.lineck.test = [10 x i8] c"123456789\00"
define i32 @lineck(i8* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = call i8* @strchr(i8* %3, i8 signext %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %48, label %7
7: ; preds = %1
store i8 48, i8* %5
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = call i8* @strchr(i8* %3, i8 signext %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %48, label %12
12: ; preds = %7
store i8 48, i8* %10
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
%15 = call i8* @strchr(i8* %3, i8 signext %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %48, label %17
17: ; preds = %12
store i8 48, i8* %15
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = call i8* @strchr(i8* %3, i8 signext %19)
%21 = icmp eq i8* %20, null
br i1 %21, label %48, label %22
22: ; preds = %17
store i8 48, i8* %20
%23 = getelementptr inbounds i8, i8* %0, i64 4
%24 = load i8, i8* %23
%25 = call i8* @strchr(i8* %3, i8 signext %24)
%26 = icmp eq i8* %25, null
br i1 %26, label %48, label %27
27: ; preds = %22
store i8 48, i8* %25
%28 = getelementptr inbounds i8, i8* %0, i64 5
%29 = load i8, i8* %28
%30 = call i8* @strchr(i8* %3, i8 signext %29)
%31 = icmp eq i8* %30, null
br i1 %31, label %48, label %32
32: ; preds = %27
store i8 48, i8* %30
%33 = getelementptr inbounds i8, i8* %0, i64 6
%34 = load i8, i8* %33
%35 = call i8* @strchr(i8* %3, i8 signext %34)
%36 = icmp eq i8* %35, null
br i1 %36, label %48, label %37
37: ; preds = %32
store i8 48, i8* %35
%38 = getelementptr inbounds i8, i8* %0, i64 7
%39 = load i8, i8* %38
%40 = call i8* @strchr(i8* %3, i8 signext %39)
%41 = icmp eq i8* %40, null
br i1 %41, label %48, label %42
42: ; preds = %37
store i8 48, i8* %40
%43 = getelementptr inbounds i8, i8* %0, i64 8
%44 = load i8, i8* %43
%45 = call i8* @strchr(i8* %3, i8 signext %44)
%46 = icmp eq i8* %45, null
br i1 %46, label %48, label %47
47: ; preds = %42
store i8 48, i8* %45
br label %48
48: ; preds = %47, %42, %37, %32, %27, %22, %17, %12, %7, %1
%49 = phi i32 [ 0, %1 ], [ 0, %7 ], [ 0, %12 ], [ 0, %17 ], [ 0, %22 ], [ 0, %27 ], [ 0, %32 ], [ 0, %37 ], [ 0, %42 ], [ 1, %47 ]
ret i32 %49
}