#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*/ atoi(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ puts(char *);
char *scale(int /*<<< orphan*/, int /*<<< orphan*/, char *, int *);
int main(int argc, char **argv) {
  if (argc != 4)
    return 1;
  bool f;
  char *s = scale(atoi(argv[1]), atoi(argv[2]), argv[3], &f);
  if (s)
    puts(s);
  if (f)
    free(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     116c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <main+0x91>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    -0x14(%rbp),%rcx
call   1050 <scale@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11b7 <main+0x77>
mov    -0x20(%rbp),%rdi
call   1040 <puts@plt>
cmpl   $0x0,-0x14(%rbp)
je     11ca <main+0x8a>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x4,%edi
jne    119d <main+0x5d>
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    0x18(%rbx),%rdx
lea    0x4(%rsp),%rcx
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <scale@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1186 <main+0x46>
mov    %rbx,%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
je     1195 <main+0x55>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 4
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %36
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = call i8* @scale(i32 %15, i32 %19, i8* %22, i32* %6)
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %29
26: ; preds = %11
%27 = load i8*, i8** %7
%28 = call i32 @puts(i8* %27)
br label %29
29: ; preds = %26, %11
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i8*, i8** %7
%34 = call i32 @free(i8* %33)
br label %35
35: ; preds = %32, %29
store i32 0, i32* %3
br label %36
36: ; preds = %35, %10
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 4
br i1 %4, label %5, label %25
5: ; preds = %2
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = call i8* @scale(i32 %9, i32 %12, i8* %14, i32* %3)
%16 = icmp eq i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %5
%18 = call i32 @puts(i8* %15)
br label %19
19: ; preds = %17, %5
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = call i32 @free(i8* %15)
br label %24
24: ; preds = %22, %19
br label %25
25: ; preds = %2, %24
%26 = phi i32 [ 0, %24 ], [ 1, %2 ]
ret i32 %26
}