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

/* Variables and functions */
int /*<<< orphan*/ cli_error(struct cli_def *, char *, char const *,
                             char const *);
int /*<<< orphan*/ cli_set_optarg_value(struct cli_def *, char *, char const *,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ cli_set_transient_mode(struct cli_def *, int);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
int shape_transient_eval(struct cli_def *cli, const char *name,
                         const char *value) {
  printf("shape_transient_eval called with <%s>\n", value);
  if (!strcmp(value, "rectangle")) {
    cli_set_transient_mode(cli, 21);
    cli_set_optarg_value(cli, "duplicateShapeValue", value, 0);
    return 0;
  } else if (!strcmp(value, "triangle")) {
    cli_set_transient_mode(cli, 20);
    cli_set_optarg_value(cli, "duplicateShapeValue", value, 0);
    return 0;
  }
  cli_error(cli, "unrecognized value for setting %s -> %s", name, value);
  return -1;
}


x86 assembly (clang, -O0):
<shape_transient_eval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11bd <shape_transient_eval+0x6d>
mov    -0x10(%rbp),%rdi
mov    $0x15,%esi
call   1060 <cli_set_transient_mode@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe87(%rip),%rsi
xor    %ecx,%ecx
call   1070 <cli_set_optarg_value@plt>
movl   $0x0,-0x4(%rbp)
jmp    122a <shape_transient_eval+0xda>
mov    -0x20(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1206 <shape_transient_eval+0xb6>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1060 <cli_set_transient_mode@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe3e(%rip),%rsi
xor    %ecx,%ecx
call   1070 <cli_set_optarg_value@plt>
movl   $0x0,-0x4(%rbp)
jmp    122a <shape_transient_eval+0xda>
jmp    120b <shape_transient_eval+0xbb>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe30(%rip),%rsi
call   1030 <cli_error@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shape_transient_eval>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xe99(%rip),%rdi
mov    %rdx,%rsi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11b1 <shape_transient_eval+0x61>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11bb <shape_transient_eval+0x6b>
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1030 <cli_error@plt>
mov    $0xffffffff,%ebp
jmp    11de <shape_transient_eval+0x8e>
mov    %r14,%rdi
mov    $0x15,%esi
jmp    11c3 <shape_transient_eval+0x73>
mov    %r14,%rdi
mov    $0x14,%esi
call   1060 <cli_set_transient_mode@plt>
lea    0xe62(%rip),%rsi
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1070 <cli_set_optarg_value@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.cli_def = type { i32 }
@.str = [39 x i8] c"shape_transient_eval called with <%s>\0A\00"
@.str.1 = [10 x i8] c"rectangle\00"
@.str.2 = [20 x i8] c"duplicateShapeValue\00"
@.str.3 = [9 x i8] c"triangle\00"
@.str.4 = [40 x i8] c"unrecognized value for setting %s -> %s\00"
define i32 @shape_transient_eval(%struct.cli_def* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.cli_def*
%6 = alloca i8*
%7 = alloca i8*
store %struct.cli_def* %0, %struct.cli_def** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %7
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %3
%14 = load %struct.cli_def*, %struct.cli_def** %5
%15 = call i32 @cli_set_transient_mode(%struct.cli_def* %14, i32 21)
%16 = load %struct.cli_def*, %struct.cli_def** %5
%17 = load i8*, i8** %7
%18 = call i32 @cli_set_optarg_value(%struct.cli_def* %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %17, i32 0)
store i32 0, i32* %4
br label %35
19: ; preds = %3
%20 = load i8*, i8** %7
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = load %struct.cli_def*, %struct.cli_def** %5
%25 = call i32 @cli_set_transient_mode(%struct.cli_def* %24, i32 20)
%26 = load %struct.cli_def*, %struct.cli_def** %5
%27 = load i8*, i8** %7
%28 = call i32 @cli_set_optarg_value(%struct.cli_def* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %27, i32 0)
store i32 0, i32* %4
br label %35
29: ; preds = %19
br label %30
30: ; preds = %29
%31 = load %struct.cli_def*, %struct.cli_def** %5
%32 = load i8*, i8** %6
%33 = load i8*, i8** %7
%34 = call i32 @cli_error(%struct.cli_def* %31, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %32, i8* %33)
store i32 -1, i32* %4
br label %35
35: ; preds = %30, %23, %13
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
%struct.cli_def = type { i32 }
@.str = [39 x i8] c"shape_transient_eval called with <%s>\0A\00"
@.str.1 = [10 x i8] c"rectangle\00"
@.str.2 = [20 x i8] c"duplicateShapeValue\00"
@.str.3 = [9 x i8] c"triangle\00"
@.str.4 = [40 x i8] c"unrecognized value for setting %s -> %s\00"
define i32 @shape_transient_eval(%struct.cli_def* %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @cli_set_transient_mode(%struct.cli_def* %0, i32 21)
%9 = tail call i32 @cli_set_optarg_value(%struct.cli_def* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 0)
br label %18
10: ; preds = %3
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 @cli_set_transient_mode(%struct.cli_def* %0, i32 20)
%15 = tail call i32 @cli_set_optarg_value(%struct.cli_def* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 0)
br label %18
16: ; preds = %10
%17 = tail call i32 @cli_error(%struct.cli_def* %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
br label %18
18: ; preds = %16, %13, %7
%19 = phi i32 [ -1, %16 ], [ 0, %13 ], [ 0, %7 ]
ret i32 %19
}