#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*/ fatal_error(char *, char const *);
int /*<<< orphan*/ int2_char(int, unsigned char *);
int sscanf(char const *, char *, int *, int *);
int f_set_center(int mode, unsigned char **sec, float *data, unsigned int ndata,
                 char *inv_out, void **local, const char *arg1) {
  int i, center, subcenter;
  if (mode >= 0) {
    i = sscanf(arg1, "%d:%d", &center, &subcenter);
    if (i == 0)
      fatal_error("set_center: bad arg %s", arg1);
    int2_char(center, sec[1] + 5);
    if (i == 2)
      int2_char(subcenter, sec[1] + 7);
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_set_center>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     11c8 <f_set_center+0x98>
mov    0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1040 <sscanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1191 <f_set_center+0x61>
mov    0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1030 <fatal_error@plt>
mov    -0x38(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
add    $0x5,%rsi
call   1050 <int2_char@plt>
cmpl   $0x2,-0x34(%rbp)
jne    11c3 <f_set_center+0x93>
mov    -0x3c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
add    $0x7,%rsi
call   1050 <int2_char@plt>
jmp    11c8 <f_set_center+0x98>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_set_center>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
js     1199 <f_set_center+0x69>
mov    %rsi,%rbx
mov    0x30(%rsp),%r14
lea    0xeb5(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
call   1040 <sscanf@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1172 <f_set_center+0x42>
lea    0xe9c(%rip),%rdi
mov    %r14,%rsi
call   1030 <fatal_error@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rbx),%rsi
add    $0x5,%rsi
call   1050 <int2_char@plt>
cmp    $0x2,%ebp
jne    1199 <f_set_center+0x69>
mov    0x8(%rsp),%edi
mov    0x8(%rbx),%rsi
add    $0x7,%rsi
call   1050 <int2_char@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [23 x i8] c"set_center: bad arg %s\00"
define i32 @f_set_center(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8**
%10 = alloca float*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %8
store i8** %1, i8*** %9
store float* %2, float** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8** %5, i8*** %13
store i8* %6, i8** %14
%18 = load i32, i32* %8
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %45
20: ; preds = %7
%21 = load i8*, i8** %14
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %16, i32* %17)
store i32 %22, i32* %15
%23 = load i32, i32* %15
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %14
%27 = call i32 @fatal_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %20
%29 = load i32, i32* %16
%30 = load i8**, i8*** %9
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 5
%34 = call i32 @int2_char(i32 %29, i8* %33)
%35 = load i32, i32* %15
%36 = icmp eq i32 %35, 2
br i1 %36, label %37, label %44
37: ; preds = %28
%38 = load i32, i32* %17
%39 = load i8**, i8*** %9
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 7
%43 = call i32 @int2_char(i32 %38, i8* %42)
br label %44
44: ; preds = %37, %28
br label %45
45: ; preds = %44, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [23 x i8] c"set_center: bad arg %s\00"
define i32 @f_set_center(i32 %0, i8** nocapture %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = bitcast i32* %8 to i8*
%11 = bitcast i32* %9 to i8*
%12 = icmp sgt i32 %0, -1
br i1 %12, label %13, label %30
13: ; preds = %7
%14 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @fatal_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %8
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 5
%23 = call i32 @int2_char(i32 %19, i8* %22)
%24 = icmp eq i32 %14, 2
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = load i32, i32* %9
%27 = load i8*, i8** %20
%28 = getelementptr inbounds i8, i8* %27, i64 7
%29 = call i32 @int2_char(i32 %26, i8* %28)
br label %30
30: ; preds = %18, %25, %7
ret i32 0
}