#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, ...);
int /*<<< orphan*/ puts(char *);
int main() {
  int total, fine, speeding;
  int speed_limit = 55;
  int rate = 15;
  int first_ticket = 85;
  int second_ticket = 95;
  int third_ticket = 100;
  puts("Speeding tickets:\n");
  speeding = first_ticket - speed_limit;
  fine = speeding * rate;
  total = total + fine;
  printf("For going %d in a %d zone your ticket is $%d.\n", first_ticket,
         speed_limit, fine);
  speeding = second_ticket - speed_limit;
  fine = speeding * rate;
  total = total + fine;
  printf("For going %d in a %d zone your ticket is $%d.\n", second_ticket,
         speed_limit, fine);
  speeding = third_ticket - speed_limit;
  fine = speeding * rate;
  total = total + fine;
  printf("For going %d in a %d zone your ticket is $%d.\n", third_ticket,
         speed_limit, fine);
  printf("\n\tTotal in fines: \n\t\t$%d", total);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x37,-0x14(%rbp)
movl   $0xf,-0x18(%rbp)
movl   $0x55,-0x1c(%rbp)
movl   $0x5f,-0x20(%rbp)
movl   $0x64,-0x24(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    -0x1c(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rbx
mov    %rbx,%rdi
mov    $0x55,%esi
mov    $0x37,%edx
mov    $0x1c2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5f,%esi
mov    $0x37,%edx
mov    $0x258,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    $0x37,%edx
mov    $0x2a3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Speeding tickets:\0A\00"
@.str.1 = [47 x i8] c"For going %d in a %d zone your ticket is $%d.\0A\00"
@.str.2 = [25 x i8] c"\0A\09Total in fines: \0A\09\09$%d\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
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 55, i32* %5
store i32 15, i32* %6
store i32 85, i32* %7
store i32 95, i32* %8
store i32 100, i32* %9
%10 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = load i32, i32* %6
%16 = mul nsw i32 %14, %15
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
store i32 %19, i32* %2
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %8
%25 = load i32, i32* %5
%26 = sub nsw i32 %24, %25
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = load i32, i32* %6
%29 = mul nsw i32 %27, %28
store i32 %29, i32* %3
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = add nsw i32 %30, %31
store i32 %32, i32* %2
%33 = load i32, i32* %8
%34 = load i32, i32* %5
%35 = load i32, i32* %3
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
%37 = load i32, i32* %9
%38 = load i32, i32* %5
%39 = sub nsw i32 %37, %38
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = load i32, i32* %6
%42 = mul nsw i32 %40, %41
store i32 %42, i32* %3
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = add nsw i32 %43, %44
store i32 %45, i32* %2
%46 = load i32, i32* %9
%47 = load i32, i32* %5
%48 = load i32, i32* %3
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %46, i32 %47, i32 %48)
%50 = load i32, i32* %2
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Speeding tickets:\0A\00"
@.str.1 = [47 x i8] c"For going %d in a %d zone your ticket is $%d.\0A\00"
@.str.2 = [25 x i8] c"\0A\09Total in fines: \0A\09\09$%d\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 85, i32 55, i32 450)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 95, i32 55, i32 600)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 100, i32 55, i32 675)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 undef)
ret i32 0
}