#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 *);
int main() {
  int ans, base = 40;
  printf("\nIn order to find the cost of insurance, please answer these "
         "questions. Type 1 for Yes and 0 for No. \n");
  printf("How old are you? ");
  scanf("%d", &ans);
  if (ans < 25) {
    base += 25;
  }
  printf("Do you have a bad driving record? ");
  scanf("%d", &ans);
  if (ans == 1) {
    base += 20;
  }
  printf("Have you ever had a DWI? ");
  scanf("%d", &ans);
  if (ans == 1) {
    base += 55;
  }
  printf("Is your vehicle considered a sports car? ");
  scanf("%d", &ans);
  if (ans == 1) {
    base += 35;
  }
  printf("\nYour total yearly insurance cost is $%d. This will be paid by $%d "
         "monthly. \n",
         base * 12, base);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x28,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf20(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x19,-0x8(%rbp)
jge    1175 <main+0x55>
mov    -0xc(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0xc(%rbp)
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11a6 <main+0x86>
mov    -0xc(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0xc(%rbp)
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11d7 <main+0xb7>
mov    -0xc(%rbp),%eax
add    $0x37,%eax
mov    %eax,-0xc(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1208 <main+0xe8>
mov    -0xc(%rbp),%eax
add    $0x23,%eax
mov    %eax,-0xc(%rbp)
imul   $0xc,-0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf8b(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%r15
lea    0x4(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x19,0x4(%rsp)
mov    $0x41,%eax
mov    $0x28,%ebx
cmovl  %eax,%ebx
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0x14(%rbx),%r12d
cmpl   $0x1,0x4(%rsp)
cmovne %ebx,%r12d
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0x37(%r12),%ebx
cmpl   $0x1,0x4(%rsp)
cmovne %r12d,%ebx
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0x23(%rbx),%edx
cmpl   $0x1,0x4(%rsp)
cmovne %ebx,%edx
lea    0x0(,%rdx,4),%eax
lea    (%rax,%rax,2),%esi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [103 x i8] c"\0AIn order to find the cost of insurance, please answer these questions. Type 1 for Yes and 0 for No. \0A\00"
@.str.1 = [18 x i8] c"How old are you? \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [35 x i8] c"Do you have a bad driving record? \00"
@.str.4 = [26 x i8] c"Have you ever had a DWI? \00"
@.str.5 = [42 x i8] c"Is your vehicle considered a sports car? \00"
@.str.6 = [78 x i8] c"\0AYour total yearly insurance cost is $%d. This will be paid by $%d monthly. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 40, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 25
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 25
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 20
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 55
store i32 %27, i32* %3
br label %28
28: ; preds = %25, %20
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 35
store i32 %35, i32* %3
br label %36
36: ; preds = %33, %28
%37 = load i32, i32* %3
%38 = mul nsw i32 %37, 12
%39 = load i32, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0), i32 %38, i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"How old are you? \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [35 x i8] c"Do you have a bad driving record? \00"
@.str.4 = [26 x i8] c"Have you ever had a DWI? \00"
@.str.5 = [42 x i8] c"Is your vehicle considered a sports car? \00"
@.str.6 = [78 x i8] c"\0AYour total yearly insurance cost is $%d. This will be paid by $%d monthly. \0A\00"
@str = [102 x i8] c"\0AIn order to find the cost of insurance, please answer these questions. Type 1 for Yes and 0 for No. \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 25
%8 = select i1 %7, i32 65, i32 40
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 1
%13 = or i32 %8, 20
%14 = select i1 %12, i32 %13, i32 %8
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 1
%19 = add nuw nsw i32 %14, 55
%20 = select i1 %18, i32 %19, i32 %14
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = icmp eq i32 %23, 1
%25 = add nuw nsw i32 %20, 35
%26 = select i1 %24, i32 %25, i32 %20
%27 = mul nsw i32 %26, 12
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0), i32 %27, i32 %26)
ret i32 0
}