#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 */
float atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
main(int argc, char *argv[]) {
  int ndiv = 0, mdiv = 0;
  float frequ = 0, frequ_check = 1;
  unsigned long ndiv_mdiv = 0;
  if (argc != 2) {
    printf("usage: %s frequenz\n", argv[0]);
    exit(1);
  }
  frequ = atoi(argv[1]);
  frequ = frequ / 2 / 27;
  while (frequ_check != ndiv && mdiv <= 255 && ndiv <= 255) {
    mdiv++;
    frequ_check = frequ * (mdiv * 2);
    ndiv = frequ_check;
  }
  if (mdiv < 0 || mdiv > 255) {
    printf("mdiv not correct (%d)\n", mdiv);
    printf("frequenz can't be used\n");
    exit(1);
  }
  if (ndiv < 3 || ndiv > 255) {
    printf("ndiv not correct (%d)\n", ndiv);
    printf("frequenz can't be used\n");
    exit(1);
  }
  printf("frequ=%s\n", argv[1]);
  printf("ndiv=%d (%x)\n", ndiv, ndiv);
  printf("mdiv=%d (%x)\n", mdiv, mdiv);
  ndiv_mdiv = mdiv;
  ndiv_mdiv += (ndiv << 8);
  printf("pll1_ndiv_mdiv for module=%ld (%lx)\n", ndiv_mdiv, ndiv_mdiv);
  printf("frequenz is ok\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe9c(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  0xe4f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xe3f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
mov    %al,-0x29(%rbp)
jne    11f1 <main+0xc1>
jp     11f1 <main+0xc1>
jmp    1210 <main+0xe0>
xor    %eax,%eax
cmpl   $0xff,-0x18(%rbp)
mov    %al,-0x29(%rbp)
jg     1210 <main+0xe0>
cmpl   $0xff,-0x14(%rbp)
setle  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1220 <main+0xf0>
jmp    124e <main+0x11e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
cvttss2si -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11ce <main+0x9e>
cmpl   $0x0,-0x18(%rbp)
jl     1265 <main+0x135>
cmpl   $0xff,-0x18(%rbp)
jle    128e <main+0x15e>
mov    -0x18(%rbp),%esi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x14(%rbp)
jl     12a5 <main+0x175>
cmpl   $0xff,-0x14(%rbp)
jle    12ce <main+0x19e>
mov    -0x14(%rbp),%esi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
cltq
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    123f <main+0xff>
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1050 <atoi@plt>
mulss  0xe9e(%rip),%xmm0
divss  0xe9a(%rip),%xmm0
mov    $0x2,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%r14d
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
lea    0x1(%rcx),%rbx
ucomiss %xmm2,%xmm1
jne    11a2 <main+0x62>
jnp    11b9 <main+0x79>
cmp    $0xfe,%ecx
ja     11b9 <main+0x79>
add    $0x2,%eax
mov    %rbx,%rcx
cmp    $0x100,%r14d
jl     1180 <main+0x40>
lea    -0x1(%rbx),%eax
cmp    $0xff,%eax
jae    125a <main+0x11a>
lea    -0x100(%r14),%eax
cmp    $0xffffff02,%eax
jbe    1265 <main+0x125>
lea    0xe6a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
mov    %r14d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
shl    $0x8,%r14d
add    %rbx,%r14
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rsi),%rsi
lea    0xdbf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xdbb(%rip),%rdi
mov    %ebx,%esi
jmp    126f <main+0x12f>
lea    0xdc7(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"usage: %s frequenz\0A\00"
@.str.1 = [23 x i8] c"mdiv not correct (%d)\0A\00"
@.str.2 = [24 x i8] c"frequenz can't be used\0A\00"
@.str.3 = [23 x i8] c"ndiv not correct (%d)\0A\00"
@.str.4 = [10 x i8] c"frequ=%s\0A\00"
@.str.5 = [14 x i8] c"ndiv=%d (%x)\0A\00"
@.str.6 = [14 x i8] c"mdiv=%d (%x)\0A\00"
@.str.7 = [37 x i8] c"pll1_ndiv_mdiv for module=%ld (%lx)\0A\00"
@.str.8 = [16 x i8] c"frequenz is ok\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store float 0.000000e+00, float* %8
store float 1.000000e+00, float* %9
store i64 0, i64* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call float @atoi(i8* %22)
store float %23, float* %8
%24 = load float, float* %8
%25 = fdiv float %24, 2.000000e+00
%26 = fdiv float %25, 2.700000e+01
store float %26, float* %8
br label %27
27: ; preds = %40, %19
%28 = load float, float* %9
%29 = load i32, i32* %6
%30 = sitofp i32 %29 to float
%31 = fcmp une float %28, %30
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i32, i32* %7
%34 = icmp sle i32 %33, 255
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %6
%37 = icmp sle i32 %36, 255
br label %38
38: ; preds = %35, %32, %27
%39 = phi i1 [ false, %32 ], [ false, %27 ], [ %37, %35 ]
br i1 %39, label %40, label %50
40: ; preds = %38
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
%43 = load float, float* %8
%44 = load i32, i32* %7
%45 = mul nsw i32 %44, 2
%46 = sitofp i32 %45 to float
%47 = fmul float %43, %46
store float %47, float* %9
%48 = load float, float* %9
%49 = fptosi float %48 to i32
store i32 %49, i32* %6
br label %27
50: ; preds = %38
%51 = load i32, i32* %7
%52 = icmp slt i32 %51, 0
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = load i32, i32* %7
%55 = icmp sgt i32 %54, 255
br i1 %55, label %56, label %61
56: ; preds = %53, %50
%57 = load i32, i32* %7
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %53
%62 = load i32, i32* %6
%63 = icmp slt i32 %62, 3
br i1 %63, label %67, label %64
64: ; preds = %61
%65 = load i32, i32* %6
%66 = icmp sgt i32 %65, 255
br i1 %66, label %67, label %72
67: ; preds = %64, %61
%68 = load i32, i32* %6
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %64
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %75)
%77 = load i32, i32* %6
%78 = load i32, i32* %6
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %77, i32 %78)
%80 = load i32, i32* %7
%81 = load i32, i32* %7
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %80, i32 %81)
%83 = load i32, i32* %7
%84 = sext i32 %83 to i64
store i64 %84, i64* %10
%85 = load i32, i32* %6
%86 = shl i32 %85, 8
%87 = sext i32 %86 to i64
%88 = load i64, i64* %10
%89 = add i64 %88, %87
store i64 %89, i64* %10
%90 = load i64, i64* %10
%91 = load i64, i64* %10
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %90, i64 %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%94 = load i32, i32* %3
ret i32 %94
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s frequenz\0A\00"
@.str.1 = [23 x i8] c"mdiv not correct (%d)\0A\00"
@.str.3 = [23 x i8] c"ndiv not correct (%d)\0A\00"
@.str.4 = [10 x i8] c"frequ=%s\0A\00"
@.str.5 = [14 x i8] c"ndiv=%d (%x)\0A\00"
@.str.6 = [14 x i8] c"mdiv=%d (%x)\0A\00"
@.str.7 = [37 x i8] c"pll1_ndiv_mdiv for module=%ld (%lx)\0A\00"
@str = [15 x i8] c"frequenz is ok\00"
@str.10 = [23 x i8] c"frequenz can't be used\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call float @atoi(i8* %10)
%12 = fmul float %11, 5.000000e-01
%13 = fdiv float %12, 2.700000e+01
br label %14
14: ; preds = %8, %14
%15 = phi i32 [ 0, %8 ], [ %16, %14 ]
%16 = add nuw nsw i32 %15, 1
%17 = shl nuw nsw i32 %16, 1
%18 = sitofp i32 %17 to float
%19 = fmul float %13, %18
%20 = fptosi float %19 to i32
%21 = sitofp i32 %20 to float
%22 = fcmp une float %19, %21
%23 = icmp ult i32 %15, 255
%24 = select i1 %22, i1 %23, i1 false
%25 = icmp slt i32 %20, 256
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %14, label %27
27: ; preds = %14
%28 = icmp ugt i32 %15, 254
br i1 %28, label %29, label %33
29: ; preds = %27
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %27
%34 = add i32 %20, -256
%35 = icmp ult i32 %34, -253
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %33
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %20, i32 %20)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %16, i32 %16)
%44 = zext i32 %16 to i64
%45 = shl nuw nsw i32 %20, 8
%46 = zext i32 %45 to i64
%47 = add nuw nsw i64 %44, %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %47, i64 %47)
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}