#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 execvp(char *, char **);
int /*<<< orphan*/ perror(char *);
int main(int argc, char *argv[]) {
  if (argc > 1) {
    char path[128] = "/sbin/mdadm";
    char *parmList[] = {"/sbin/mdadm", "--detail", argv[1], NULL};
    int ret = execvp(path, parmList);
    if (ret == -1) {
      perror("execve error");
    }
  } else {
    perror("missing argument");
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d8 <main+0xa8>
lea    -0x90(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x80,%edx
call   1030 <memcpy@plt>
lea    0xf0e(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    0xf0c(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xa0(%rbp)
movq   $0x0,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1050 <execvp@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0xffffffff,-0xb4(%rbp)
jne    11d3 <main+0xa3>
lea    0xec7(%rip),%rdi
call   1040 <perror@plt>
jmp    11e4 <main+0xb4>
lea    0xec3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xa8,%rsp
cmp    $0x2,%edi
jl     11de <main+0xbe>
movaps 0xf39(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xf1a(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe6f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xee3(%rip),%rax
mov    %rax,(%rsp)
lea    0xee4(%rip),%rax
mov    %rax,0x8(%rsp)
mov    0x8(%rsi),%rax
mov    %rax,0x10(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <execvp@plt>
cmp    $0xffffffff,%eax
je     11e7 <main+0xc7>
mov    $0x1,%eax
add    $0xa8,%rsp
ret
lea    0xebd(%rip),%rdi
jmp    11ee <main+0xce>
lea    0xea7(%rip),%rdi
call   1030 <perror@plt>
jmp    11d1 <main+0xb1>

LLVM IR (-O0):
@__const.main.path = [128 x i8] c"/sbin/mdadm\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [12 x i8] c"/sbin/mdadm\00"
@.str.1 = [9 x i8] c"--detail\00"
@.str.2 = [13 x i8] c"execve error\00"
@.str.3 = [17 x i8] c"missing argument\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [4 x i8*]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %28
11: ; preds = %2
%12 = bitcast [128 x i8]* %6 to i8*
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %15
%19 = getelementptr inbounds i8*, i8** %15, i64 1
store i8* null, i8** %19
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
%22 = call i32 @execvp(i8* %20, i8** %21)
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %11
%26 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %11
br label %30
28: ; preds = %2
%29 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %27
ret i32 1
}

LLVM IR (-O2):
@__const.main.path = [128 x i8] c"/sbin/mdadm\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [12 x i8] c"/sbin/mdadm\00"
@.str.1 = [9 x i8] c"--detail\00"
@.str.2 = [13 x i8] c"execve error\00"
@.str.3 = [17 x i8] c"missing argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [4 x i8*]
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %20
6: ; preds = %2
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = bitcast [4 x i8*]* %4 to i8*
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %11
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 3
store i8* null, i8** %14
%15 = call i32 @execvp(i8* %7, i8** %9)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %6
%18 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %6
br label %22
20: ; preds = %2
%21 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %19
ret i32 1
}