#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 age;
  int married;
  int male = 0;
  int female = 1;
  int gender;
  int rate = 100;
  printf("Are you married (1=married, 0=unmarried)?\n");
  scanf("%d", &married);
  printf("Are you a female or a male (1=female, 0=male)\n");
  scanf("%d", &gender);
  printf("What is your age?\n");
  scanf("%d", &age);
  if (married) {
    rate -= 10;
  }
  if ((gender == 0) && (age < 25)) {
    rate *= 2;
  }
  if ((gender == 0) && (age >= 25)) {
    rate *= 1.5;
  }
  if ((gender == 1) && (age < 25)) {
    (rate - 10) * 1.5;
  } else {
    rate -= 10;
  }
  printf("Your rate is: $%d\n", rate);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x64,-0x1c(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11b1 <main+0x91>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11ce <main+0xae>
cmpl   $0x19,-0x8(%rbp)
jge    11ce <main+0xae>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11fa <main+0xda>
cmpl   $0x19,-0x8(%rbp)
jl     11fa <main+0xda>
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1213 <main+0xf3>
cmpl   $0x19,-0x8(%rbp)
jge    1213 <main+0xf3>
jmp    121c <main+0xfc>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
mov    $0x64,%eax
mov    $0x5a,%edx
cmove  %eax,%edx
mov    0x4(%rsp),%eax
test   %eax,%eax
sete   %bl
mov    0xc(%rsp),%edi
cmp    $0x19,%edi
setl   %cl
and    %bl,%cl
shl    %cl,%edx
cmp    $0x19,%edi
cvtsi2sd %edx,%xmm0
mulsd  0xe41(%rip),%xmm0
cvttsd2si %xmm0,%esi
cmovl  %edx,%esi
test   %eax,%eax
cmovne %edx,%esi
lea    -0xa(%rsi),%ecx
cmp    $0x19,%edi
cmovge %ecx,%esi
cmp    $0x1,%eax
cmovne %ecx,%esi
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Are you married (1=married, 0=unmarried)?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"Are you a female or a male (1=female, 0=male)\0A\00"
@.str.3 = [19 x i8] c"What is your age?\0A\00"
@.str.4 = [19 x i8] c"Your rate is: $%d\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
store i32 0, i32* %1
store i32 0, i32* %4
store i32 1, i32* %5
store i32 100, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32, i32* %7
%18 = sub nsw i32 %17, 10
store i32 %18, i32* %7
br label %19
19: ; preds = %16, %0
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 25
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %7
%27 = mul nsw i32 %26, 2
store i32 %27, i32* %7
br label %28
28: ; preds = %25, %22, %19
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sge i32 %32, 25
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* %7
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 1.500000e+00
%38 = fptosi double %37 to i32
store i32 %38, i32* %7
br label %39
39: ; preds = %34, %31, %28
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %50
42: ; preds = %39
%43 = load i32, i32* %2
%44 = icmp slt i32 %43, 25
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load i32, i32* %7
%47 = sub nsw i32 %46, 10
%48 = sitofp i32 %47 to double
%49 = fmul double %48, 1.500000e+00
br label %53
50: ; preds = %42, %39
%51 = load i32, i32* %7
%52 = sub nsw i32 %51, 10
store i32 %52, i32* %7
br label %53
53: ; preds = %50, %45
%54 = load i32, i32* %7
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %54)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [19 x i8] c"Your rate is: $%d\0A\00"
@str = [42 x i8] c"Are you married (1=married, 0=unmarried)?\00"
@str.5 = [46 x i8] c"Are you a female or a male (1=female, 0=male)\00"
@str.6 = [18 x i8] c"What is your age?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 100, i32 90
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
%18 = load i32, i32* %1
%19 = icmp slt i32 %18, 25
%20 = select i1 %17, i1 %19, i1 false
%21 = zext i1 %20 to i32
%22 = shl nuw nsw i32 %15, %21
%23 = icmp sgt i32 %18, 24
%24 = select i1 %17, i1 %23, i1 false
%25 = sitofp i32 %22 to double
%26 = fmul double %25, 1.500000e+00
%27 = fptosi double %26 to i32
%28 = select i1 %24, i32 %27, i32 %22
%29 = icmp eq i32 %16, 1
%30 = select i1 %29, i1 %19, i1 false
%31 = add nsw i32 %28, -10
%32 = select i1 %30, i32 %28, i32 %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %32)
ret i32 0
}