#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*/ Runge_Kutta_2(double, int);
int /*<<< orphan*/ Runge_Kutta_4(double, int);
int /*<<< orphan*/ main();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
void interface(int opcao) {
  int option, n;
  double a, b, h;
  do {
    printf("            Resolucao de Equacoes Diferenciais Pelo Metodo Runge "
           "Kutta\n");
    printf("\n\n\n\t(1)..........................Entrar com a, b e n\n");
    printf("\t(2)..........................Entrar com h e n\n");
    printf("\t(0)..........................Voltar\n");
    printf("\nOpcao Desejada: ");
    scanf("%d", &option);
    switch (option) {
    case 1:
      printf("Entre com a: ");
      scanf("%lf", &a);
      printf("Entre com b: ");
      scanf("%lf", &b);
      printf("Entre com o numero de intervalos: ");
      scanf("%d", &n);
      h = (b - a) / n;
      if (opcao == 1)
        Runge_Kutta_2(h, n);
      else
        Runge_Kutta_4(h, n);
      break;
    case 2:
      printf("Entre com h: ");
      scanf("%lf", &h);
      printf("Entre com o numero de intervalos: ");
      scanf("%d", &n);
      if (opcao == 1)
        Runge_Kutta_2(h, n);
      else
        Runge_Kutta_4(h, n);
      break;
    case 0:
      main();
      break;
    }
  } while (opcao);
}


