#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 strncmp(char *, char *, int);
int checkFirstDigits(char *isbn) {
  char start1[] = "978";
  char start2[] = "979";
  int first = strncmp(isbn, start1, 3);
  int sec = strncmp(isbn, start2, 3);
  if (first == 0 || sec == 0) {
    return 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<checkFirstDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xede(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     116c <checkFirstDigits+0x5c>
cmpl   $0x0,-0x20(%rbp)
jne    1178 <checkFirstDigits+0x68>
movl   $0x1,-0x4(%rbp)
jmp    117f <checkFirstDigits+0x6f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFirstDigits>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x383739,0x4(%rsp)
movl   $0x393739,(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %ebp,%ebp
sete   %cl
test   %eax,%eax
sete   %al
or     %cl,%al
movzbl %al,%eax
add    %eax,%eax
add    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.checkFirstDigits.start1 = [4 x i8] c"978\00"
@__const.checkFirstDigits.start2 = [4 x i8] c"979\00"
define i32 @checkFirstDigits(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [4 x i8]
%5 = alloca [4 x i8]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
%8 = bitcast [4 x i8]* %4 to i8*
%9 = bitcast [4 x i8]* %5 to i8*
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%12 = call i32 @strncmp(i8* %10, i8* %11, i32 3)
store i32 %12, i32* %6
%13 = load i8*, i8** %3
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%15 = call i32 @strncmp(i8* %13, i8* %14, i32 3)
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %1
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18, %1
store i32 1, i32* %2
br label %23
22: ; preds = %18
store i32 -1, i32* %2
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @checkFirstDigits(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 3684153, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 3749689, i32* %3
%6 = call i32 @strncmp(i8* %0, i8* %4, i32 3)
%7 = call i32 @strncmp(i8* %0, i8* %5, i32 3)
%8 = icmp eq i32 %6, 0
%9 = icmp eq i32 %7, 0
%10 = select i1 %8, i1 true, i1 %9
%11 = select i1 %10, i32 1, i32 -1
ret i32 %11
}