#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 /*<<< orphan*/ stat_dev(char *);
unsigned int strlen(char *);
void process_bdev_param(char *optarg) {
  unsigned int len, i;
  char *str = optarg;
  len = strlen(optarg);
  for (i = 0; i < len; i++) {
    if (optarg[i] == ',') {
      optarg[i] = 0;
      stat_dev(str);
      str = optarg + i + 1;
    }
  }
  stat_dev(str);
}


x86 assembly (clang, -O0):
<process_bdev_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11a0 <process_bdev_param+0x80>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    118d <process_bdev_param+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1040 <stat_dev@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1192 <process_bdev_param+0x72>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <process_bdev_param+0x27>
mov    -0x18(%rbp),%rdi
call   1040 <stat_dev@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_bdev_param>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
je     1161 <process_bdev_param+0x41>
mov    %eax,%r15d
lea    0x1(%r14),%rbx
jmp    114a <process_bdev_param+0x2a>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r15
je     1161 <process_bdev_param+0x41>
cmpb   $0x2c,-0x1(%rbx)
jne    1140 <process_bdev_param+0x20>
movb   $0x0,-0x1(%rbx)
mov    %r14,%rdi
call   1040 <stat_dev@plt>
mov    %rbx,%r14
jmp    1140 <process_bdev_param+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <stat_dev@plt>

LLVM IR (-O0):
define void @process_bdev_param(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %5
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %3
store i32 0, i32* %4
br label %9
9: ; preds = %34, %1
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp ult i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 44
br i1 %20, label %21, label %33
21: ; preds = %13
%22 = load i8*, i8** %2
%23 = load i32, i32* %4
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %5
%27 = call i32 @stat_dev(i8* %26)
%28 = load i8*, i8** %2
%29 = load i32, i32* %4
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = getelementptr inbounds i8, i8* %31, i64 1
store i8* %32, i8** %5
br label %33
33: ; preds = %21, %13
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add i32 %35, 1
store i32 %36, i32* %4
br label %9
37: ; preds = %9
%38 = load i8*, i8** %5
%39 = call i32 @stat_dev(i8* %38)
ret void
}

LLVM IR (-O2):
define void @process_bdev_param(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %15
%7 = phi i64 [ 0, %4 ], [ %17, %15 ]
%8 = phi i8* [ %0, %4 ], [ %16, %15 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 44
br i1 %11, label %12, label %15
12: ; preds = %6
store i8 0, i8* %9
%13 = tail call i32 @stat_dev(i8* %8)
%14 = getelementptr inbounds i8, i8* %9, i64 1
br label %15
15: ; preds = %6, %12
%16 = phi i8* [ %14, %12 ], [ %8, %6 ]
%17 = add nuw nsw i64 %7, 1
%18 = icmp eq i64 %17, %5
br i1 %18, label %19, label %6
19: ; preds = %15, %1
%20 = phi i8* [ %0, %1 ], [ %16, %15 ]
%21 = tail call i32 @stat_dev(i8* %20)
ret void
}