#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*/ ExecGeomOptions(char *, char *, char *);
int /*<<< orphan*/ PopSource();
int /*<<< orphan*/ PushSource(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ diagnostics(int, char *, char *, ...);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
char *keyvalue_pair(char *, char **, char **);
scalar_t__ strchr(char *, char);
char *strtok(char *, char *);
void ParseOptGeometry(char *options) {
  char *key, *value1, *value2, *next, *comma = ", ", *colon = ": ";
  while (options) {
    next = keyvalue_pair(options, &key, &value1);
    if (value1 == NULL) {
      diagnostics(2, "geometry package, single option=[%s]", key);
      ExecGeomOptions(key, NULL, NULL);
    } else if (*value1 == '{') {
      PushSource(NULL, value1);
      free(value1);
      value1 = getBraceParam();
      PopSource();
      value1 = strtok(value1, comma);
      value2 = strtok(NULL, comma);
      diagnostics(2, "option=%s with values %s and %s", key, value1, value2);
      ExecGeomOptions(key, value1, value2);
      free(value1);
    } else if (strchr(value1, ':')) {
      value1 = strtok(value1, colon);
      value2 = strtok(NULL, colon);
      diagnostics(2, "option=%s with ratio '%s:%s'", key, value1, value2);
      ExecGeomOptions(key, value1, value2);
      free(value1);
    } else {
      diagnostics(2, "geometry package, option=[%s], value=%s", key, value1);
      value2 = value1;
      ExecGeomOptions(key, value1, value2);
      free(value1);
    }
    if (key)
      free(key);
    options = next;
  }
}


x86 assembly (clang, -O0):
<ParseOptGeometry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe5d(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe55(%rip),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1381 <ParseOptGeometry+0x1f1>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <keyvalue_pair@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1209 <ParseOptGeometry+0x79>
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1080 <diagnostics@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10b0 <ExecGeomOptions@plt>
jmp    1360 <ParseOptGeometry+0x1d0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
jne    12a1 <ParseOptGeometry+0x111>
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <PushSource@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1090 <PopSource@plt>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x2,%edi
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   1080 <diagnostics@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <ExecGeomOptions@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    135b <ParseOptGeometry+0x1cb>
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     1319 <ParseOptGeometry+0x189>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x2,%edi
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   1080 <diagnostics@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <ExecGeomOptions@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1356 <ParseOptGeometry+0x1c6>
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x2,%edi
lea    0xd3b(%rip),%rsi
mov    $0x0,%al
call   1080 <diagnostics@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <ExecGeomOptions@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    135b <ParseOptGeometry+0x1cb>
jmp    1360 <ParseOptGeometry+0x1d0>
cmpq   $0x0,-0x10(%rbp)
je     1374 <ParseOptGeometry+0x1e4>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11b2 <ParseOptGeometry+0x22>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseOptGeometry>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rdi,%rdi
je     1367 <ParseOptGeometry+0x1d7>
mov    %rdi,%rbx
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0xe4b(%rip),%r13
jmp    11c9 <ParseOptGeometry+0x39>
nopl   (%rax)
test   %rbx,%rbx
je     1367 <ParseOptGeometry+0x1d7>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <keyvalue_pair@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
je     1270 <ParseOptGeometry+0xe0>
cmpb   $0x7b,(%rsi)
jne    12a0 <ParseOptGeometry+0x110>
xor    %edi,%edi
call   1070 <PushSource@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,0x8(%rsp)
xor    %eax,%eax
call   1090 <PopSource@plt>
mov    0x8(%rsp),%rdi
lea    0xddf(%rip),%rbp
mov    %rbp,%rsi
call   10a0 <strtok@plt>
mov    %rax,0x8(%rsp)
xor    %edi,%edi
mov    %rbp,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r12
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    $0x2,%edi
lea    0xdda(%rip),%rsi
mov    %rax,%r8
xor    %eax,%eax
call   1080 <diagnostics@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %r12,%rdx
jmp    1340 <ParseOptGeometry+0x1b0>
nopl   (%rax)
mov    0x10(%rsp),%rdx
mov    $0x2,%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <diagnostics@plt>
mov    0x10(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <ExecGeomOptions@plt>
jmp    134f <ParseOptGeometry+0x1bf>
nopw   0x0(%rax,%rax,1)
mov    %rsi,%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1307 <ParseOptGeometry+0x177>
mov    0x8(%rsp),%rdi
lea    0xd45(%rip),%rbp
mov    %rbp,%rsi
call   10a0 <strtok@plt>
mov    %rax,0x8(%rsp)
xor    %edi,%edi
mov    %rbp,%rsi
call   10a0 <strtok@plt>
mov    %rax,%rbp
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    $0x2,%edi
lea    0xd5d(%rip),%rsi
mov    %rax,%r8
xor    %eax,%eax
call   1080 <diagnostics@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %rbp,%rdx
jmp    1340 <ParseOptGeometry+0x1b0>
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    $0x2,%edi
lea    0xd4b(%rip),%rsi
xor    %eax,%eax
call   1080 <diagnostics@plt>
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rdi
mov    %rdx,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   10b0 <ExecGeomOptions@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     11c0 <ParseOptGeometry+0x30>
call   1030 <free@plt>
jmp    11c0 <ParseOptGeometry+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c", \00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [37 x i8] c"geometry package, single option=[%s]\00"
@.str.3 = [32 x i8] c"option=%s with values %s and %s\00"
@.str.4 = [29 x i8] c"option=%s with ratio '%s:%s'\00"
@.str.5 = [40 x i8] c"geometry package, option=[%s], value=%s\00"
define void @ParseOptGeometry(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %9
9: ; preds = %88, %1
%10 = load i8*, i8** %2
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %90
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = call i8* @keyvalue_pair(i8* %13, i8** %3, i8** %4)
store i8* %14, i8** %6
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %3
%21 = call i32 @ExecGeomOptions(i8* %20, i8* null, i8* null)
br label %82
22: ; preds = %12
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 123
br i1 %26, label %27, label %49
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = call i32 @PushSource(i32* null, i8* %28)
%30 = load i8*, i8** %4
%31 = call i32 @free(i8* %30)
%32 = call i8* (...) @getBraceParam()
store i8* %32, i8** %4
%33 = call i32 (...) @PopSource()
%34 = load i8*, i8** %4
%35 = load i8*, i8** %7
%36 = call i8* @strtok(i8* %34, i8* %35)
store i8* %36, i8** %4
%37 = load i8*, i8** %7
%38 = call i8* @strtok(i8* null, i8* %37)
store i8* %38, i8** %5
%39 = load i8*, i8** %3
%40 = load i8*, i8** %4
%41 = load i8*, i8** %5
%42 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %39, i8* %40, i8* %41)
%43 = load i8*, i8** %3
%44 = load i8*, i8** %4
%45 = load i8*, i8** %5
%46 = call i32 @ExecGeomOptions(i8* %43, i8* %44, i8* %45)
%47 = load i8*, i8** %4
%48 = call i32 @free(i8* %47)
br label %81
49: ; preds = %22
%50 = load i8*, i8** %4
%51 = call i64 @strchr(i8* %50, i8 signext 58)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %69
53: ; preds = %49
%54 = load i8*, i8** %4
%55 = load i8*, i8** %8
%56 = call i8* @strtok(i8* %54, i8* %55)
store i8* %56, i8** %4
%57 = load i8*, i8** %8
%58 = call i8* @strtok(i8* null, i8* %57)
store i8* %58, i8** %5
%59 = load i8*, i8** %3
%60 = load i8*, i8** %4
%61 = load i8*, i8** %5
%62 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %59, i8* %60, i8* %61)
%63 = load i8*, i8** %3
%64 = load i8*, i8** %4
%65 = load i8*, i8** %5
%66 = call i32 @ExecGeomOptions(i8* %63, i8* %64, i8* %65)
%67 = load i8*, i8** %4
%68 = call i32 @free(i8* %67)
br label %80
69: ; preds = %49
%70 = load i8*, i8** %3
%71 = load i8*, i8** %4
%72 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* %70, i8* %71)
%73 = load i8*, i8** %4
store i8* %73, i8** %5
%74 = load i8*, i8** %3
%75 = load i8*, i8** %4
%76 = load i8*, i8** %5
%77 = call i32 @ExecGeomOptions(i8* %74, i8* %75, i8* %76)
%78 = load i8*, i8** %4
%79 = call i32 @free(i8* %78)
br label %80
80: ; preds = %69, %53
br label %81
81: ; preds = %80, %27
br label %82
82: ; preds = %81, %17
%83 = load i8*, i8** %3
%84 = icmp ne i8* %83, null
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i8*, i8** %3
%87 = call i32 @free(i8* %86)
br label %88
88: ; preds = %85, %82
%89 = load i8*, i8** %6
store i8* %89, i8** %2
br label %9
90: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c", \00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [37 x i8] c"geometry package, single option=[%s]\00"
@.str.3 = [32 x i8] c"option=%s with values %s and %s\00"
@.str.4 = [29 x i8] c"option=%s with ratio '%s:%s'\00"
@.str.5 = [40 x i8] c"geometry package, option=[%s], value=%s\00"
define void @ParseOptGeometry(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
%5 = bitcast i8** %3 to i8*
%6 = icmp eq i8* %0, null
br i1 %6, label %68, label %7
7: ; preds = %1, %66
%8 = phi i8* [ %9, %66 ], [ %0, %1 ]
%9 = call i8* @keyvalue_pair(i8* %8, i8** %2, i8** %3)
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 @ExecGeomOptions(i8* %15, i8* null, i8* null)
br label %61
17: ; preds = %7
%18 = load i8, i8* %10
%19 = icmp eq i8 %18, 123
br i1 %19, label %20, label %37
20: ; preds = %17
%21 = call i32 @PushSource(i32* null, i8* %10)
%22 = load i8*, i8** %3
%23 = call i32 @free(i8* %22)
%24 = call i8* (...) @getBraceParam()
store i8* %24, i8** %3
%25 = call i32 (...) @PopSource()
%26 = load i8*, i8** %3
%27 = call i8* @strtok(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %27, i8** %3
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = load i8*, i8** %2
%30 = load i8*, i8** %3
%31 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %29, i8* %30, i8* %28)
%32 = load i8*, i8** %2
%33 = load i8*, i8** %3
%34 = call i32 @ExecGeomOptions(i8* %32, i8* %33, i8* %28)
%35 = load i8*, i8** %3
%36 = call i32 @free(i8* %35)
br label %61
37: ; preds = %17
%38 = call i64 @strchr(i8* %10, i8 signext 58)
%39 = icmp eq i64 %38, 0
br i1 %39, label %52, label %40
40: ; preds = %37
%41 = load i8*, i8** %3
%42 = call i8* @strtok(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %42, i8** %3
%43 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%44 = load i8*, i8** %2
%45 = load i8*, i8** %3
%46 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %44, i8* %45, i8* %43)
%47 = load i8*, i8** %2
%48 = load i8*, i8** %3
%49 = call i32 @ExecGeomOptions(i8* %47, i8* %48, i8* %43)
%50 = load i8*, i8** %3
%51 = call i32 @free(i8* %50)
br label %61
52: ; preds = %37
%53 = load i8*, i8** %2
%54 = load i8*, i8** %3
%55 = call i32 (i32, i8*, i8*, ...) @diagnostics(i32 2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* %53, i8* %54)
%56 = load i8*, i8** %3
%57 = load i8*, i8** %2
%58 = call i32 @ExecGeomOptions(i8* %57, i8* %56, i8* %56)
%59 = load i8*, i8** %3
%60 = call i32 @free(i8* %59)
br label %61
61: ; preds = %20, %52, %40, %12
%62 = load i8*, i8** %2
%63 = icmp eq i8* %62, null
br i1 %63, label %66, label %64
64: ; preds = %61
%65 = call i32 @free(i8* %62)
br label %66
66: ; preds = %64, %61
%67 = icmp eq i8* %9, null
br i1 %67, label %68, label %7
68: ; preds = %66, %1
ret void
}