#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 RC_PROFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(unsigned char *, char *, unsigned char *);
int /*<<< orphan*/ system(unsigned char *);
int cache_device_stat(struct RC_PROFILE *rc_prof, unsigned char *cache) {
  unsigned char cmd[0x200] = {0};
  if (rc_prof == NULL) {
    printf("  No RapidDisk-Cache Mappings exist.\n\n");
    return 1;
  }
  sprintf(cmd, "dmsetup status %s", cache);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<cache_device_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1050 <memset@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1189 <cache_device_stat+0x49>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <cache_device_stat+0x73>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x220(%rbp),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_device_stat>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %ebp,%ebp
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
test   %rbx,%rbx
je     1186 <cache_device_stat+0x46>
lea    0xe92(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
jmp    1197 <cache_device_stat+0x57>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.RC_PROFILE = type { i32 }
@.str = [39 x i8] c" No RapidDisk-Cache Mappings exist.\0A\0A\00"
@.str.1 = [18 x i8] c"dmsetup status %s\00"
define i32 @cache_device_stat(%struct.RC_PROFILE* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.RC_PROFILE*
%5 = alloca i8*
%6 = alloca [512 x i8]
store %struct.RC_PROFILE* %0, %struct.RC_PROFILE** %4
store i8* %1, i8** %5
%7 = bitcast [512 x i8]* %6 to i8*
%8 = load %struct.RC_PROFILE*, %struct.RC_PROFILE** %4
%9 = icmp eq %struct.RC_PROFILE* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %18
12: ; preds = %2
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %5
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%17 = call i32 @system(i8* %16)
store i32 0, i32* %3
br label %18
18: ; preds = %12, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.RC_PROFILE = type { i32 }
@.str.1 = [18 x i8] c"dmsetup status %s\00"
@str = [38 x i8] c" No RapidDisk-Cache Mappings exist.\0A\00"
define i32 @cache_device_stat(%struct.RC_PROFILE* readnone %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp eq %struct.RC_PROFILE* %0, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %11
8: ; preds = %2
%9 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%10 = call i32 @system(i8* %4)
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %12
}