x86 assembly (clang, -O0):
<interface>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
call   1040 <printf@plt>
lea    0xf28(%rip),%rdi
call   1040 <printf@plt>
lea    0xf42(%rip),%rdi
call   1040 <printf@plt>
lea    0xf48(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     12e8 <interface+0x198>
jmp    11bc <interface+0x6c>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
je     11de <interface+0x8e>
jmp    11cd <interface+0x7d>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     127e <interface+0x12e>
jmp    12ef <interface+0x19f>
lea    0xf04(%rip),%rdi
call   1040 <printf@plt>
lea    0xf06(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xef8(%rip),%rdi
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xee8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    126c <interface+0x11c>
movsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1050 <Runge_Kutta_2@plt>
jmp    1279 <interface+0x129>
movsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <Runge_Kutta_4@plt>
jmp    12ef <interface+0x19f>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
lea    0xe66(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    12d6 <interface+0x186>
movsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1050 <Runge_Kutta_2@plt>
jmp    12e3 <interface+0x193>
movsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <Runge_Kutta_4@plt>
jmp    12ef <interface+0x19f>
mov    $0x0,%al
call   1060 <main@plt>
jmp    12f4 <interface+0x1a4>
cmpl   $0x0,-0x4(%rbp)
jne    115b <interface+0xb>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interface>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%r13d
lea    0xf6a(%rip),%r12
lea    0xf92(%rip),%r14
lea    0xe7a(%rip),%r15
lea    0xe85(%rip),%rbp
lea    0xc(%rsp),%rbx
jmp    11b0 <interface+0x50>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <main@plt>
test   %r13d,%r13d
je     130e <interface+0x1ae>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a0 <interface+0x40>
cmp    $0x2,%eax
je     1290 <interface+0x130>
cmp    $0x1,%eax
jne    11a7 <interface+0x47>
mov    %r12,%r15
lea    0xe08(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0a(%rip),%r12
mov    %r12,%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xdf8(%rip),%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xdeb(%rip),%rdi
call   1050 <printf@plt>
mov    %r13d,%ebx
mov    %rbp,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
movsd  0x18(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
mov    0x8(%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
cmp    $0x1,%r13d
jne    12ee <interface+0x18e>
call   1060 <Runge_Kutta_2@plt>
jmp    12f3 <interface+0x193>
nop
lea    0xdc1(%rip),%rdi
call   1050 <printf@plt>
lea    0xd80(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xd7f(%rip),%rdi
call   1050 <printf@plt>
mov    %rbp,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
movsd  0x10(%rsp),%xmm0
mov    0x8(%rsp),%edi
cmp    $0x1,%r13d
jne    12e4 <interface+0x184>
call   1060 <Runge_Kutta_2@plt>
jmp    11a7 <interface+0x47>
call   1040 <Runge_Kutta_4@plt>
jmp    11a7 <interface+0x47>
call   1040 <Runge_Kutta_4@plt>
mov    %r15,%r12
lea    0xd03(%rip),%r15
lea    0xc(%rsp),%rbx
lea    0xd09(%rip),%rbp
jmp    11a7 <interface+0x47>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [72 x i8] c" Resolucao de Equacoes Diferenciais Pelo Metodo Runge Kutta\0A\00"
@.str.1 = [54 x i8] c"\0A\0A\0A\09(1)..........................Entrar com a, b e n\0A\00"
@.str.2 = [48 x i8] c"\09(2)..........................Entrar com h e n\0A\00"
@.str.3 = [38 x i8] c"\09(0)..........................Voltar\0A\00"
@.str.4 = [18 x i8] c"\0AOpcao Desejada: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [14 x i8] c"Entre com a: \00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [14 x i8] c"Entre com b: \00"
@.str.9 = [35 x i8] c"Entre com o numero de intervalos: \00"
@.str.10 = [14 x i8] c"Entre com h: \00"
define void @interface(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %2
br label %8
8: ; preds = %59, %1
%9 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
switch i32 %15, label %58 [
i32 1, label %16
i32 2, label %40
i32 0, label %56
]
16: ; preds = %8
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %5)
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %6)
%21 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%23 = load double, double* %6
%24 = load double, double* %5
%25 = fsub double %23, %24
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
%28 = fdiv double %25, %27
store double %28, double* %7
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %35
31: ; preds = %16
%32 = load double, double* %7
%33 = load i32, i32* %4
%34 = call i32 @Runge_Kutta_2(double %32, i32 %33)
br label %39
35: ; preds = %16
%36 = load double, double* %7
%37 = load i32, i32* %4
%38 = call i32 @Runge_Kutta_4(double %36, i32 %37)
br label %39
39: ; preds = %35, %31
br label %58
40: ; preds = %8
%41 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %7)
%43 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %51
47: ; preds = %40
%48 = load double, double* %7
%49 = load i32, i32* %4
%50 = call i32 @Runge_Kutta_2(double %48, i32 %49)
br label %55
51: ; preds = %40
%52 = load double, double* %7
%53 = load i32, i32* %4
%54 = call i32 @Runge_Kutta_4(double %52, i32 %53)
br label %55
55: ; preds = %51, %47
br label %58
56: ; preds = %8
%57 = call i32 (...) @main()
br label %58
58: ; preds = %8, %56, %55, %39
br label %59
59: ; preds = %58
%60 = load i32, i32* %2
%61 = icmp ne i32 %60, 0
br i1 %61, label %8, label %62
62: ; preds = %59
ret void
}

LLVM IR (-O2):
@.str.4 = [18 x i8] c"\0AOpcao Desejada: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [14 x i8] c"Entre com a: \00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [14 x i8] c"Entre com b: \00"
@.str.9 = [35 x i8] c"Entre com o numero de intervalos: \00"
@.str.10 = [14 x i8] c"Entre com h: \00"
@str = [71 x i8] c" Resolucao de Equacoes Diferenciais Pelo Metodo Runge Kutta\00"
@str.11 = [53 x i8] c"\0A\0A\0A\09(1)..........................Entrar com a, b e n\00"
@str.12 = [47 x i8] c"\09(2)..........................Entrar com h e n\00"
@str.13 = [37 x i8] c"\09(0)..........................Voltar\00"
define void @interface(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = bitcast double* %6 to i8*
%12 = icmp eq i32 %0, 1
%13 = icmp eq i32 %0, 0
br label %14
14: ; preds = %52, %1
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.11, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.12, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.13, i64 0, i64 0))
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
switch i32 %21, label %52 [
i32 1, label %22
i32 2, label %39
i32 0, label %50
]
22: ; preds = %14
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %4)
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %5)
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%29 = load double, double* %5
%30 = load double, double* %4
%31 = fsub double %29, %30
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = fdiv double %31, %33
store double %34, double* %6
br i1 %12, label %35, label %37
35: ; preds = %22
%36 = call i32 @Runge_Kutta_2(double %34, i32 %32)
br label %52
37: ; preds = %22
%38 = call i32 @Runge_Kutta_4(double %34, i32 %32)
br label %52
39: ; preds = %14
%40 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %6)
%42 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%44 = load double, double* %6
%45 = load i32, i32* %3
br i1 %12, label %46, label %48
46: ; preds = %39
%47 = call i32 @Runge_Kutta_2(double %44, i32 %45)
br label %52
48: ; preds = %39
%49 = call i32 @Runge_Kutta_4(double %44, i32 %45)
br label %52
50: ; preds = %14
%51 = call i32 (...) @main()
br label %52
52: ; preds = %50, %14, %37, %35, %48, %46
br i1 %13, label %53, label %14
53: ; preds = %52
ret void
}