#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *fstype(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  char *type = NULL;
  if (argc != 2) {
    fprintf(stdout, "Usage: fstyp <device>\n");
    exit(EXIT_FAILURE);
  }
  type = fstype(argv[1]);
  if (type) {
    fprintf(stdout, "%s\n", type);
    exit(EXIT_SUCCESS);
  }
  fprintf(stdout, "unknown\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117d <main+0x4d>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <fstype@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c2 <main+0x92>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1156 <main+0x26>
mov    0x8(%rsi),%rdi
call   1040 <fstype@plt>
mov    0x2e92(%rip),%rcx
mov    (%rcx),%edi
test   %rax,%rax
jne    117b <main+0x4b>
lea    0xec7(%rip),%rsi
jmp    1166 <main+0x36>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0xe95(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [23 x i8] c"Usage: fstyp <device>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [9 x i8] c"unknown\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stdout
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i8* @fstype(i8* %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* @stdout
%23 = load i8*, i8** %6
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %14
%28 = load i32, i32* @stdout
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [23 x i8] c"Usage: fstyp <device>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [9 x i8] c"unknown\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i8* @fstype(i8* %11)
%13 = icmp eq i8* %12, null
%14 = load i32, i32* @stdout
br i1 %13, label %19, label %15
15: ; preds = %9
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%17 = load i32, i32* @EXIT_SUCCESS
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %9
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
}