#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 */
struct magic_set {
  int dummy;
};

/* Variables and functions */
int file_printf(struct magic_set *, char *, ...);
int handle_mime(struct magic_set *ms, int mime, const char *str) {
  if ((mime & 0x000010)) {
    if (file_printf(ms, "inode/%s", str) == -1)
      return -1;
    if ((mime & 0x000400) && file_printf(ms, "; charset=") == -1)
      return -1;
  }
  if ((mime & 0x000400) && file_printf(ms, "binary") == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<handle_mime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     119a <handle_mime+0x8a>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <file_printf@plt>
cmp    $0xffffffff,%eax
jne    115d <handle_mime+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <handle_mime+0xc9>
mov    -0x14(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     1195 <handle_mime+0x85>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1030 <file_printf@plt>
cmp    $0xffffffff,%eax
jne    1195 <handle_mime+0x85>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <handle_mime+0xc9>
jmp    119a <handle_mime+0x8a>
mov    -0x14(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     11d2 <handle_mime+0xc2>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <file_printf@plt>
cmp    $0xffffffff,%eax
jne    11d2 <handle_mime+0xc2>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <handle_mime+0xc9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_mime>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
test   $0x10,%bl
jne    1128 <handle_mime+0x18>
test   $0x400,%ebx
jne    1161 <handle_mime+0x51>
jmp    1177 <handle_mime+0x67>
lea    0xed1(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <file_printf@plt>
mov    $0xffffffff,%ebp
cmp    $0xffffffff,%eax
je     1179 <handle_mime+0x69>
test   $0x400,%ebx
je     1177 <handle_mime+0x67>
lea    0xeb7(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <file_printf@plt>
cmp    $0xffffffff,%eax
je     1179 <handle_mime+0x69>
lea    0xeac(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <file_printf@plt>
cmp    $0xffffffff,%eax
je     1180 <handle_mime+0x70>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0xffffffff,%ebp
jmp    1179 <handle_mime+0x69>

LLVM IR (-O0):
%struct.magic_set = type { i32 }
@.str = [9 x i8] c"inode/%s\00"
@.str.1 = [11 x i8] c"; charset=\00"
@.str.2 = [7 x i8] c"binary\00"
define i32 @handle_mime(%struct.magic_set* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.magic_set*
%6 = alloca i32
%7 = alloca i8*
store %struct.magic_set* %0, %struct.magic_set** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%8 = load i32, i32* %6
%9 = and i32 %8, 16
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %3
%12 = load %struct.magic_set*, %struct.magic_set** %5
%13 = load i8*, i8** %7
%14 = call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %4
br label %37
17: ; preds = %11
%18 = load i32, i32* %6
%19 = and i32 %18, 1024
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load %struct.magic_set*, %struct.magic_set** %5
%23 = call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 -1, i32* %4
br label %37
26: ; preds = %21, %17
br label %27
27: ; preds = %26, %3
%28 = load i32, i32* %6
%29 = and i32 %28, 1024
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load %struct.magic_set*, %struct.magic_set** %5
%33 = call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 -1, i32* %4
br label %37
36: ; preds = %31, %27
store i32 0, i32* %4
br label %37
37: ; preds = %36, %35, %25, %16
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
%struct.magic_set = type { i32 }
@.str = [9 x i8] c"inode/%s\00"
@.str.1 = [11 x i8] c"; charset=\00"
@.str.2 = [7 x i8] c"binary\00"
define i32 @handle_mime(%struct.magic_set* %0, i32 %1, i8* %2) {
%4 = and i32 %1, 16
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = tail call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = icmp eq i32 %7, -1
br i1 %8, label %22, label %9
9: ; preds = %6
%10 = and i32 %1, 1024
%11 = icmp eq i32 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = tail call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, -1
br i1 %14, label %22, label %18
15: ; preds = %3
%16 = and i32 %1, 1024
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %12, %15
%19 = tail call i32 (%struct.magic_set*, i8*, ...) @file_printf(%struct.magic_set* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, -1
br i1 %20, label %22, label %21
21: ; preds = %9, %18, %15
br label %22
22: ; preds = %18, %12, %6, %21
%23 = phi i32 [ 0, %21 ], [ -1, %6 ], [ -1, %12 ], [ -1, %18 ]
ret i32 %23
}