#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 *dcc_find_extension_const(char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
int dcc_is_preprocessed(const char *sfile) {
  const char *dot, *ext;
  dot = dcc_find_extension_const(sfile);
  if (!dot)
    return 0;
  ext = dot + 1;
  switch (ext[0]) {
  case 'i':
    return !strcmp(ext, "i") || !strcmp(ext, "ii");
  case 'm':
    return !strcmp(ext, "mi") || !strcmp(ext, "mii");
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<dcc_is_preprocessed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <dcc_find_extension_const@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <dcc_is_preprocessed+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1222 <dcc_is_preprocessed+0x102>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x69,%eax
je     1185 <dcc_is_preprocessed+0x65>
jmp    1174 <dcc_is_preprocessed+0x54>
mov    -0x24(%rbp),%eax
sub    $0x6d,%eax
je     11d0 <dcc_is_preprocessed+0xb0>
jmp    121b <dcc_is_preprocessed+0xfb>
mov    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
je     11c0 <dcc_is_preprocessed+0xa0>
mov    -0x20(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <dcc_is_preprocessed+0x102>
mov    -0x20(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x26(%rbp)
je     120b <dcc_is_preprocessed+0xeb>
mov    -0x20(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <dcc_is_preprocessed+0x102>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcc_is_preprocessed>:
push   %rbx
call   1030 <dcc_find_extension_const@plt>
test   %rax,%rax
je     115c <dcc_is_preprocessed+0x3c>
mov    %rax,%rbx
add    $0x1,%rbx
movsbl 0x1(%rax),%eax
cmp    $0x6d,%eax
je     1160 <dcc_is_preprocessed+0x40>
cmp    $0x69,%eax
jne    115c <dcc_is_preprocessed+0x3c>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1189 <dcc_is_preprocessed+0x69>
lea    0xeaa(%rip),%rsi
jmp    117a <dcc_is_preprocessed+0x5a>
xor    %eax,%eax
jmp    118b <dcc_is_preprocessed+0x6b>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1189 <dcc_is_preprocessed+0x69>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
sete   %al
jmp    118b <dcc_is_preprocessed+0x6b>
mov    $0x1,%al
movzbl %al,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"i\00"
@.str.1 = [3 x i8] c"ii\00"
@.str.2 = [3 x i8] c"mi\00"
@.str.3 = [4 x i8] c"mii\00"
define i32 @dcc_is_preprocessed(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @dcc_find_extension_const(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %2
br label %43
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %42 [
i32 105, label %18
i32 109, label %30
]
18: ; preds = %11
%19 = load i8*, i8** %5
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br label %27
27: ; preds = %22, %18
%28 = phi i1 [ true, %18 ], [ %26, %22 ]
%29 = zext i1 %28 to i32
store i32 %29, i32* %2
br label %43
30: ; preds = %11
%31 = load i8*, i8** %5
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
%38 = xor i1 %37, true
br label %39
39: ; preds = %34, %30
%40 = phi i1 [ true, %30 ], [ %38, %34 ]
%41 = zext i1 %40 to i32
store i32 %41, i32* %2
br label %43
42: ; preds = %11
store i32 0, i32* %2
br label %43
43: ; preds = %42, %39, %27, %10
%44 = load i32, i32* %2
ret i32 %44
}

LLVM IR (-O2):
@.str = [2 x i8] c"i\00"
@.str.1 = [3 x i8] c"ii\00"
@.str.2 = [3 x i8] c"mi\00"
@.str.3 = [4 x i8] c"mii\00"
define i32 @dcc_is_preprocessed(i8* %0) {
%2 = tail call i8* @dcc_find_extension_const(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %20, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %20 [
i32 105, label %8
i32 109, label %14
]
8: ; preds = %4
%9 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br label %20
14: ; preds = %4
%15 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br label %20
20: ; preds = %4, %14, %17, %8, %11, %1
%21 = phi i1 [ false, %1 ], [ true, %8 ], [ %13, %11 ], [ true, %14 ], [ %19, %17 ], [ false, %4 ]
%22 = zext i1 %21 to i32
ret i32 %22
}