#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *, int, char *);
int /*<<< orphan*/ safePrefWrite(int, char *);
int cbSendMsg(char **data, int argc, char **argv, char **azColName) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("Scriu de la '%s' la '%d' mesajul '%s'\n", data[0], atoi(argv[i]),
           data[1]);
    safePrefWrite(atoi(argv[i]), data[0]);
    safePrefWrite(atoi(argv[i]), data[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<cbSendMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11dd <cbSendMsg+0xad>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1030 <safePrefWrite@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <safePrefWrite@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <cbSendMsg+0x1e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbSendMsg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11b1 <cbSendMsg+0x81>
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%r13d
xor    %ebp,%ebp
lea    0xeaf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rbx
mov    (%r14,%rbp,8),%rdi
call   1050 <atoi@plt>
mov    0x8(%r12),%rcx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
mov    (%r14,%rbp,8),%rdi
call   1050 <atoi@plt>
mov    (%r12),%rsi
mov    %eax,%edi
call   1030 <safePrefWrite@plt>
mov    (%r14,%rbp,8),%rdi
call   1050 <atoi@plt>
mov    0x8(%r12),%rsi
mov    %eax,%edi
call   1030 <safePrefWrite@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1160 <cbSendMsg+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Scriu de la '%s' la '%d' mesajul '%s'\0A\00"
define i32 @cbSendMsg(i8** %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
store i32 0, i32* %9
br label %10
10: ; preds = %48, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %51
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %7
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %23, i8* %26)
%28 = load i8**, i8*** %7
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @safePrefWrite(i32 %33, i8* %36)
%38 = load i8**, i8*** %7
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @atoi(i8* %42)
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @safePrefWrite(i32 %43, i8* %46)
br label %48
48: ; preds = %14
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %10
51: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"Scriu de la '%s' la '%d' mesajul '%s'\0A\00"
define i32 @cbSendMsg(i8** nocapture %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %27
6: ; preds = %4
%7 = getelementptr inbounds i8*, i8** %0, i64 1
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %25, %9 ]
%11 = load i8*, i8** %0
%12 = getelementptr inbounds i8*, i8** %2, i64 %10
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = load i8*, i8** %7
%16 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %14, i8* %15)
%17 = load i8*, i8** %12
%18 = tail call i32 @atoi(i8* %17)
%19 = load i8*, i8** %0
%20 = tail call i32 @safePrefWrite(i32 %18, i8* %19)
%21 = load i8*, i8** %12
%22 = tail call i32 @atoi(i8* %21)
%23 = load i8*, i8** %7
%24 = tail call i32 @safePrefWrite(i32 %22, i8* %23)
%25 = add nuw nsw i64 %10, 1
%26 = icmp eq i64 %25, %8
br i1 %26, label %27, label %9
27: ; preds = %9, %4
ret i32 0
}