#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 get_smart_data(char *, char **, int, int *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int result[2];
  char *cmd[2] = {"Retired_Block_Count", "Unexpect_Power_Loss_Ct"};
  int ret = -255;
  ret = get_smart_data("/dev/sda", cmd, 2, result);
  if (!ret) {
    printf("Result: %d\n", result[1]);
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2cd3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd0(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0xffffff01,-0x34(%rbp)
lea    -0x30(%rbp),%rsi
lea    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdi
mov    $0x2,%edx
call   1040 <get_smart_data@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1188 <main+0x68>
mov    -0x14(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0x2ce4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xef3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rcx
mov    $0x2,%edx
call   1040 <get_smart_data@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1162 <main+0x42>
mov    0xc(%rsp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Retired_Block_Count\00"
@.str.1 = [23 x i8] c"Unexpect_Power_Loss_Ct\00"
@__const.main.cmd = [2 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [9 x i8] c"/dev/sda\00"
@.str.3 = [12 x i8] c"Result: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [2 x i8*]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [2 x i8*]* %7 to i8*
store i32 -255, i32* %8
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%12 = call i32 @get_smart_data(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %10, i32 2, i32* %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %15, %2
%20 = load i32, i32* %8
ret i32 %20
}

LLVM IR (-O2):
@.str = [20 x i8] c"Retired_Block_Count\00"
@.str.1 = [23 x i8] c"Unexpect_Power_Loss_Ct\00"
@__const.main.cmd = [2 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [9 x i8] c"/dev/sda\00"
@.str.3 = [12 x i8] c"Result: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i8*]
%5 = bitcast [2 x i32]* %3 to i8*
%6 = bitcast [2 x i8*]* %4 to i8*
%7 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%9 = call i32 @get_smart_data(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %7, i32 2, i32* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %2
ret i32 %9
}