#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 /*<<< orphan*/ Qt_handleString(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ wheelSwitchFormat(char *, int *, int *);
void Qt_setWheelSwitchForm(char *widget, char *token) {
  int width, precision;
  char asc[10];
  (void)(widget);
  wheelSwitchFormat(token, &width, &precision);
  if (precision != 0) {
    sprintf(asc, "%d", width - precision - 2);
  } else {
    sprintf(asc, "%d", width - precision - 1);
  }
  Qt_handleString("integerDigits", "number", asc);
  sprintf(asc, "%d", precision);
  Qt_handleString("decimalDigits", "number", asc);
}


x86 assembly (clang, -O0):
<Qt_setWheelSwitchForm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <wheelSwitchFormat@plt>
cmpl   $0x0,-0x18(%rbp)
je     1179 <Qt_setWheelSwitchForm+0x49>
lea    -0x22(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    -0x18(%rbp),%edx
sub    $0x2,%edx
lea    0xe91(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1192 <Qt_setWheelSwitchForm+0x62>
lea    -0x22(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    -0x18(%rbp),%edx
sub    $0x1,%edx
lea    0xe73(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x22(%rbp),%rdx
lea    0xe66(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <Qt_handleString@plt>
lea    -0x22(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe49(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x22(%rbp),%rdx
lea    0xe51(%rip),%rdi
lea    0xe43(%rip),%rsi
call   1030 <Qt_handleString@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Qt_setWheelSwitchForm>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <wheelSwitchFormat@plt>
mov    0xc(%rsp),%eax
mov    $0xfffffffe,%ecx
sub    %eax,%ecx
cmp    $0x1,%eax
sbb    %edx,%edx
or     %ecx,%edx
add    0x10(%rsp),%edx
lea    0xe98(%rip),%r14
lea    0x16(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <sprintf@plt>
lea    0xe84(%rip),%rdi
lea    0xe8b(%rip),%r15
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <Qt_handleString@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <sprintf@plt>
lea    0xe71(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <Qt_handleString@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"integerDigits\00"
@.str.2 = [7 x i8] c"number\00"
@.str.3 = [14 x i8] c"decimalDigits\00"
define void @Qt_setWheelSwitchForm(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @wheelSwitchFormat(i8* %9, i32* %5, i32* %6)
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
%18 = sub nsw i32 %17, 2
%19 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %27
20: ; preds = %2
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = sub nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
%26 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20, %13
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%29 = call i32 @Qt_handleString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%31 = load i32, i32* %6
%32 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%34 = call i32 @Qt_handleString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %33)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"integerDigits\00"
@.str.2 = [7 x i8] c"number\00"
@.str.3 = [14 x i8] c"decimalDigits\00"
define void @Qt_setWheelSwitchForm(i8* nocapture readnone %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = call i32 @wheelSwitchFormat(i8* %1, i32* %3, i32* %4)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
%12 = load i32, i32* %3
%13 = sub i32 -2, %10
%14 = select i1 %11, i32 -1, i32 %13
%15 = add i32 %12, %14
%16 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @Qt_handleString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%18 = load i32, i32* %4
%19 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @Qt_handleString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret void
}