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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int process_gopt(struct fuse_opt_context *, char const *, int);
int process_real_option_group(struct fuse_opt_context *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char const *, char);
char *strdup(char const *);
int process_option_group(struct fuse_opt_context *ctx, const char *opts) {
  int res;
  char *copy;
  const char *sep = strchr(opts, ',');
  if (!sep)
    return process_gopt(ctx, opts, 1);
  copy = strdup(opts);
  if (!copy) {
    fprintf(stderr, "fuse: memory allocation failed\n");
    return -1;
  }
  res = process_real_option_group(ctx, copy);
  free(copy);
  return res;
}


x86 assembly (clang, -O0):
<process_option_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2c,%esi
call   1050 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11a7 <process_option_group+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1070 <process_gopt@plt>
mov    %eax,-0x4(%rbp)
jmp    11ff <process_option_group+0x9f>
mov    -0x18(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11e0 <process_option_group+0x80>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ff <process_option_group+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <process_real_option_group@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_option_group>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x2c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11a5 <process_option_group+0x45>
mov    %rbx,%rdi
call   1080 <strdup@plt>
test   %rax,%rax
je     11b9 <process_option_group+0x59>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <process_real_option_group@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    11d3 <process_option_group+0x73>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <process_gopt@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.fuse_opt_context = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"fuse: memory allocation failed\0A\00"
define i32 @process_option_group(%struct.fuse_opt_context* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.fuse_opt_context*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store %struct.fuse_opt_context* %0, %struct.fuse_opt_context** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = call i8* @strchr(i8* %9, i8 signext 44)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = load %struct.fuse_opt_context*, %struct.fuse_opt_context** %4
%15 = load i8*, i8** %5
%16 = call i32 @process_gopt(%struct.fuse_opt_context* %14, i8* %15, i32 1)
store i32 %16, i32* %3
br label %32
17: ; preds = %2
%18 = load i8*, i8** %5
%19 = call i8* @strdup(i8* %18)
store i8* %19, i8** %7
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %32
25: ; preds = %17
%26 = load %struct.fuse_opt_context*, %struct.fuse_opt_context** %4
%27 = load i8*, i8** %7
%28 = call i32 @process_real_option_group(%struct.fuse_opt_context* %26, i8* %27)
store i32 %28, i32* %6
%29 = load i8*, i8** %7
%30 = call i32 @free(i8* %29)
%31 = load i32, i32* %6
store i32 %31, i32* %3
br label %32
32: ; preds = %25, %22, %13
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
%struct.fuse_opt_context = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"fuse: memory allocation failed\0A\00"
define i32 @process_option_group(%struct.fuse_opt_context* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 44)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @process_gopt(%struct.fuse_opt_context* %0, i8* %1, i32 1)
br label %16
7: ; preds = %2
%8 = tail call i8* @strdup(i8* %1)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %7
%14 = tail call i32 @process_real_option_group(%struct.fuse_opt_context* %0, i8* %8)
%15 = tail call i32 @free(i8* %8)
br label %16
16: ; preds = %13, %10, %5
%17 = phi i32 [ %14, %13 ], [ -1, %10 ], [ %6, %5 ]
ret i32 %17
}