#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*/ strcat(char *, char *);
int /*<<< orphan*/ system(char *);
int TxtToSpeech(int txt_len, char *txt, char *lan) {
  char url_tts[200] = "mpg123 -q \"http://translate.google.com/translate_tts";
  char txt_b[100];
  strcat(url_tts, "?tl=");
  strcat(url_tts, lan);
  strcat(url_tts, "&q=");
  {
    int i;
    for (i = 0; i < txt_len; i++) {
      if (*(txt + i) == 0)
        break;
      else if (*(txt + i) == ' ')
        txt_b[i] = '+';
      else
        txt_b[i] = *(txt + i);
    }
    txt_b[i] = '\"';
    txt_b[i + 1] = 0;
  }
  strcat(url_tts, txt_b);
  system(url_tts);
}


x86 assembly (clang, -O0):
<TxtToSpeech>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0xc8,%edx
call   1040 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xf5c(%rip),%rsi
call   1050 <strcat@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0xe0(%rbp),%rdi
lea    0xf3e(%rip),%rsi
call   1050 <strcat@plt>
movl   $0x0,-0x154(%rbp)
mov    -0x154(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1230 <TxtToSpeech+0x100>
mov    -0x10(%rbp),%rax
movslq -0x154(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11ca <TxtToSpeech+0x9a>
jmp    1230 <TxtToSpeech+0x100>
mov    -0x10(%rbp),%rax
movslq -0x154(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11f6 <TxtToSpeech+0xc6>
movslq -0x154(%rbp),%rax
movb   $0x2b,-0x150(%rbp,%rax,1)
2b
jmp    1212 <TxtToSpeech+0xe2>
mov    -0x10(%rbp),%rax
movslq -0x154(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x154(%rbp),%rax
mov    %cl,-0x150(%rbp,%rax,1)
jmp    1217 <TxtToSpeech+0xe7>
jmp    121c <TxtToSpeech+0xec>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    119e <TxtToSpeech+0x6e>
movslq -0x154(%rbp),%rax
movb   $0x22,-0x150(%rbp,%rax,1)
22
mov    -0x154(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x150(%rbp,%rax,1)
lea    -0xe0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TxtToSpeech>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x138,%rsp
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,%r15d
lea    0xeb3(%rip),%rsi
lea    0x70(%rsp),%rbx
mov    $0xc8,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
lea    0xf62(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
lea    0xf4d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   %r15d,%r15d
jle    11c0 <TxtToSpeech+0x90>
mov    %r15d,%ecx
xor    %eax,%eax
jmp    11ac <TxtToSpeech+0x7c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %bl,(%rsp,%rax,1)
add    $0x1,%rax
cmp    %rax,%rcx
je     11c4 <TxtToSpeech+0x94>
movzbl 0x0(%rbp,%rax,1),%edx
mov    $0x2b,%bl
cmp    $0x20,%dl
je     11a0 <TxtToSpeech+0x70>
test   %dl,%dl
je     11c6 <TxtToSpeech+0x96>
mov    %edx,%ebx
jmp    11a0 <TxtToSpeech+0x70>
xor    %eax,%eax
jmp    11c6 <TxtToSpeech+0x96>
mov    %ecx,%eax
mov    %eax,%eax
movw   $0x22,(%rsp,%rax,1)
lea    0x70(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x138,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.TxtToSpeech.url_tts = [200 x i8] c"mpg123 -q \22http://translate.google.com/translate_tts\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"?tl=\00"
@.str.1 = [4 x i8] c"&q=\00"
define i32 @TxtToSpeech(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [200 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%11 = bitcast [200 x i8]* %8 to i8*
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %10
br label %19
19: ; preds = %55, %3
%20 = load i32, i32* %10
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %58
23: ; preds = %19
%24 = load i8*, i8** %6
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %23
br label %58
32: ; preds = %23
%33 = load i8*, i8** %6
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 32
br i1 %39, label %40, label %44
40: ; preds = %32
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %42
store i8 43, i8* %43
br label %53
44: ; preds = %32
%45 = load i8*, i8** %6
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %51
store i8 %49, i8* %52
br label %53
53: ; preds = %44, %40
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %19
58: ; preds = %31, %19
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %60
store i8 34, i8* %61
%62 = load i32, i32* %10
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %64
store i8 0, i8* %65
%66 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%68 = call i32 @strcat(i8* %66, i8* %67)
%69 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%70 = call i32 @system(i8* %69)
%71 = load i32, i32* %4
ret i32 %71
}

LLVM IR (-O2):
@__const.TxtToSpeech.url_tts = [200 x i8] c"mpg123 -q \22http://translate.google.com/translate_tts\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"?tl=\00"
@.str.1 = [4 x i8] c"&q=\00"
define i32 @TxtToSpeech(i32 %0, i8* nocapture %1, i8* %2) {
%4 = alloca [200 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%8 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @strcat(i8* %6, i8* %2)
%10 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp sgt i32 %0, 0
br i1 %11, label %12, label %26
12: ; preds = %3
%13 = zext i32 %0 to i64
br label %14
14: ; preds = %12, %19
%15 = phi i64 [ 0, %12 ], [ %22, %19 ]
%16 = getelementptr inbounds i8, i8* %1, i64 %15
%17 = load i8, i8* %16
switch i8 %17, label %18 [
i8 0, label %24
i8 32, label %19
]
18: ; preds = %14
br label %19
19: ; preds = %14, %18
%20 = phi i8 [ %17, %18 ], [ 43, %14 ]
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %15
store i8 %20, i8* %21
%22 = add nuw nsw i64 %15, 1
%23 = icmp eq i64 %22, %13
br i1 %23, label %26, label %14
24: ; preds = %14
%25 = trunc i64 %15 to i32
br label %26
26: ; preds = %19, %24, %3
%27 = phi i32 [ 0, %3 ], [ %25, %24 ], [ %0, %19 ]
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %28
store i8 34, i8* %29
%30 = add nuw nsw i32 %27, 1
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i32 @strcat(i8* %6, i8* %7)
%34 = call i32 @system(i8* %6)
ret i32 undef
}