#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 alloc_failed();
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int sscanf(char const *, char const *, void *);
int /*<<< orphan*/ stderr;
char *strdup(char const *);
int process_opt_param(void *var, const char *format, const char *param,
                      const char *arg) {
  assert(format[0] == '%');
  if (format[1] == 's') {
    char *copy = strdup(param);
    if (!copy)
      return alloc_failed();
    *(char **)var = copy;
  } else {
    if (sscanf(param, format, var) != 1) {
      fprintf(stderr, "fuse: invalid parameter in option `%s'\n", arg);
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<process_opt_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x73,%eax
jne    11c7 <process_opt_param+0x77>
mov    -0x20(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11b7 <process_opt_param+0x67>
mov    $0x0,%al
call   1060 <alloc_failed@plt>
mov    %eax,-0x4(%rbp)
jmp    1212 <process_opt_param+0xc2>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    120b <process_opt_param+0xbb>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     1206 <process_opt_param+0xb6>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe0b(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1212 <process_opt_param+0xc2>
jmp    120b <process_opt_param+0xbb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_opt_param>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %edi,%edi
cmpb   $0x25,(%rsi)
sete   %dil
call   1030 <assert@plt>
cmpb   $0x73,0x1(%rbx)
jne    118c <process_opt_param+0x3c>
mov    %r12,%rdi
call   1070 <strdup@plt>
test   %rax,%rax
je     11cc <process_opt_param+0x7c>
mov    %rax,(%r15)
xor    %eax,%eax
jmp    11c0 <process_opt_param+0x70>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
je     11c0 <process_opt_param+0x70>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <alloc_failed@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"fuse: invalid parameter in option `%s'\0A\00"
define i32 @process_opt_param(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %7
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 37
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 115
br i1 %22, label %23, label %34
23: ; preds = %4
%24 = load i8*, i8** %8
%25 = call i8* @strdup(i8* %24)
store i8* %25, i8** %10
%26 = load i8*, i8** %10
%27 = icmp ne i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %23
%29 = call i32 (...) @alloc_failed()
store i32 %29, i32* %5
br label %46
30: ; preds = %23
%31 = load i8*, i8** %10
%32 = load i8*, i8** %6
%33 = bitcast i8* %32 to i8**
store i8* %31, i8** %33
br label %45
34: ; preds = %4
%35 = load i8*, i8** %8
%36 = load i8*, i8** %7
%37 = load i8*, i8** %6
%38 = call i32 @sscanf(i8* %35, i8* %36, i8* %37)
%39 = icmp ne i32 %38, 1
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %9
%43 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %42)
store i32 -1, i32* %5
br label %46
44: ; preds = %34
br label %45
45: ; preds = %44, %30
store i32 0, i32* %5
br label %46
46: ; preds = %45, %40, %28
%47 = load i32, i32* %5
ret i32 %47
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"fuse: invalid parameter in option `%s'\0A\00"
define i32 @process_opt_param(i8* %0, i8* nocapture %1, i8* nocapture %2, i8* %3) {
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 37
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 115
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = tail call i8* @strdup(i8* %2)
%14 = icmp eq i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = bitcast i8* %0 to i8**
store i8* %13, i8** %16
br label %25
17: ; preds = %12
%18 = tail call i32 (...) @alloc_failed()
br label %25
19: ; preds = %4
%20 = tail call i32 @sscanf(i8* %2, i8* %1, i8* %0)
%21 = icmp eq i32 %20, 1
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %25
25: ; preds = %19, %15, %17, %22
%26 = phi i32 [ %18, %17 ], [ -1, %22 ], [ 0, %15 ], [ 0, %19 ]
ret i32 %26
}