#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;
    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("pll0_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    1249 <main+0x119>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%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     1260 <main+0x130>
cmpl   $0xff,-0x18(%rbp)
jle    1289 <main+0x159>
mov    -0x18(%rbp),%esi
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x14(%rbp)
jl     12a0 <main+0x170>
cmpl   $0xff,-0x14(%rbp)
jle    12c9 <main+0x199>
mov    -0x14(%rbp),%esi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd7f(%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    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd7e(%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    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd75(%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    122b <main+0xeb>
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1050 <atoi@plt>
mulss  0xe9e(%rip),%xmm0
divss  0xe9a(%rip),%xmm0
xor    %eax,%eax
nopl   0x0(%rax)
lea    0x1(%rax),%rbx
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%r14d
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jne    1192 <main+0x52>
jnp    11a5 <main+0x65>
cmp    $0xfe,%eax
ja     11a5 <main+0x65>
mov    %rbx,%rax
cmp    $0x100,%r14d
jl     1170 <main+0x30>
lea    -0x1(%rbx),%eax
cmp    $0xff,%eax
jae    1246 <main+0x106>
lea    -0x100(%r14),%eax
cmp    $0xffffff02,%eax
jbe    1251 <main+0x111>
lea    0xe7e(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
mov    %r14d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe71(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
shl    $0x8,%r14d
add    %rbx,%r14
lea    0xe66(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rsi),%rsi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xdcf(%rip),%rdi
mov    %ebx,%esi
jmp    125b <main+0x11b>
lea    0xddb(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3b(%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"pll0_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 %49
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 = sitofp i32 %44 to float
%46 = fmul float %43, %45
store float %46, float* %9
%47 = load float, float* %9
%48 = fptosi float %47 to i32
store i32 %48, i32* %6
br label %27
49: ; preds = %38
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = load i32, i32* %7
%54 = icmp sgt i32 %53, 255
br i1 %54, label %55, label %60
55: ; preds = %52, %49
%56 = load i32, i32* %7
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %52
%61 = load i32, i32* %6
%62 = icmp slt i32 %61, 3
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* %6
%65 = icmp sgt i32 %64, 255
br i1 %65, label %66, label %71
66: ; preds = %63, %60
%67 = load i32, i32* %6
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %63
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %74)
%76 = load i32, i32* %6
%77 = load i32, i32* %6
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %76, i32 %77)
%79 = load i32, i32* %7
%80 = load i32, i32* %7
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %79, i32 %80)
%82 = load i32, i32* %7
%83 = sext i32 %82 to i64
store i64 %83, i64* %10
%84 = load i32, i32* %6
%85 = shl i32 %84, 8
%86 = sext i32 %85 to i64
%87 = load i64, i64* %10
%88 = add i64 %87, %86
store i64 %88, i64* %10
%89 = load i64, i64* %10
%90 = load i64, i64* %10
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %89, i64 %90)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%93 = load i32, i32* %3
ret i32 %93
}

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"pll0_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 = sitofp i32 %16 to float
%18 = fmul float %13, %17
%19 = fptosi float %18 to i32
%20 = sitofp i32 %19 to float
%21 = fcmp une float %18, %20
%22 = icmp ult i32 %15, 255
%23 = select i1 %21, i1 %22, i1 false
%24 = icmp slt i32 %19, 256
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %14, label %26
26: ; preds = %14
%27 = icmp ugt i32 %15, 254
br i1 %27, label %28, label %32
28: ; preds = %26
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %26
%33 = add i32 %19, -256
%34 = icmp ult i32 %33, -253
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %19, i32 %19)
%42 = 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)
%43 = zext i32 %16 to i64
%44 = shl nuw nsw i32 %19, 8
%45 = zext i32 %44 to i64
%46 = add nuw nsw i64 %43, %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %46, i64 %46)
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}