#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
struct TYPE_3__ {
  unsigned int width;
  scalar_t__ height;
  int /*<<< orphan*/ member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};
typedef TYPE_1__ XRectangle;
typedef int /*<<< orphan*/ XFontSet;

/* Variables and functions */
int /*<<< orphan*/ XwcTextExtents(int /*<<< orphan*/, int /*<<< orphan*/ *, int,
                                  TYPE_1__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ wcslen(int /*<<< orphan*/ *);
void computeTextSize(XFontSet *fs, wchar_t **texts, int size,
                     unsigned int spaceBetweenLines, unsigned int *w,
                     unsigned int *h) {
  int i;
  XRectangle rect = {0, 0, 0, 0};
  *h = 0;
  *w = 0;
  for (i = 0; i < size; i++) {
    XwcTextExtents(*fs, texts[i], (int)wcslen(texts[i]), &rect, NULL);
    *w = (rect.width > *w) ? (rect.width) : *w;
    *h += rect.height + spaceBetweenLines;
    fflush(stdin);
  }
}


x86 assembly (clang, -O0):
<computeTextSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1233 <computeTextSize+0xf3>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <wcslen@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    -0x50(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <XwcTextExtents@plt>
mov    -0x50(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jbe    11f0 <computeTextSize+0xb0>
mov    -0x50(%rbp),%eax
mov    %eax,-0x60(%rbp)
jmp    11f9 <computeTextSize+0xb9>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%eax
add    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    %rdx,%rcx
mov    %ecx,(%rax)
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1189 <computeTextSize+0x49>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeTextSize>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,(%r9)
movl   $0x0,(%r8)
test   %edx,%edx
jle    11df <computeTextSize+0xaf>
mov    %r9,%rbp
mov    %r8,%r14
mov    %ecx,%ebx
mov    %edx,%eax
mov    %rax,0x8(%rsp)
xor    %r12d,%r12d
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
nopl   (%rax)
mov    (%rdi),%r13d
mov    (%rsi,%r12,8),%r15
mov    %r15,%rdi
call   1030 <wcslen@plt>
mov    %r13d,%edi
mov    %r15,%rsi
mov    %eax,%edx
lea    0x20(%rsp),%rcx
xor    %r8d,%r8d
call   1050 <XwcTextExtents@plt>
mov    0x20(%rsp),%eax
mov    (%r14),%ecx
cmp    %ecx,%eax
cmova  %eax,%ecx
mov    %ecx,(%r14)
mov    0x28(%rsp),%eax
add    %ebx,%eax
add    %eax,0x0(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
add    $0x1,%r12
cmp    %r12,0x8(%rsp)
jne    1180 <computeTextSize+0x50>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64, i32, i32, i32, i32 }
@stdin = global i32 0
define void @computeTextSize(i32* %0, i32** %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca %struct.TYPE_3__
store i32* %0, i32** %7
store i32** %1, i32*** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%15 = bitcast %struct.TYPE_3__* %14 to i8*
%16 = load i32*, i32** %12
store i32 0, i32* %16
%17 = load i32*, i32** %11
store i32 0, i32* %17
store i32 0, i32* %13
br label %18
18: ; preds = %64, %6
%19 = load i32, i32* %13
%20 = load i32, i32* %9
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %67
22: ; preds = %18
%23 = load i32*, i32** %7
%24 = load i32, i32* %23
%25 = load i32**, i32*** %8
%26 = load i32, i32* %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32*, i32** %25, i64 %27
%29 = load i32*, i32** %28
%30 = load i32**, i32*** %8
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32*, i32** %30, i64 %32
%34 = load i32*, i32** %33
%35 = call i64 @wcslen(i32* %34)
%36 = trunc i64 %35 to i32
%37 = call i32 @XwcTextExtents(i32 %24, i32* %29, i32 %36, %struct.TYPE_3__* %14, i32* null)
%38 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 0
%39 = load i32, i32* %38
%40 = load i32*, i32** %11
%41 = load i32, i32* %40
%42 = icmp ugt i32 %39, %41
br i1 %42, label %43, label %46
43: ; preds = %22
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 0
%45 = load i32, i32* %44
br label %49
46: ; preds = %22
%47 = load i32*, i32** %11
%48 = load i32, i32* %47
br label %49
49: ; preds = %46, %43
%50 = phi i32 [ %45, %43 ], [ %48, %46 ]
%51 = load i32*, i32** %11
store i32 %50, i32* %51
%52 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 1
%53 = load i64, i64* %52
%54 = load i32, i32* %10
%55 = zext i32 %54 to i64
%56 = add nsw i64 %53, %55
%57 = load i32*, i32** %12
%58 = load i32, i32* %57
%59 = zext i32 %58 to i64
%60 = add nsw i64 %59, %56
%61 = trunc i64 %60 to i32
store i32 %61, i32* %57
%62 = load i32, i32* @stdin
%63 = call i32 @fflush(i32 %62)
br label %64
64: ; preds = %49
%65 = load i32, i32* %13
%66 = add nsw i32 %65, 1
store i32 %66, i32* %13
br label %18
67: ; preds = %18
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64, i32, i32, i32, i32 }
@stdin = global i32 0
define void @computeTextSize(i32* nocapture %0, i32** nocapture %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = alloca %struct.TYPE_3__
%8 = bitcast %struct.TYPE_3__* %7 to i8*
store i32 0, i32* %5
store i32 0, i32* %4
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %35
10: ; preds = %6
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i64 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i64 0, i32 1
%13 = zext i32 %2 to i64
br label %14
14: ; preds = %10, %14
%15 = phi i64 [ 0, %10 ], [ %33, %14 ]
%16 = load i32, i32* %0
%17 = getelementptr inbounds i32*, i32** %1, i64 %15
%18 = load i32*, i32** %17
%19 = call i64 @wcslen(i32* %18)
%20 = trunc i64 %19 to i32
%21 = call i32 @XwcTextExtents(i32 %16, i32* %18, i32 %20, %struct.TYPE_3__* %7, i32* null)
%22 = load i32, i32* %11
%23 = load i32, i32* %4
%24 = icmp ugt i32 %22, %23
%25 = select i1 %24, i32 %22, i32 %23
store i32 %25, i32* %4
%26 = load i64, i64* %12
%27 = load i32, i32* %5
%28 = trunc i64 %26 to i32
%29 = add i32 %28, %3
%30 = add i32 %29, %27
store i32 %30, i32* %5
%31 = load i32, i32* @stdin
%32 = call i32 @fflush(i32 %31)
%33 = add nuw nsw i64 %15, 1
%34 = icmp eq i64 %33, %13
br i1 %34, label %35, label %14
35: ; preds = %14, %6
ret void
}