#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() {
  int b, btambah, c, ckali, d, dkurang;
  char pilihan;
  printf("Program C Matematika , silahkan anda ingin melakukan apa ?\n");
  printf("[x] Perkalian\n");
  printf("[p] Pertambahan\n");
  printf("[k] Pengurangan\n");
  scanf("%c", &pilihan);
  switch (pilihan) {
  case 'x':
    printf(" Angka berapakah yang ingin anda Kalikan ? \n");
    printf(" Input disini = ");
    scanf("%d", &c);
    printf(" dan ingin dikalikan berapa ? \n");
    scanf("%d", &ckali);
    c = c * ckali;
    printf(" Jawabannya adalah = %d\n", c);
    break;
  case 'p':
    printf(" Angka berapakah yang ingin anda Tambahkan ?\n");
    printf(" Input disini = ");
    scanf("%d", &b);
    printf(" dan ingin ditambahkan berapa ? \n");
    scanf("%d", &btambah);
    b = b + btambah;
    printf(" Jawabannya adalah = %d\n", b);
    break;
  case 'k':
    printf(" Angka berapakah yang ingin anda Kurangi ?\n");
    printf(" Input disini = ");
    scanf("%d", &d);
    printf(" dan ingin dikurangi berapa ? \n");
    scanf("%d", &dkurang);
    d = d - dkurang;
    printf(" Jawabannya adalah = %d\n", d);
    break;
  default:
    printf(" Anda salah menginput pilihan ! \n");
  }
  printf("\n");
  printf("\n");
  printf(" =============-------------------============== \n ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x25(%rbp)
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xef6(%rip),%rdi
lea    -0x1d(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1d(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x6b,%eax
je     1292 <main+0x172>
jmp    1195 <main+0x75>
mov    -0x24(%rbp),%eax
sub    $0x70,%eax
je     1225 <main+0x105>
jmp    11a6 <main+0x86>
mov    -0x24(%rbp),%eax
sub    $0x78,%eax
jne    12ff <main+0x1df>
jmp    11b7 <main+0x97>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130d <main+0x1ed>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130d <main+0x1ed>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf9(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd9(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130d <main+0x1ed>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf17(%rip),%rdi
call   1040 <puts@plt>
lea    0xf46(%rip),%rdi
call   1040 <puts@plt>
lea    0xf48(%rip),%rdi
call   1040 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsbl 0xb(%rsp),%eax
cmp    $0x6b,%eax
je     11fd <main+0xbd>
cmp    $0x70,%eax
je     1252 <main+0x112>
cmp    $0x78,%eax
jne    12b9 <main+0x179>
lea    0xfb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe4f(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xfb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
imul   0x4(%rsp),%esi
jmp    12a5 <main+0x165>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdf6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
sub    0xc(%rsp),%esi
jmp    12a5 <main+0x165>
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda1(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
add    0x4(%rsp),%esi
mov    %esi,0x4(%rsp)
lea    0xd67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12c5 <main+0x185>
lea    0xeef(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd50(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Program C Matematika , silahkan anda ingin melakukan apa ?\0A\00"
@.str.1 = [15 x i8] c"[x] Perkalian\0A\00"
@.str.2 = [17 x i8] c"[p] Pertambahan\0A\00"
@.str.3 = [17 x i8] c"[k] Pengurangan\0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [45 x i8] c" Angka berapakah yang ingin anda Kalikan ? \0A\00"
@.str.6 = [17 x i8] c" Input disini = \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [32 x i8] c" dan ingin dikalikan berapa ? \0A\00"
@.str.9 = [25 x i8] c" Jawabannya adalah = %d\0A\00"
@.str.10 = [46 x i8] c" Angka berapakah yang ingin anda Tambahkan ?\0A\00"
@.str.11 = [34 x i8] c" dan ingin ditambahkan berapa ? \0A\00"
@.str.12 = [44 x i8] c" Angka berapakah yang ingin anda Kurangi ?\0A\00"
@.str.13 = [32 x i8] c" dan ingin dikurangi berapa ? \0A\00"
@.str.14 = [34 x i8] c" Anda salah menginput pilihan ! \0A\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [51 x i8] c" =============-------------------============== \0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%14 = load i8, i8* %8
%15 = sext i8 %14 to i32
switch i32 %15, label %49 [
i32 120, label %16
i32 112, label %27
i32 107, label %38
]
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %5)
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = mul nsw i32 %22, %23
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %25)
br label %51
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = add nsw i32 %33, %34
store i32 %35, i32* %2
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %36)
br label %51
38: ; preds = %0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = sub nsw i32 %44, %45
store i32 %46, i32* %6
%47 = load i32, i32* %6
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %47)
br label %51
49: ; preds = %0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0))
br label %51
51: ; preds = %49, %38, %27, %16
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [3 x i8] c"%c\00"
@.str.6 = [17 x i8] c" Input disini = \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.9 = [25 x i8] c" Jawabannya adalah = %d\0A\00"
@.str.16 = [51 x i8] c" =============-------------------============== \0A \00"
@str = [59 x i8] c"Program C Matematika , silahkan anda ingin melakukan apa ?\00"
@str.17 = [14 x i8] c"[x] Perkalian\00"
@str.18 = [16 x i8] c"[p] Pertambahan\00"
@str.19 = [16 x i8] c"[k] Pengurangan\00"
@str.20 = [43 x i8] c" Angka berapakah yang ingin anda Kurangi ?\00"
@str.21 = [31 x i8] c" dan ingin dikurangi berapa ? \00"
@str.22 = [45 x i8] c" Angka berapakah yang ingin anda Tambahkan ?\00"
@str.23 = [33 x i8] c" dan ingin ditambahkan berapa ? \00"
@str.24 = [44 x i8] c" Angka berapakah yang ingin anda Kalikan ? \00"
@str.25 = [31 x i8] c" dan ingin dikalikan berapa ? \00"
@str.26 = [33 x i8] c" Anda salah menginput pilihan ! \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.19, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%19 = load i8, i8* %7
%20 = sext i8 %19 to i32
switch i32 %20, label %51 [
i32 120, label %21
i32 112, label %31
i32 107, label %41
]
21: ; preds = %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.24, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.25, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = mul nsw i32 %28, %27
store i32 %29, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %29)
br label %53
31: ; preds = %0
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.22, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.23, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = add nsw i32 %38, %37
store i32 %39, i32* %1
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %39)
br label %53
41: ; preds = %0
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.20, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %5)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.21, i64 0, i64 0))
%46 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%47 = load i32, i32* %5
%48 = load i32, i32* %6
%49 = sub nsw i32 %47, %48
store i32 %49, i32* %5
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %0
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.26, i64 0, i64 0))
br label %53
53: ; preds = %51, %41, %31, %21
%54 = call i32 @putchar(i32 10)
%55 = call i32 @putchar(i32 10)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
ret i32 0
}