#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 const *, char);
scalar_t__ strncmp(char const *, char const *, int);
int xdg_mime_media_type_equal(const char *mime_a, const char *mime_b) {
  char *sep;
  sep = strchr(mime_a, '/');
  if (sep && strncmp(mime_a, mime_b, sep - mime_a + 1) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<xdg_mime_media_type_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1181 <xdg_mime_media_type_equal+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1181 <xdg_mime_media_type_equal+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1188 <xdg_mime_media_type_equal+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdg_mime_media_type_equal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1150 <xdg_mime_media_type_equal+0x30>
sub    %ebx,%eax
add    $0x1,%eax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1154 <xdg_mime_media_type_equal+0x34>
xor    %eax,%eax
jmp    1159 <xdg_mime_media_type_equal+0x39>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @xdg_mime_media_type_equal(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i8* @strchr(i8* %7, i8 signext 47)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %24
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = load i8*, i8** %4
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = add nsw i64 %18, 1
%20 = trunc i64 %19 to i32
%21 = call i64 @strncmp(i8* %12, i8* %13, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %11
store i32 1, i32* %3
br label %25
24: ; preds = %11, %2
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @xdg_mime_media_type_equal(i8* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 47)
%4 = icmp eq i8* %3, null
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = ptrtoint i8* %3 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = add i32 %9, 1
%11 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %5, %2
br label %14
14: ; preds = %5, %13
%15 = phi i32 [ 0, %13 ], [ 1, %5 ]
ret i32 %15
}