#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 */
char *dcc_dialect_lookup(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void dcc_fix_opt_x(char **argv) {
  int i;
  for (i = 0; NULL != argv[i]; i++) {
    if (!strcmp(argv[i], "-x")) {
      char const *dialect = dcc_dialect_lookup(argv[i + 1]);
      if (dialect) {
        argv[i + 1] = (char *)dialect;
      }
    }
  }
  return;
}


x86 assembly (clang, -O0):
<dcc_fix_opt_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
xor    %eax,%eax
cmp    (%rcx,%rdx,8),%rax
je     11ba <dcc_fix_opt_x+0x9a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a7 <dcc_fix_opt_x+0x87>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <dcc_dialect_lookup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a2 <dcc_fix_opt_x+0x82>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    11a7 <dcc_fix_opt_x+0x87>
jmp    11ac <dcc_fix_opt_x+0x8c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <dcc_fix_opt_x+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcc_fix_opt_x>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     116a <dcc_fix_opt_x+0x4a>
add    $0x8,%rbx
lea    0xec6(%rip),%r14
jmp    114c <dcc_fix_opt_x+0x2c>
nopl   0x0(%rax)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     116a <dcc_fix_opt_x+0x4a>
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1140 <dcc_fix_opt_x+0x20>
mov    (%rbx),%rdi
call   1040 <dcc_dialect_lookup@plt>
test   %rax,%rax
je     1140 <dcc_fix_opt_x+0x20>
mov    %rax,(%rbx)
jmp    1140 <dcc_fix_opt_x+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-x\00"
define void @dcc_fix_opt_x(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i8*
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %5
5: ; preds = %39, %1
%6 = load i8**, i8*** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %6, i64 %8
%10 = load i8*, i8** %9
%11 = icmp ne i8* null, %10
br i1 %11, label %12, label %42
12: ; preds = %5
%13 = load i8**, i8*** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %38, label %20
20: ; preds = %12
%21 = load i8**, i8*** %2
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %21, i64 %24
%26 = load i8*, i8** %25
%27 = call i8* @dcc_dialect_lookup(i8* %26)
store i8* %27, i8** %4
%28 = load i8*, i8** %4
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %37
30: ; preds = %20
%31 = load i8*, i8** %4
%32 = load i8**, i8*** %2
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %32, i64 %35
store i8* %31, i8** %36
br label %37
37: ; preds = %30, %20
br label %38
38: ; preds = %37, %12
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %5
42: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-x\00"
define void @dcc_fix_opt_x(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %20, label %4
4: ; preds = %1, %16
%5 = phi i64 [ %9, %16 ], [ 0, %1 ]
%6 = phi i8* [ %18, %16 ], [ %2, %1 ]
%7 = tail call i32 @strcmp(i8* %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %16
10: ; preds = %4
%11 = getelementptr inbounds i8*, i8** %0, i64 %9
%12 = load i8*, i8** %11
%13 = tail call i8* @dcc_dialect_lookup(i8* %12)
%14 = icmp eq i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %10
store i8* %13, i8** %11
br label %16
16: ; preds = %4, %10, %15
%17 = getelementptr inbounds i8*, i8** %0, i64 %9
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %4
20: ; preds = %16, %1
ret void
}