#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 /*<<< orphan*/ free(char *);
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 **s = var;
    char *copy = strdup(param);
    if (!copy)
      return alloc_failed();
    free(*s);
    *s = 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    $0x40,%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   1040 <assert@plt>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x73,%eax
jne    11eb <process_opt_param+0x8b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11cf <process_opt_param+0x6f>
mov    $0x0,%al
call   1070 <alloc_failed@plt>
mov    %eax,-0x4(%rbp)
jmp    1236 <process_opt_param+0xd6>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
jmp    122f <process_opt_param+0xcf>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     122a <process_opt_param+0xca>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xde7(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1236 <process_opt_param+0xd6>
jmp    122f <process_opt_param+0xcf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%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   1040 <assert@plt>
cmpb   $0x73,0x1(%rbx)
jne    11a7 <process_opt_param+0x47>
mov    %r12,%rdi
call   1080 <strdup@plt>
test   %rax,%rax
je     11e7 <process_opt_param+0x87>
mov    %rax,%rbx
mov    (%r15),%rdi
call   1030 <free@plt>
mov    %rbx,(%r15)
xor    %eax,%eax
jmp    11db <process_opt_param+0x7b>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
je     11db <process_opt_param+0x7b>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe32(%rip),%rsi
mov    %r14,%rdx
call   1050 <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    1070 <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**
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%12 = load i8*, i8** %7
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 37
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i8*, i8** %7
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 115
br i1 %23, label %24, label %39
24: ; preds = %4
%25 = load i8*, i8** %6
%26 = bitcast i8* %25 to i8**
store i8** %26, i8*** %10
%27 = load i8*, i8** %8
%28 = call i8* @strdup(i8* %27)
store i8* %28, i8** %11
%29 = load i8*, i8** %11
%30 = icmp ne i8* %29, null
br i1 %30, label %33, label %31
31: ; preds = %24
%32 = call i32 (...) @alloc_failed()
store i32 %32, i32* %5
br label %51
33: ; preds = %24
%34 = load i8**, i8*** %10
%35 = load i8*, i8** %34
%36 = call i32 @free(i8* %35)
%37 = load i8*, i8** %11
%38 = load i8**, i8*** %10
store i8* %37, i8** %38
br label %50
39: ; preds = %4
%40 = load i8*, i8** %8
%41 = load i8*, i8** %7
%42 = load i8*, i8** %6
%43 = call i32 @sscanf(i8* %40, i8* %41, i8* %42)
%44 = icmp ne i32 %43, 1
br i1 %44, label %45, label %49
45: ; preds = %39
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %9
%48 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %47)
store i32 -1, i32* %5
br label %51
49: ; preds = %39
br label %50
50: ; preds = %49, %33
store i32 0, i32* %5
br label %51
51: ; preds = %50, %45, %31
%52 = load i32, i32* %5
ret i32 %52
}

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 %21
12: ; preds = %4
%13 = bitcast i8* %0 to i8**
%14 = tail call i8* @strdup(i8* %2)
%15 = icmp eq i8* %14, null
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i8*, i8** %13
%18 = tail call i32 @free(i8* %17)
store i8* %14, i8** %13
br label %27
19: ; preds = %12
%20 = tail call i32 (...) @alloc_failed()
br label %27
21: ; preds = %4
%22 = tail call i32 @sscanf(i8* %2, i8* %1, i8* %0)
%23 = icmp eq i32 %22, 1
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %27
27: ; preds = %21, %16, %19, %24
%28 = phi i32 [ %20, %19 ], [ -1, %24 ], [ 0, %16 ], [ 0, %21 ]
ret i32 %28
}