#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 getmyint(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int setmyint(int);
scalar_t__ strncmp(char *, char *, int);
int main() {
  int value, j;
  char sel[255];
  printf("Masukkan set<spasi>angka untuk setmyint(value) atau masukkan get\n");
  scanf("%s", sel);
  if (strncmp(sel, "set", 3) == 0) {
    scanf("%d", &value);
    j = setmyint(value);
    if (j == 1)
      printf("Nilai diset %d\n", value);
    else
      printf("Error! Nilai lama belum di get!\n");
  } else if (strncmp(sel, "get", 3) == 0) {
    j = getmyint(&value);
    if (j == 1)
      printf("Nilai hasil get %d\n", value);
    else
      printf("Error! Nilai lama belum di set!\n");
  } else {
    printf("Error! Masukan invalid\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x110(%rbp),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    11f7 <main+0xa7>
lea    0xe9b(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <setmyint@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11e4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11f2 <main+0xa2>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    126b <main+0x11b>
lea    -0x110(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1258 <main+0x108>
lea    -0x8(%rbp),%rdi
call   1070 <getmyint@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1245 <main+0xf5>
mov    -0x8(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1253 <main+0x103>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1266 <main+0x116>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    126b <main+0x11b>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
lea    0xebf(%rip),%rdi
call   1050 <puts@plt>
lea    0xe85(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe72(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     11c7 <main+0x67>
lea    0xec1(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     11f5 <main+0x95>
lea    0xeaa(%rip),%rdi
jmp    1228 <main+0xc8>
lea    0xe39(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
call   1030 <setmyint@plt>
cmp    $0x1,%eax
jne    1218 <main+0xb8>
mov    0xc(%rsp),%esi
lea    0xe17(%rip),%rdi
jmp    120f <main+0xaf>
lea    0xc(%rsp),%rdi
call   1080 <getmyint@plt>
cmp    $0x1,%eax
jne    1221 <main+0xc1>
mov    0xc(%rsp),%esi
lea    0xe0b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    122d <main+0xcd>
lea    0xe87(%rip),%rdi
jmp    1228 <main+0xc8>
lea    0xe5e(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [66 x i8] c"Masukkan set<spasi>angka untuk setmyint(value) atau masukkan get\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"Nilai diset %d\0A\00"
@.str.5 = [33 x i8] c"Error! Nilai lama belum di get!\0A\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [20 x i8] c"Nilai hasil get %d\0A\00"
@.str.8 = [33 x i8] c"Error! Nilai lama belum di set!\0A\00"
@.str.9 = [24 x i8] c"Error! Masukan invalid\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [255 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%9 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %0
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = call i32 @setmyint(i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %18)
br label %22
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
br label %40
23: ; preds = %0
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%25 = call i64 @strncmp(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %23
%28 = call i32 @getmyint(i32* %2)
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %32)
br label %36
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
br label %39
37: ; preds = %23
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %39
39: ; preds = %37, %36
br label %40
40: ; preds = %39, %22
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"Nilai diset %d\0A\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [20 x i8] c"Nilai hasil get %d\0A\00"
@str = [65 x i8] c"Masukkan set<spasi>angka untuk setmyint(value) atau masukkan get\00"
@str.10 = [23 x i8] c"Error! Masukan invalid\00"
@str.11 = [32 x i8] c"Error! Nilai lama belum di set!\00"
@str.12 = [32 x i8] c"Error! Nilai lama belum di get!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = call i32 @setmyint(i32 %11)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %15)
br label %32
17: ; preds = %9
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
br label %32
19: ; preds = %0
%20 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = call i32 @getmyint(i32* %1)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %1
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %26)
br label %32
28: ; preds = %22
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
br label %32
30: ; preds = %19
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
br label %32
32: ; preds = %30, %28, %25, %14, %17
ret i32 0
}