#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*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void ex1() {
  int qtdp[1][30], qtdv[1][30];
  char name[30][30], alph[5] = {'a', 'b', 'c', 'd', 'e'};
  srand(time(NULL));
  for (int i = 0; i < 30; i++) {
    for (int k = 0; k < 30; k++) {
      qtdp[1][k] = rand() % 100 + 30;
      qtdv[1][k] = rand() % 40 + 1;
      for (int j = 0; j < 30; j++) {
        name[j][i] = alph[(unsigned int)rand() % 5];
      }
      printf("%c", name[k][i]);
    }
    printf("\n%s ||  %s ||  %d\n\n", "Quantidade estoque",
           qtdp[1][i] - qtdv[1][i] < 50 ? "Estoque abaixo de 50" : "\b\b\b\b\b",
           qtdp[1][i] - qtdv[1][i] >= 0 ? qtdp[1][i] - qtdv[1][i] : 0);
  }
}


x86 assembly (clang, -O0):
<ex1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
mov    0xeaf(%rip),%eax
mov    %eax,-0x495(%rbp)
mov    0xea7(%rip),%al
mov    %al,-0x491(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x49c(%rbp)
cmpl   $0x1e,-0x49c(%rbp)
jge    1341 <ex1+0x201>
movl   $0x0,-0x4a0(%rbp)
cmpl   $0x1e,-0x4a0(%rbp)
jge    1283 <ex1+0x143>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1e,%edx
movslq -0x4a0(%rbp),%rax
mov    %edx,-0x8(%rbp,%rax,4)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x28,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x4a0(%rbp),%rax
mov    %edx,-0x88(%rbp,%rax,4)
movl   $0x0,-0x4a4(%rbp)
cmpl   $0x1e,-0x4a4(%rbp)
jge    1241 <ex1+0x101>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
mov    -0x495(%rbp,%rax,1),%dl
movslq -0x4a4(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x1e,%rcx,%rcx
add    %rcx,%rax
movslq -0x49c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x4a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a4(%rbp)
jmp    11e8 <ex1+0xa8>
movslq -0x4a0(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x1e,%rcx,%rcx
add    %rcx,%rax
movslq -0x49c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a0(%rbp)
jmp    1194 <ex1+0x54>
movslq -0x49c(%rbp),%rax
mov    -0x8(%rbp,%rax,4),%edx
movslq -0x49c(%rbp),%rax
sub    -0x88(%rbp,%rax,4),%edx
lea    0xda1(%rip),%rax
lea    0xd85(%rip),%rcx
cmp    $0x32,%edx
cmovl  %rcx,%rax
mov    %rax,-0x4b0(%rbp)
movslq -0x49c(%rbp),%rax
mov    -0x8(%rbp,%rax,4),%eax
movslq -0x49c(%rbp),%rcx
sub    -0x88(%rbp,%rcx,4),%eax
cmp    $0x0,%eax
jl     12fe <ex1+0x1be>
movslq -0x49c(%rbp),%rax
mov    -0x8(%rbp,%rax,4),%eax
movslq -0x49c(%rbp),%rcx
sub    -0x88(%rbp,%rcx,4),%eax
mov    %eax,-0x4b4(%rbp)
jmp    130b <ex1+0x1cb>
xor    %eax,%eax
mov    %eax,-0x4b4(%rbp)
jmp    130b <ex1+0x1cb>
mov    -0x4b0(%rbp),%rdx
mov    -0x4b4(%rbp),%ecx
lea    0xce9(%rip),%rdi
lea    0xcf6(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    117d <ex1+0x3d>
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x488,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0x100(%rsp),%rbx
mov    $0xcccccccd,%r13d
lea    0xe7c(%rip),%rbp
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1e,%eax
mov    %eax,0xf8(%rsp,%r14,4)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
shl    $0x3,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x78(%rsp,%r14,4)
mov    $0xfffffffffffffc7c,%r12
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ecx
imul   %r13,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movzbl (%rax,%rbp,1),%eax
mov    %al,0x384(%rbx,%r12,1)
add    $0x1e,%r12
jne    1210 <ex1+0xc0>
mov    %r14,%rax
shl    $0x5,%rax
sub    %r14,%rax
sub    %r14,%rax
add    %rsp,%rax
add    $0x100,%rax
movsbl (%r15,%rax,1),%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    $0x1e,%r14
jne    11a0 <ex1+0x50>
mov    0xf8(%rsp,%r15,4),%ecx
sub    0x78(%rsp,%r15,4),%ecx
cmp    $0x32,%ecx
lea    0xdc4(%rip),%rdx
lea    0xda8(%rip),%rax
cmovl  %rax,%rdx
test   %ecx,%ecx
mov    $0x0,%eax
cmovs  %eax,%ecx
lea    0xd6c(%rip),%rdi
lea    0xd79(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
add    $0x1,%rbx
cmp    $0x1e,%r15
jne    1190 <ex1+0x40>
add    $0x488,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.ex1.alph = [5 x i8] c"abcde"
@.str = [3 x i8] c"%c\00"
@.str.1 = [20 x i8] c"\0A%s || %s || %d\0A\0A\00"
@.str.2 = [19 x i8] c"Quantidade estoque\00"
@.str.3 = [21 x i8] c"Estoque abaixo de 50\00"
@.str.4 = [6 x i8] c"\08\08\08\08\08\00"
define void @ex1() {
%1 = alloca [1 x [30 x i32]]
%2 = alloca [1 x [30 x i32]]
%3 = alloca [30 x [30 x i8]]
%4 = alloca [5 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast [5 x i8]* %4 to i8*
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %5
br label %11
11: ; preds = %107, %0
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 30
br i1 %13, label %14, label %110
14: ; preds = %11
store i32 0, i32* %6
br label %15
15: ; preds = %61, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 30
br i1 %17, label %18, label %64
18: ; preds = %15
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 100
%21 = add nsw i32 %20, 30
%22 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [30 x i32], [30 x i32]* %22, i64 0, i64 %24
store i32 %21, i32* %25
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 40
%28 = add nsw i32 %27, 1
%29 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [30 x i32], [30 x i32]* %29, i64 0, i64 %31
store i32 %28, i32* %32
store i32 0, i32* %7
br label %33
33: ; preds = %48, %18
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 30
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = call i32 (...) @rand()
%38 = urem i32 %37, 5
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %3, i64 0, i64 %43
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [30 x i8], [30 x i8]* %44, i64 0, i64 %46
store i8 %41, i8* %47
br label %48
48: ; preds = %36
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %33
51: ; preds = %33
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %3, i64 0, i64 %53
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [30 x i8], [30 x i8]* %54, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %51
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %15
64: ; preds = %15
%65 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1
%66 = load i32, i32* %5
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [30 x i32], [30 x i32]* %65, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [30 x i32], [30 x i32]* %70, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = sub nsw i32 %69, %74
%76 = icmp slt i32 %75, 50
%77 = zext i1 %76 to i64
%78 = select i1 %76, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%79 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1
%80 = load i32, i32* %5
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [30 x i32], [30 x i32]* %79, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1
%85 = load i32, i32* %5
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [30 x i32], [30 x i32]* %84, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = sub nsw i32 %83, %88
%90 = icmp sge i32 %89, 0
br i1 %90, label %91, label %103
91: ; preds = %64
%92 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [30 x i32], [30 x i32]* %92, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1
%98 = load i32, i32* %5
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [30 x i32], [30 x i32]* %97, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = sub nsw i32 %96, %101
br label %104
103: ; preds = %64
br label %104
104: ; preds = %103, %91
%105 = phi i32 [ %102, %91 ], [ 0, %103 ]
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %78, i32 %105)
br label %107
107: ; preds = %104
%108 = load i32, i32* %5
%109 = add nsw i32 %108, 1
store i32 %109, i32* %5
br label %11
110: ; preds = %11
ret void
}

LLVM IR (-O2):
@__const.ex1.alph = [5 x i8] c"abcde"
@.str.1 = [20 x i8] c"\0A%s || %s || %d\0A\0A\00"
@.str.2 = [19 x i8] c"Quantidade estoque\00"
@.str.3 = [21 x i8] c"Estoque abaixo de 50\00"
@.str.4 = [6 x i8] c"\08\08\08\08\08\00"
define void @ex1() {
%1 = alloca [1 x [30 x i32]]
%2 = alloca [1 x [30 x i32]]
%3 = alloca [30 x [30 x i8]]
%4 = bitcast [1 x [30 x i32]]* %1 to i8*
%5 = bitcast [1 x [30 x i32]]* %2 to i8*
%6 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %3, i64 0, i64 0, i64 0
%7 = tail call i32 @time(i32* null)
%8 = tail call i32 @srand(i32 %7)
br label %9
9: ; preds = %0, %12
%10 = phi i64 [ 0, %0 ], [ %23, %12 ]
br label %25
11: ; preds = %12
ret void
12: ; preds = %35
%13 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1, i64 %10
%14 = load i32, i32* %13
%15 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1, i64 %10
%16 = load i32, i32* %15
%17 = sub nsw i32 %14, %16
%18 = icmp slt i32 %17, 50
%19 = select i1 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%20 = icmp sgt i32 %17, 0
%21 = select i1 %20, i32 %17, i32 0
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %19, i32 %21)
%23 = add nuw nsw i64 %10, 1
%24 = icmp eq i64 %23, 30
br i1 %24, label %11, label %9
25: ; preds = %9, %35
%26 = phi i64 [ 0, %9 ], [ %40, %35 ]
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 100
%29 = add nsw i32 %28, 30
%30 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %1, i64 0, i64 1, i64 %26
store i32 %29, i32* %30
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 40
%33 = add nsw i32 %32, 1
%34 = getelementptr inbounds [1 x [30 x i32]], [1 x [30 x i32]]* %2, i64 0, i64 1, i64 %26
store i32 %33, i32* %34
br label %42
35: ; preds = %42
%36 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %3, i64 0, i64 %26, i64 %10
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = tail call i32 @putchar(i32 %38)
%40 = add nuw nsw i64 %26, 1
%41 = icmp eq i64 %40, 30
br i1 %41, label %12, label %25
42: ; preds = %25, %42
%43 = phi i64 [ 0, %25 ], [ %50, %42 ]
%44 = tail call i32 (...) @rand()
%45 = urem i32 %44, 5
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [5 x i8], [5 x i8]* @__const.ex1.alph, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %3, i64 0, i64 %43, i64 %10
store i8 %48, i8* %49
%50 = add nuw nsw i64 %43, 1
%51 = icmp eq i64 %50, 30
br i1 %51, label %35, label %42
}