#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 */
struct Calibration {
  int dummy;
};

/* Variables and functions */
char *single_cali(char *, struct Calibration *);
char *multi_cali(char *clean_str, int cali_num,
                 struct Calibration *calis[cali_num]) {
  int i;
  struct Calibration *cali_now;
  for (i = 0; i < cali_num; i++) {
    cali_now = calis[i];
    clean_str = single_cali(clean_str, cali_now);
  }
  return clean_str;
}


x86 assembly (clang, -O0):
<multi_cali>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1165 <multi_cali+0x55>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <single_cali@plt>
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <multi_cali+0x1a>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi_cali>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rax
test   %esi,%esi
jle    1145 <multi_cali+0x35>
mov    %rdx,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rsi
mov    %rax,%rdi
call   1030 <single_cali@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <multi_cali+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Calibration = type { i32 }
define i8* @multi_cali(i8* %0, i32 %1, %struct.Calibration** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.Calibration**
%7 = alloca i32
%8 = alloca %struct.Calibration*
store i8* %0, i8** %4
store i32 %1, i32* %5
store %struct.Calibration** %2, %struct.Calibration*** %6
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
store i32 0, i32* %7
br label %11
11: ; preds = %24, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load %struct.Calibration**, %struct.Calibration*** %6
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds %struct.Calibration*, %struct.Calibration** %16, i64 %18
%20 = load %struct.Calibration*, %struct.Calibration** %19
store %struct.Calibration* %20, %struct.Calibration** %8
%21 = load i8*, i8** %4
%22 = load %struct.Calibration*, %struct.Calibration** %8
%23 = call i8* @single_cali(i8* %21, %struct.Calibration* %22)
store i8* %23, i8** %4
br label %24
24: ; preds = %15
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %11
27: ; preds = %11
%28 = load i8*, i8** %4
ret i8* %28
}

LLVM IR (-O2):
%struct.Calibration = type { i32 }
define i8* @multi_cali(i8* %0, i32 %1, %struct.Calibration** nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = phi i8* [ %0, %5 ], [ %12, %7 ]
%10 = getelementptr inbounds %struct.Calibration*, %struct.Calibration** %2, i64 %8
%11 = load %struct.Calibration*, %struct.Calibration** %10
%12 = tail call i8* @single_cali(i8* %9, %struct.Calibration* %11)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi i8* [ %0, %3 ], [ %12, %7 ]
ret i8* %16
}