#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 rate = 100;
  int married;
  int gender;
  int age;
  printf("Is the customer married? (1=married, 0=unmarried)\n");
  scanf("%d", &married);
  printf("Is the customer male or female? (1=female, 0=male)\n");
  scanf("%d", &gender);
  printf("What is the customer's age?\n");
  scanf("%d", &age);
  if (married == 1) {
    rate -= 10;
  }
  if ((gender == 0) && (age < 25)) {
    rate *= 2;
  }
  if ((gender == 0) && (age >= 25)) {
    rate *= 1.5;
  }
  if ((gender == 1) && (age < 25)) {
    rate *= 1.5;
  }
  printf("The daily rate for the customer is: $%d\n", rate);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    11a3 <main+0x83>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11c0 <main+0xa0>
cmpl   $0x19,-0x14(%rbp)
jge    11c0 <main+0xa0>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11ec <main+0xcc>
cmpl   $0x19,-0x14(%rbp)
jl     11ec <main+0xcc>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1218 <main+0xf8>
cmpl   $0x19,-0x14(%rbp)
jge    1218 <main+0xf8>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6d(%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    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf24(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
mov    $0x5a,%eax
mov    $0x64,%edx
cmove  %eax,%edx
mov    0x8(%rsp),%eax
test   %eax,%eax
sete   %bl
mov    0x4(%rsp),%esi
cmp    $0x19,%esi
setl   %cl
and    %bl,%cl
shl    %cl,%edx
cmp    $0x19,%esi
cvtsi2sd %edx,%xmm0
movsd  0xe41(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cmovl  %edx,%ecx
test   %eax,%eax
cmovne %edx,%ecx
cmp    $0x19,%esi
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
cmovge %ecx,%esi
cmp    $0x1,%eax
cmovne %ecx,%esi
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [41 x i8] c"The daily rate for the customer is: $%d\0A\00"
@str = [50 x i8] c"Is the customer married? (1=married, 0=unmarried)\00"
@str.5 = [51 x i8] c"Is the customer male or female? (1=female, 0=male)\00"
@str.6 = [28 x i8] c"What is the customer's 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 ([50 x i8], [50 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* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 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* %2)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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* %3)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 1
%15 = select i1 %14, i32 90, i32 100
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 0
%18 = load i32, i32* %3
%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 = sitofp i32 %28 to double
%32 = fmul double %31, 1.500000e+00
%33 = fptosi double %32 to i32
%34 = select i1 %30, i32 %33, i32 %28
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 %34)
ret i32 0
}