#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 / 30;
  while (frequ_check != ndiv && mdiv <= 7 && ndiv <= 255) {
    mdiv++;
    frequ_check = frequ * mdiv;
    ndiv = frequ_check;
  }
  if (mdiv < 0 || mdiv > 7) {
    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    120d <main+0xdd>
xor    %eax,%eax
cmpl   $0x7,-0x18(%rbp)
mov    %al,-0x29(%rbp)
jg     120d <main+0xdd>
cmpl   $0xff,-0x14(%rbp)
setle  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    121d <main+0xed>
jmp    1246 <main+0x116>
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     125a <main+0x12a>
cmpl   $0x7,-0x18(%rbp)
jle    1283 <main+0x153>
mov    -0x18(%rbp),%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x14(%rbp)
jl     129a <main+0x16a>
cmpl   $0xff,-0x14(%rbp)
jle    12c3 <main+0x193>
mov    -0x14(%rbp),%esi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd85(%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    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd84(%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    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd7b(%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   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    1340 <main+0x200>
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1050 <atoi@plt>
mulss  0xe9f(%rip),%xmm0
divss  0xe9b(%rip),%xmm0
cvttss2si %xmm0,%ebx
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
mov    $0x1,%ebp
jne    1186 <main+0x46>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movaps %xmm0,%xmm1
addss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x2,%ebp
jne    11b6 <main+0x76>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movss  0xe3e(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x3,%ebp
jne    11eb <main+0xab>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movss  0xe0d(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x4,%ebp
jne    1220 <main+0xe0>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movss  0xddc(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x5,%ebp
jne    1251 <main+0x111>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movss  0xdb3(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x6,%ebp
jne    127e <main+0x13e>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
movss  0xd8a(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
xor    %eax,%eax
ucomiss %xmm2,%xmm1
mov    $0x7,%ebp
jne    12ab <main+0x16b>
jnp    12c6 <main+0x186>
cmp    $0xff,%ebx
jg     12c6 <main+0x186>
mulss  0xd61(%rip),%xmm0
cvttss2si %xmm0,%ebx
mov    $0x8,%ebp
mov    $0x1,%al
test   %al,%al
jne    135b <main+0x21b>
lea    -0x100(%rbx),%eax
cmp    $0xffffff02,%eax
jbe    1366 <main+0x226>
lea    0xd7c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd75(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd71(%rip),%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
shl    $0x8,%ebx
or     %ebp,%ebx
lea    0xd68(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd79(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    (%rsi),%rsi
lea    0xcd6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xcd2(%rip),%rdi
mov    %ebp,%esi
jmp    136f <main+0x22f>
lea    0xcde(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd3f(%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, 3.000000e+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, 7
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, 7
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, 3.000000e+01
%14 = fptosi float %13 to i32
%15 = sitofp i32 %14 to float
%16 = fcmp une float %13, %15
%17 = icmp slt i32 %14, 256
%18 = and i1 %16, %17
br i1 %18, label %19, label %64
19: ; preds = %8
%20 = fmul float %13, 2.000000e+00
%21 = fptosi float %20 to i32
%22 = sitofp i32 %21 to float
%23 = fcmp une float %20, %22
%24 = icmp slt i32 %21, 256
%25 = and i1 %23, %24
br i1 %25, label %26, label %64
26: ; preds = %19
%27 = fmul float %13, 3.000000e+00
%28 = fptosi float %27 to i32
%29 = sitofp i32 %28 to float
%30 = fcmp une float %27, %29
%31 = icmp slt i32 %28, 256
%32 = and i1 %30, %31
br i1 %32, label %33, label %64
33: ; preds = %26
%34 = fmul float %13, 4.000000e+00
%35 = fptosi float %34 to i32
%36 = sitofp i32 %35 to float
%37 = fcmp une float %34, %36
%38 = icmp slt i32 %35, 256
%39 = and i1 %37, %38
br i1 %39, label %40, label %64
40: ; preds = %33
%41 = fmul float %13, 5.000000e+00
%42 = fptosi float %41 to i32
%43 = sitofp i32 %42 to float
%44 = fcmp une float %41, %43
%45 = icmp slt i32 %42, 256
%46 = and i1 %44, %45
br i1 %46, label %47, label %64
47: ; preds = %40
%48 = fmul float %13, 6.000000e+00
%49 = fptosi float %48 to i32
%50 = sitofp i32 %49 to float
%51 = fcmp une float %48, %50
%52 = icmp slt i32 %49, 256
%53 = and i1 %51, %52
br i1 %53, label %54, label %64
54: ; preds = %47
%55 = fmul float %13, 7.000000e+00
%56 = fptosi float %55 to i32
%57 = sitofp i32 %56 to float
%58 = fcmp une float %55, %57
%59 = icmp slt i32 %56, 256
%60 = and i1 %58, %59
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = fmul float %13, 8.000000e+00
%63 = fptosi float %62 to i32
br label %64
64: ; preds = %61, %54, %47, %40, %33, %26, %19, %8
%65 = phi i1 [ true, %61 ], [ false, %54 ], [ false, %47 ], [ false, %40 ], [ false, %33 ], [ false, %26 ], [ false, %19 ], [ false, %8 ]
%66 = phi i32 [ 8, %61 ], [ 7, %54 ], [ 6, %47 ], [ 5, %40 ], [ 4, %33 ], [ 3, %26 ], [ 2, %19 ], [ 1, %8 ]
%67 = phi i32 [ %63, %61 ], [ %56, %54 ], [ %49, %47 ], [ %42, %40 ], [ %35, %33 ], [ %28, %26 ], [ %21, %19 ], [ %14, %8 ]
br i1 %65, label %68, label %72
68: ; preds = %64
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%71 = tail call i32 @exit(i32 1)
unreachable
72: ; preds = %64
%73 = add i32 %67, -256
%74 = icmp ult i32 %73, -253
br i1 %74, label %75, label %79
75: ; preds = %72
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%78 = tail call i32 @exit(i32 1)
unreachable
79: ; preds = %72
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %67, i32 %67)
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %66, i32 %66)
%83 = shl nuw nsw i32 %67, 8
%84 = or i32 %66, %83
%85 = zext i32 %84 to i64
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %85, i64 %85)
%87 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}