#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ipod_set_cpu_speed(int);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    print_help();
    exit(1);
  }
  int speed = atoi(argv[1]);
  if (!speed || speed < 45 || speed > 81) {
    printf("Please specify a valid CPU speed in MHz between 45 and 81.\n");
    print_help();
    exit(1);
  } else {
    ipod_set_cpu_speed(speed);
    printf("CPU speed set to %iMHz\n", speed);
    exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1181 <main+0x31>
mov    $0x0,%al
call   1060 <print_help@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11af <main+0x5f>
cmpl   $0x2d,-0x14(%rbp)
jl     11af <main+0x5f>
cmpl   $0x51,-0x14(%rbp)
jle    11ce <main+0x7e>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <print_help@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
call   1040 <ipod_set_cpu_speed@plt>
mov    -0x14(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1185 <main+0x25>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
lea    -0x52(%rbx),%eax
cmp    $0xffffffda,%eax
ja     1196 <main+0x36>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <print_help@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %ebx,%edi
call   1050 <ipod_set_cpu_speed@plt>
lea    0xe5c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"Please specify a valid CPU speed in MHz between 45 and 81.\0A\00"
@.str.1 = [24 x i8] c"CPU speed set to %iMHz\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (...) @print_help()
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %12
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 45
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %6
%24 = icmp sgt i32 %23, 81
br i1 %24, label %25, label %29
25: ; preds = %22, %19, %12
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%27 = call i32 (...) @print_help()
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %22
%30 = load i32, i32* %6
%31 = call i32 @ipod_set_cpu_speed(i32 %30)
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"CPU speed set to %iMHz\0A\00"
@str = [59 x i8] c"Please specify a valid CPU speed in MHz between 45 and 81.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 (...) @print_help()
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = add i32 %10, -82
%12 = icmp ult i32 %11, -37
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 (...) @print_help()
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %7
%18 = tail call i32 @ipod_set_cpu_speed(i32 %10)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%20 = tail call i32 @exit(i32 0)
unreachable
}