#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 */
scalar_t__ exist_argument(char *);
char getchar();
int /*<<< orphan*/ log_print_str(char *);
int /*<<< orphan*/ log_println_str(char *);
int get_privacy(char *metaserver) {
  int result = 0;
  int chosen = 0;
  char c;
  if (exist_argument("public")) {
    chosen = 1;
    result = 1;
  }
  if (exist_argument("private")) {
    chosen = 1;
  }
  if (!chosen) {
    log_print_str("Register on \"");
    log_print_str(metaserver);
    log_print_str("\" (y/n)? ");
    while ((c = getchar()) == '\n')
      ;
    if (c == 'y' || c == 'Y') {
      result = 1;
    }
    if (result) {
      log_println_str("Use \"-public\" to get rid of this question.");
    } else {
      log_println_str("Use \"-private\" to get rid of this question.");
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<get_privacy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe9f(%rip),%rdi
call   1040 <exist_argument@plt>
cmp    $0x0,%rax
je     117e <get_privacy+0x3e>
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe82(%rip),%rdi
call   1040 <exist_argument@plt>
cmp    $0x0,%rax
je     119b <get_privacy+0x5b>
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    122e <get_privacy+0xee>
lea    0xe63(%rip),%rdi
call   1050 <log_print_str@plt>
mov    -0x8(%rbp),%rdi
call   1050 <log_print_str@plt>
lea    0xe5c(%rip),%rdi
call   1050 <log_print_str@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
jne    11e1 <get_privacy+0xa1>
jmp    11c6 <get_privacy+0x86>
movsbl -0x11(%rbp),%eax
cmp    $0x79,%eax
je     11fb <get_privacy+0xbb>
movsbl -0x11(%rbp),%eax
cmp    $0x59,%eax
jne    1202 <get_privacy+0xc2>
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     121d <get_privacy+0xdd>
lea    0xe14(%rip),%rdi
call   1060 <log_println_str@plt>
jmp    1229 <get_privacy+0xe9>
lea    0xe2e(%rip),%rdi
call   1060 <log_println_str@plt>
jmp    122e <get_privacy+0xee>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_privacy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xeb2(%rip),%rdi
call   1040 <exist_argument@plt>
mov    %rax,%rbx
test   %rax,%rax
setne  %bpl
lea    0xea3(%rip),%rdi
call   1040 <exist_argument@plt>
or     %rbx,%rax
jne    11ba <get_privacy+0x7a>
lea    0xe9a(%rip),%rdi
call   1050 <log_print_str@plt>
mov    %r14,%rdi
call   1050 <log_print_str@plt>
lea    0xe94(%rip),%rdi
call   1050 <log_print_str@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     1190 <get_privacy+0x50>
and    $0xdf,%al
cmp    $0x59,%al
sete   %bpl
lea    0xe7d(%rip),%rax
lea    0xea1(%rip),%rdi
cmove  %rax,%rdi
call   1060 <log_println_str@plt>
movzbl %bpl,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"public\00"
@.str.1 = [8 x i8] c"private\00"
@.str.2 = [14 x i8] c"Register on \22\00"
@.str.3 = [10 x i8] c"\22 (y/n)? \00"
@.str.4 = [43 x i8] c"Use \22-public\22 to get rid of this question.\00"
@.str.5 = [44 x i8] c"Use \22-private\22 to get rid of this question.\00"
define i32 @get_privacy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = call i64 @exist_argument(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %4
store i32 1, i32* %3
br label %9
9: ; preds = %8, %1
%10 = call i64 @exist_argument(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %4
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %43, label %16
16: ; preds = %13
%17 = call i32 @log_print_str(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8*, i8** %2
%19 = call i32 @log_print_str(i8* %18)
%20 = call i32 @log_print_str(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %25, %16
%22 = call signext i8 (...) @getchar()
store i8 %22, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %21
br label %21
26: ; preds = %21
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 121
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8, i8* %5
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 89
br i1 %33, label %34, label %35
34: ; preds = %30, %26
store i32 1, i32* %3
br label %35
35: ; preds = %34, %30
%36 = load i32, i32* %3
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @log_println_str(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
br label %42
40: ; preds = %35
%41 = call i32 @log_println_str(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
br label %43
43: ; preds = %42, %13
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [7 x i8] c"public\00"
@.str.1 = [8 x i8] c"private\00"
@.str.2 = [14 x i8] c"Register on \22\00"
@.str.3 = [10 x i8] c"\22 (y/n)? \00"
@.str.4 = [43 x i8] c"Use \22-public\22 to get rid of this question.\00"
@.str.5 = [44 x i8] c"Use \22-private\22 to get rid of this question.\00"
define i32 @get_privacy(i8* %0) {
%2 = tail call i64 @exist_argument(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
%4 = tail call i64 @exist_argument(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = xor i1 %3, true
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = tail call i32 @log_print_str(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @log_print_str(i8* %0)
%11 = tail call i32 @log_print_str(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %12, %8
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %12, label %15
15: ; preds = %12
%16 = and i8 %13, -33
%17 = icmp eq i8 %16, 89
%18 = select i1 %17, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0)
%19 = tail call i32 @log_println_str(i8* %18)
br label %20
20: ; preds = %15, %1
%21 = phi i1 [ %3, %1 ], [ %17, %15 ]
%22 = zext i1 %21 to i32
ret i32 %22
}