const char *rough_amount(int a, int m) {
  int p = (a * 100) / m;
  if (p < 10) {
    return "sehr wenige";
  } else if (p < 30) {
    return "wenige";
  } else if (p < 60) {
    return "relativ viele";
  } else if (p < 90) {
    return "viele";
  }
  return "sehr viele";
}


x86 assembly (clang, -O0):
<rough_amount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
imul   $0x64,-0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    112f <rough_amount+0x2f>
lea    0xeda(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1197 <rough_amount+0x97>
cmpl   $0x1e,-0x14(%rbp)
jge    1149 <rough_amount+0x49>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1197 <rough_amount+0x97>
cmpl   $0x3c,-0x14(%rbp)
jge    1163 <rough_amount+0x63>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1197 <rough_amount+0x97>
cmpl   $0x5a,-0x14(%rbp)
jge    117d <rough_amount+0x7d>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1197 <rough_amount+0x97>
jmp    1182 <rough_amount+0x82>
jmp    1187 <rough_amount+0x87>
jmp    118c <rough_amount+0x8c>
lea    0xe87(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rough_amount>:
imul   $0x64,%edi,%eax
cltd
idiv   %esi
cmp    $0xa,%eax
jge    1113 <rough_amount+0x13>
lea    0xeee(%rip),%rax
ret
cmp    $0x1e,%eax
jae    1120 <rough_amount+0x20>
lea    0xee6(%rip),%rax
ret
cmp    $0x3c,%eax
jae    112d <rough_amount+0x2d>
lea    0xee0(%rip),%rax
ret
cmp    $0x5a,%eax
lea    0xee8(%rip),%rcx
lea    0xedc(%rip),%rax
cmovb  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"sehr wenige\00"
@.str.1 = [7 x i8] c"wenige\00"
@.str.2 = [14 x i8] c"relativ viele\00"
@.str.3 = [6 x i8] c"viele\00"
@.str.4 = [11 x i8] c"sehr viele\00"
define i8* @rough_amount(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = mul nsw i32 %7, 100
%9 = load i32, i32* %5
%10 = sdiv i32 %8, %9
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %3
br label %30
14: ; preds = %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 30
br i1 %16, label %17, label %18
17: ; preds = %14
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %30
18: ; preds = %14
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 60
br i1 %20, label %21, label %22
21: ; preds = %18
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %30
22: ; preds = %18
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 90
br i1 %24, label %25, label %26
25: ; preds = %22
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %30
26: ; preds = %22
br label %27
27: ; preds = %26
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %30
30: ; preds = %29, %25, %21, %17, %13
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
@.str = [12 x i8] c"sehr wenige\00"
@.str.1 = [7 x i8] c"wenige\00"
@.str.2 = [14 x i8] c"relativ viele\00"
@.str.3 = [6 x i8] c"viele\00"
@.str.4 = [11 x i8] c"sehr viele\00"
define i8* @rough_amount(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 100
%4 = sdiv i32 %3, %1
%5 = icmp slt i32 %4, 10
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = icmp ult i32 %4, 30
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = icmp ult i32 %4, 60
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = icmp ult i32 %4, 90
%12 = select i1 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0)
br label %13
13: ; preds = %10, %8, %6, %2
%14 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %8 ], [ %12, %10 ]
ret i8* %14
}