#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*/ intToString(unsigned long, char *);
int strlen(char *);
int contains19(unsigned long int a) {
  char number[20];
  int i;
  intToString(a, number);
  for (i = 0; i < strlen(number); i++) {
    if (number[i] != '1' && number[i] != '9') {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<contains19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <intToString@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    119f <contains19+0x7f>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x31,%eax
je     118c <contains19+0x6c>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x39,%eax
je     118c <contains19+0x6c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <contains19+0x86>
jmp    1191 <contains19+0x71>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1140 <contains19+0x20>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains19>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <intToString@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    116d <contains19+0x4d>
xor    %ebx,%ebx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsp,%rbx,1),%eax
or     $0x8,%al
cmp    $0x39,%al
jne    1171 <contains19+0x51>
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1150 <contains19+0x30>
xor    %eax,%eax
jmp    1176 <contains19+0x56>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @contains19(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca [20 x i8]
%5 = alloca i32
store i64 %0, i64* %3
%6 = load i64, i64* %3
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%8 = call i32 @intToString(i64 %6, i8* %7)
store i32 0, i32* %5
br label %9
9: ; preds = %30, %1
%10 = load i32, i32* %5
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %33
14: ; preds = %9
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 49
br i1 %20, label %21, label %29
21: ; preds = %14
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 57
br i1 %27, label %28, label %29
28: ; preds = %21
store i32 -1, i32* %2
br label %34
29: ; preds = %21, %14
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %9
33: ; preds = %9
store i32 0, i32* %2
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @contains19(i64 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @intToString(i64 %0, i8* %3)
%5 = call i32 @strlen(i8* %3)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1, %11
%8 = phi i64 [ %12, %11 ], [ 0, %1 ]
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %16 [
i8 49, label %11
i8 57, label %11
]
11: ; preds = %7, %7
%12 = add nuw nsw i64 %8, 1
%13 = call i32 @strlen(i8* %3)
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %12, %14
br i1 %15, label %7, label %16
16: ; preds = %7, %11, %1
%17 = phi i32 [ 0, %1 ], [ 0, %11 ], [ -1, %7 ]
ret i32 %17
}