#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char answer;
  int payment;
  int cash;
  int cardnumber;
  int happymoney;
  printf("결제하시겠습니까? y/n\n");
  scanf("\n%c", &answer);
  if (answer == 'y') {
    printf("결제수단을 고르세요\n");
    printf("1.현금 2.카드 3.문화상품권\n");
    scanf("%d", &payment);
    switch (payment) {
    case 1:
      printf("현금을 입력하세요\n");
      scanf("%d", &cash);
      printf("============================================\n");
      printf("총금액은 %d입니다\n", cash);
      printf("============================================\n");
      printf("결제가 완료되었습니다.\n");
      break;
    case 2:
      printf("카드번호를 입력하세요\n");
      scanf("%d", &cardnumber);
      printf("============================================\n");
      printf("결제가 완료되었습니다\n");
      printf("============================================\n");
      break;
    case 3:
      printf("문화상품권 번호를 입력하세요\n");
      scanf("%d", &happymoney);
      printf("============================================\n");
      printf("결제가 완료되었습니다\n");
      printf("============================================\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    12c3 <main+0x1a3>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x1d(%rbp)
call   1030 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1d(%rbp),%al
lea    0xee0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     11c5 <main+0xa5>
jmp    11a3 <main+0x83>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     1225 <main+0x105>
jmp    11b4 <main+0x94>
mov    -0x1c(%rbp),%eax
sub    $0x3,%eax
je     1274 <main+0x154>
jmp    12be <main+0x19e>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12be <main+0x19e>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12be <main+0x19e>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xddd(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c3 <main+0x1a3>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpb   $0x79,0xf(%rsp)
jne    123a <main+0x10a>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x3,%eax
je     11ec <main+0xbc>
cmp    $0x2,%eax
je     11f5 <main+0xc5>
cmp    $0x1,%eax
jne    123a <main+0x10a>
lea    0xf40(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4e(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf3b(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%esi
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf47(%rip),%rbx
jmp    122a <main+0xfa>
lea    0xe8d(%rip),%rdi
jmp    11fc <main+0xcc>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xdfc(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xee9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\EA\B2\B0\EC\A0\9C\ED\95\98\EC\8B\9C\EA\B2\A0\EC\8A\B5\EB\8B\88\EA\B9\8C? y/n\0A\00"
@.str.1 = [4 x i8] c"\0A%c\00"
@.str.2 = [30 x i8] c"\EA\B2\B0\EC\A0\9C\EC\88\98\EB\8B\A8\EC\9D\84 \EA\B3\A0\EB\A5\B4\EC\84\B8\EC\9A\94\0A\00"
@.str.3 = [37 x i8] c"1.\ED\98\84\EA\B8\88 2.\EC\B9\B4\EB\93\9C 3.\EB\AC\B8\ED\99\94\EC\83\81\ED\92\88\EA\B6\8C\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [27 x i8] c"\ED\98\84\EA\B8\88\EC\9D\84 \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\0A\00"
@.str.6 = [46 x i8] c"============================================\0A\00"
@.str.7 = [26 x i8] c"\EC\B4\9D\EA\B8\88\EC\95\A1\EC\9D\80 %d\EC\9E\85\EB\8B\88\EB\8B\A4\0A\00"
@.str.8 = [34 x i8] c"\EA\B2\B0\EC\A0\9C\EA\B0\80 \EC\99\84\EB\A3\8C\EB\90\98\EC\97\88\EC\8A\B5\EB\8B\88\EB\8B\A4.\0A\00"
@.str.9 = [33 x i8] c"\EC\B9\B4\EB\93\9C\EB\B2\88\ED\98\B8\EB\A5\BC \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\0A\00"
@.str.10 = [33 x i8] c"\EA\B2\B0\EC\A0\9C\EA\B0\80 \EC\99\84\EB\A3\8C\EB\90\98\EC\97\88\EC\8A\B5\EB\8B\88\EB\8B\A4\0A\00"
@.str.11 = [43 x i8] c"\EB\AC\B8\ED\99\94\EC\83\81\ED\92\88\EA\B6\8C \EB\B2\88\ED\98\B8\EB\A5\BC \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 121
br i1 %11, label %12, label %38
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %37 [
i32 1, label %17
i32 2, label %25
i32 3, label %31
]
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
br label %37
25: ; preds = %12
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %37
31: ; preds = %12
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %37
37: ; preds = %12, %31, %25, %17
br label %38
38: ; preds = %37, %0
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"\0A%c\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.7 = [26 x i8] c"\EC\B4\9D\EA\B8\88\EC\95\A1\EC\9D\80 %d\EC\9E\85\EB\8B\88\EB\8B\A4\0A\00"
@str = [30 x i8] c"\EA\B2\B0\EC\A0\9C\ED\95\98\EC\8B\9C\EA\B2\A0\EC\8A\B5\EB\8B\88\EA\B9\8C? y/n\00"
@str.12 = [29 x i8] c"\EA\B2\B0\EC\A0\9C\EC\88\98\EB\8B\A8\EC\9D\84 \EA\B3\A0\EB\A5\B4\EC\84\B8\EC\9A\94\00"
@str.13 = [36 x i8] c"1.\ED\98\84\EA\B8\88 2.\EC\B9\B4\EB\93\9C 3.\EB\AC\B8\ED\99\94\EC\83\81\ED\92\88\EA\B6\8C\00"
@str.14 = [42 x i8] c"\EB\AC\B8\ED\99\94\EC\83\81\ED\92\88\EA\B6\8C \EB\B2\88\ED\98\B8\EB\A5\BC \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\00"
@str.18 = [32 x i8] c"\EC\B9\B4\EB\93\9C\EB\B2\88\ED\98\B8\EB\A5\BC \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\00"
@str.20 = [32 x i8] c"\EA\B2\B0\EC\A0\9C\EA\B0\80 \EC\99\84\EB\A3\8C\EB\90\98\EC\97\88\EC\8A\B5\EB\8B\88\EB\8B\A4\00"
@str.22 = [26 x i8] c"\ED\98\84\EA\B8\88\EC\9D\84 \EC\9E\85\EB\A0\A5\ED\95\98\EC\84\B8\EC\9A\94\00"
@str.24 = [45 x i8] c"============================================\00"
@str.25 = [33 x i8] c"\EA\B2\B0\EC\A0\9C\EA\B0\80 \EC\99\84\EB\A3\8C\EB\90\98\EC\97\88\EC\8A\B5\EB\8B\88\EB\8B\A4.\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%12 = load i8, i8* %1
%13 = icmp eq i8 %12, 121
br i1 %13, label %14, label %38
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.12, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.13, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
switch i32 %18, label %38 [
i32 1, label %19
i32 2, label %25
i32 3, label %29
]
19: ; preds = %14
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.22, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %23)
br label %33
25: ; preds = %14
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.18, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0))
br label %33
29: ; preds = %14
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.14, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0))
br label %33
33: ; preds = %29, %25, %19
%34 = phi i8* [ getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0), %19 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.20, i64 0, i64 0), %25 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.20, i64 0, i64 0), %29 ]
%35 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.25, i64 0, i64 0), %19 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0), %25 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @str.24, i64 0, i64 0), %29 ]
%36 = call i32 @puts(i8* dereferenceable(1) %34)
%37 = call i32 @puts(i8* dereferenceable(1) %35)
br label %38
38: ; preds = %33, %14, %0
ret i32 0
}